swf.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Flash Compatible Streaming Format common header.
  3. * Copyright (c) 2000 Fabrice Bellard
  4. * Copyright (c) 2003 Tinic Uro
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef AVFORMAT_SWF_H
  23. #define AVFORMAT_SWF_H
  24. #include "libavutil/fifo.h"
  25. #include "avformat.h"
  26. #include "avio.h"
  27. #include "riff.h" /* for CodecTag */
  28. /* should have a generic way to indicate probable size */
  29. #define DUMMY_FILE_SIZE (100 * 1024 * 1024)
  30. #define DUMMY_DURATION 600 /* in seconds */
  31. #define TAG_END 0
  32. #define TAG_SHOWFRAME 1
  33. #define TAG_DEFINESHAPE 2
  34. #define TAG_FREECHARACTER 3
  35. #define TAG_PLACEOBJECT 4
  36. #define TAG_REMOVEOBJECT 5
  37. #define TAG_STREAMHEAD 18
  38. #define TAG_STREAMBLOCK 19
  39. #define TAG_JPEG2 21
  40. #define TAG_PLACEOBJECT2 26
  41. #define TAG_STREAMHEAD2 45
  42. #define TAG_VIDEOSTREAM 60
  43. #define TAG_VIDEOFRAME 61
  44. #define TAG_FILEATTRIBUTES 69
  45. #define TAG_LONG 0x100
  46. /* flags for shape definition */
  47. #define FLAG_MOVETO 0x01
  48. #define FLAG_SETFILL0 0x02
  49. #define FLAG_SETFILL1 0x04
  50. #define AUDIO_FIFO_SIZE 65536
  51. /* character id used */
  52. #define BITMAP_ID 0
  53. #define VIDEO_ID 0
  54. #define SHAPE_ID 1
  55. #undef NDEBUG
  56. #include <assert.h>
  57. typedef struct {
  58. int audio_stream_index;
  59. int64_t duration_pos;
  60. int64_t tag_pos;
  61. int64_t vframes_pos;
  62. int samples_per_frame;
  63. int sound_samples;
  64. int swf_frame_number;
  65. int video_frame_number;
  66. int frame_rate;
  67. int tag;
  68. AVFifoBuffer audio_fifo;
  69. AVCodecContext *audio_enc, *video_enc;
  70. } SWFContext;
  71. static const AVCodecTag swf_codec_tags[] = {
  72. {CODEC_ID_FLV1, 0x02},
  73. {CODEC_ID_VP6F, 0x04},
  74. {0, 0},
  75. };
  76. static const AVCodecTag swf_audio_codec_tags[] = {
  77. {CODEC_ID_PCM_S16LE, 0x00},
  78. {CODEC_ID_ADPCM_SWF, 0x01},
  79. {CODEC_ID_MP3, 0x02},
  80. {CODEC_ID_PCM_S16LE, 0x03},
  81. //{CODEC_ID_NELLYMOSER, 0x06},
  82. {0, 0},
  83. };
  84. #endif /* AVFORMAT_SWF_H */