swf.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_STREAMHEAD 18
  42. #define TAG_STREAMBLOCK 19
  43. #define TAG_JPEG2 21
  44. #define TAG_PLACEOBJECT2 26
  45. #define TAG_STREAMHEAD2 45
  46. #define TAG_VIDEOSTREAM 60
  47. #define TAG_VIDEOFRAME 61
  48. #define TAG_FILEATTRIBUTES 69
  49. #define TAG_LONG 0x100
  50. /* flags for shape definition */
  51. #define FLAG_MOVETO 0x01
  52. #define FLAG_SETFILL0 0x02
  53. #define FLAG_SETFILL1 0x04
  54. #define AUDIO_FIFO_SIZE 65536
  55. /* character id used */
  56. #define BITMAP_ID 0
  57. #define VIDEO_ID 0
  58. #define SHAPE_ID 1
  59. #undef NDEBUG
  60. #include <assert.h>
  61. typedef struct {
  62. int64_t duration_pos;
  63. int64_t tag_pos;
  64. int64_t vframes_pos;
  65. int samples_per_frame;
  66. int sound_samples;
  67. int swf_frame_number;
  68. int video_frame_number;
  69. int frame_rate;
  70. int tag;
  71. AVFifoBuffer *audio_fifo;
  72. AVCodecContext *audio_enc, *video_enc;
  73. #if CONFIG_ZLIB
  74. AVIOContext *zpb;
  75. #define ZBUF_SIZE 4096
  76. uint8_t *zbuf_in;
  77. uint8_t *zbuf_out;
  78. z_stream zstream;
  79. #endif
  80. } SWFContext;
  81. extern const AVCodecTag ff_swf_codec_tags[];
  82. #endif /* AVFORMAT_SWF_H */