You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.6KB

  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 "riff.h" /* for CodecTag */
  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. #define TAG_END 0
  36. #define TAG_SHOWFRAME 1
  37. #define TAG_DEFINESHAPE 2
  38. #define TAG_FREECHARACTER 3
  39. #define TAG_PLACEOBJECT 4
  40. #define TAG_REMOVEOBJECT 5
  41. #define TAG_DEFINEBITS 6
  42. #define TAG_DEFINEBUTTON 7
  43. #define TAG_JPEGTABLES 8
  44. #define TAG_SETBACKGROUNDCOLOR 9
  45. #define TAG_DEFINEFONT 10
  46. #define TAG_DEFINETEXT 11
  47. #define TAG_DOACTION 12
  48. #define TAG_DEFINEFONTINFO 13
  49. #define TAG_DEFINESOUND 14
  50. #define TAG_STARTSOUND 15
  51. #define TAG_DEFINEBUTTONSOUND 17
  52. #define TAG_STREAMHEAD 18
  53. #define TAG_STREAMBLOCK 19
  54. #define TAG_DEFINEBITSLOSSLESS 20
  55. #define TAG_JPEG2 21
  56. #define TAG_DEFINESHAPE2 22
  57. #define TAG_DEFINEBUTTONCXFORM 23
  58. #define TAG_PROTECT 24
  59. #define TAG_PLACEOBJECT2 26
  60. #define TAG_REMOVEOBJECT2 28
  61. #define TAG_DEFINESHAPE3 32
  62. #define TAG_DEFINETEXT2 33
  63. #define TAG_DEFINEBUTTON2 34
  64. #define TAG_DEFINEBITSJPEG3 35
  65. #define TAG_DEFINEBITSLOSSLESS2 36
  66. #define TAG_DEFINEEDITTEXT 37
  67. #define TAG_DEFINESPRITE 39
  68. #define TAG_FRAMELABEL 43
  69. #define TAG_STREAMHEAD2 45
  70. #define TAG_DEFINEMORPHSHAPE 46
  71. #define TAG_DEFINEFONT2 48
  72. #define TAG_EXPORTASSETS 56
  73. #define TAG_IMPORTASSETS 57
  74. #define TAG_ENABLEDEBUGGER 58
  75. #define TAG_DOINITACTION 59
  76. #define TAG_VIDEOSTREAM 60
  77. #define TAG_VIDEOFRAME 61
  78. #define TAG_DEFINEFONTINFO2 62
  79. #define TAG_ENABLEDEBUGGER2 64
  80. #define TAG_SCRIPTLIMITS 65
  81. #define TAG_SETTABINDEX 66
  82. #define TAG_FILEATTRIBUTES 69
  83. #define TAG_PLACEOBJECT3 70
  84. #define TAG_IMPORTASSETS2 71
  85. #define TAG_DEFINEFONTALIGNZONES 73
  86. #define TAG_CSMTEXTSETTINGS 74
  87. #define TAG_DEFINEFONT3 75
  88. #define TAG_SYMBOLCLASS 76
  89. #define TAG_METADATA 77
  90. #define TAG_DEFINESCALINGGRID 78
  91. #define TAG_DOABC 82
  92. #define TAG_DEFINESHAPE4 83
  93. #define TAG_DEFINEMORPHSHAPE2 84
  94. #define TAG_DEFINESCENEANDFRAMELABELDATA 86
  95. #define TAG_DEFINEBINARYDATA 87
  96. #define TAG_DEFINEFONTNAME 88
  97. #define TAG_STARTSOUND2 89
  98. #define TAG_DEFINEBITSJPEG4 90
  99. #define TAG_DEFINEFONT4 91
  100. #define TAG_LONG 0x100
  101. /* flags for shape definition */
  102. #define FLAG_MOVETO 0x01
  103. #define FLAG_SETFILL0 0x02
  104. #define FLAG_SETFILL1 0x04
  105. #define AUDIO_FIFO_SIZE 65536
  106. /* character id used */
  107. #define BITMAP_ID 0
  108. #define VIDEO_ID 0
  109. #define SHAPE_ID 1
  110. #undef NDEBUG
  111. #include <assert.h>
  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. AVCodecContext *audio_enc, *video_enc;
  124. #if CONFIG_ZLIB
  125. AVIOContext *zpb;
  126. #define ZBUF_SIZE 4096
  127. uint8_t *zbuf_in;
  128. uint8_t *zbuf_out;
  129. z_stream zstream;
  130. #endif
  131. } SWFContext;
  132. extern const AVCodecTag ff_swf_codec_tags[];
  133. #endif /* AVFORMAT_SWF_H */