00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef AVFORMAT_SWF_H
00024 #define AVFORMAT_SWF_H
00025 
00026 #include "libavutil/fifo.h"
00027 #include "avformat.h"
00028 #include "avio.h"
00029 #include "riff.h"    
00030 
00031 
00032 #define DUMMY_FILE_SIZE   (100 * 1024 * 1024)
00033 #define DUMMY_DURATION    600 
00034 
00035 #define TAG_END           0
00036 #define TAG_SHOWFRAME     1
00037 #define TAG_DEFINESHAPE   2
00038 #define TAG_FREECHARACTER 3
00039 #define TAG_PLACEOBJECT   4
00040 #define TAG_REMOVEOBJECT  5
00041 #define TAG_STREAMHEAD    18
00042 #define TAG_STREAMBLOCK   19
00043 #define TAG_JPEG2         21
00044 #define TAG_PLACEOBJECT2  26
00045 #define TAG_STREAMHEAD2   45
00046 #define TAG_VIDEOSTREAM   60
00047 #define TAG_VIDEOFRAME    61
00048 #define TAG_FILEATTRIBUTES 69
00049 
00050 #define TAG_LONG         0x100
00051 
00052 
00053 #define FLAG_MOVETO      0x01
00054 #define FLAG_SETFILL0    0x02
00055 #define FLAG_SETFILL1    0x04
00056 
00057 #define AUDIO_FIFO_SIZE 65536
00058 
00059 
00060 #define BITMAP_ID 0
00061 #define VIDEO_ID 0
00062 #define SHAPE_ID  1
00063 
00064 #undef NDEBUG
00065 #include <assert.h>
00066 
00067 typedef struct {
00068     int audio_stream_index;
00069     int64_t duration_pos;
00070     int64_t tag_pos;
00071     int64_t vframes_pos;
00072     int samples_per_frame;
00073     int sound_samples;
00074     int swf_frame_number;
00075     int video_frame_number;
00076     int frame_rate;
00077     int tag;
00078     AVFifoBuffer audio_fifo;
00079     AVCodecContext *audio_enc, *video_enc;
00080 } SWFContext;
00081 
00082 static const AVCodecTag swf_codec_tags[] = {
00083     {CODEC_ID_FLV1, 0x02},
00084     {CODEC_ID_VP6F, 0x04},
00085     {0, 0},
00086 };
00087 
00088 static const AVCodecTag swf_audio_codec_tags[] = {
00089     {CODEC_ID_PCM_S16LE,  0x00},
00090     {CODEC_ID_ADPCM_SWF,  0x01},
00091     {CODEC_ID_MP3,        0x02},
00092     {CODEC_ID_PCM_S16LE,  0x03},
00093   
00094     {0, 0},
00095 };
00096 
00097 #endif