swf.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 "config.h"
  25. #if CONFIG_ZLIB
  26. #include <zlib.h>
  27. #endif
  28. #include "libavutil/fifo.h"
  29. #include "avformat.h"
  30. #include "avio.h"
  31. #include "internal.h"
  32. /* should have a generic way to indicate probable size */
  33. #define DUMMY_FILE_SIZE (100 * 1024 * 1024)
  34. #define DUMMY_DURATION 600 /* in seconds */
  35. enum {
  36. TAG_END = 0,
  37. TAG_SHOWFRAME = 1,
  38. TAG_DEFINESHAPE = 2,
  39. TAG_FREECHARACTER = 3,
  40. TAG_PLACEOBJECT = 4,
  41. TAG_REMOVEOBJECT = 5,
  42. TAG_DEFINEBITS = 6,
  43. TAG_DEFINEBUTTON = 7,
  44. TAG_JPEGTABLES = 8,
  45. TAG_SETBACKGROUNDCOLOR = 9,
  46. TAG_DEFINEFONT = 10,
  47. TAG_DEFINETEXT = 11,
  48. TAG_DOACTION = 12,
  49. TAG_DEFINEFONTINFO = 13,
  50. TAG_DEFINESOUND = 14,
  51. TAG_STARTSOUND = 15,
  52. TAG_DEFINEBUTTONSOUND = 17,
  53. TAG_STREAMHEAD = 18,
  54. TAG_STREAMBLOCK = 19,
  55. TAG_DEFINEBITSLOSSLESS = 20,
  56. TAG_JPEG2 = 21,
  57. TAG_DEFINESHAPE2 = 22,
  58. TAG_DEFINEBUTTONCXFORM = 23,
  59. TAG_PROTECT = 24,
  60. TAG_PLACEOBJECT2 = 26,
  61. TAG_REMOVEOBJECT2 = 28,
  62. TAG_DEFINESHAPE3 = 32,
  63. TAG_DEFINETEXT2 = 33,
  64. TAG_DEFINEBUTTON2 = 34,
  65. TAG_DEFINEBITSJPEG3 = 35,
  66. TAG_DEFINEBITSLOSSLESS2 = 36,
  67. TAG_DEFINEEDITTEXT = 37,
  68. TAG_DEFINESPRITE = 39,
  69. TAG_FRAMELABEL = 43,
  70. TAG_STREAMHEAD2 = 45,
  71. TAG_DEFINEMORPHSHAPE = 46,
  72. TAG_DEFINEFONT2 = 48,
  73. TAG_EXPORTASSETS = 56,
  74. TAG_IMPORTASSETS = 57,
  75. TAG_ENABLEDEBUGGER = 58,
  76. TAG_DOINITACTION = 59,
  77. TAG_VIDEOSTREAM = 60,
  78. TAG_VIDEOFRAME = 61,
  79. TAG_DEFINEFONTINFO2 = 62,
  80. TAG_ENABLEDEBUGGER2 = 64,
  81. TAG_SCRIPTLIMITS = 65,
  82. TAG_SETTABINDEX = 66,
  83. TAG_FILEATTRIBUTES = 69,
  84. TAG_PLACEOBJECT3 = 70,
  85. TAG_IMPORTASSETS2 = 71,
  86. TAG_DEFINEFONTALIGNZONES = 73,
  87. TAG_CSMTEXTSETTINGS = 74,
  88. TAG_DEFINEFONT3 = 75,
  89. TAG_SYMBOLCLASS = 76,
  90. TAG_METADATA = 77,
  91. TAG_DEFINESCALINGGRID = 78,
  92. TAG_DOABC = 82,
  93. TAG_DEFINESHAPE4 = 83,
  94. TAG_DEFINEMORPHSHAPE2 = 84,
  95. TAG_DEFINESCENEANDFRAMELABELDATA = 86,
  96. TAG_DEFINEBINARYDATA = 87,
  97. TAG_DEFINEFONTNAME = 88,
  98. TAG_STARTSOUND2 = 89,
  99. TAG_DEFINEBITSJPEG4 = 90,
  100. TAG_DEFINEFONT4 = 91,
  101. };
  102. #define TAG_LONG 0x100
  103. /* flags for shape definition */
  104. #define FLAG_MOVETO 0x01
  105. #define FLAG_SETFILL0 0x02
  106. #define FLAG_SETFILL1 0x04
  107. #define AUDIO_FIFO_SIZE 65536
  108. /* character id used */
  109. #define BITMAP_ID 0
  110. #define VIDEO_ID 0
  111. #define SHAPE_ID 1
  112. typedef struct SWFContext {
  113. int64_t duration_pos;
  114. int64_t tag_pos;
  115. int64_t vframes_pos;
  116. int samples_per_frame;
  117. int sound_samples;
  118. int swf_frame_number;
  119. int video_frame_number;
  120. int frame_rate;
  121. int tag;
  122. AVFifoBuffer *audio_fifo;
  123. AVCodecParameters *audio_par, *video_par;
  124. AVStream *video_st;
  125. #if CONFIG_ZLIB
  126. #define ZBUF_SIZE 4096
  127. AVIOContext *zpb;
  128. uint8_t *zbuf_in;
  129. uint8_t *zbuf_out;
  130. z_stream zstream;
  131. #endif
  132. } SWFContext;
  133. extern const AVCodecTag ff_swf_codec_tags[];
  134. #endif /* AVFORMAT_SWF_H */