]> git.sesse.net Git - ffmpeg/blob - libavformat/swf.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / swf.h
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
23 #ifndef AVFORMAT_SWF_H
24 #define AVFORMAT_SWF_H
25
26 #if CONFIG_ZLIB
27 #include <zlib.h>
28 #endif
29
30 #include "libavutil/fifo.h"
31 #include "avformat.h"
32 #include "avio.h"
33 #include "riff.h"    /* for CodecTag */
34
35 /* should have a generic way to indicate probable size */
36 #define DUMMY_FILE_SIZE   (100 * 1024 * 1024)
37 #define DUMMY_DURATION    600 /* in seconds */
38
39 #define TAG_END           0
40 #define TAG_SHOWFRAME     1
41 #define TAG_DEFINESHAPE   2
42 #define TAG_FREECHARACTER 3
43 #define TAG_PLACEOBJECT   4
44 #define TAG_REMOVEOBJECT  5
45 #define TAG_STREAMHEAD    18
46 #define TAG_STREAMBLOCK   19
47 #define TAG_JPEG2         21
48 #define TAG_PLACEOBJECT2  26
49 #define TAG_STREAMHEAD2   45
50 #define TAG_VIDEOSTREAM   60
51 #define TAG_VIDEOFRAME    61
52 #define TAG_FILEATTRIBUTES 69
53
54 #define TAG_LONG         0x100
55
56 /* flags for shape definition */
57 #define FLAG_MOVETO      0x01
58 #define FLAG_SETFILL0    0x02
59 #define FLAG_SETFILL1    0x04
60
61 #define AUDIO_FIFO_SIZE 65536
62
63 /* character id used */
64 #define BITMAP_ID 0
65 #define VIDEO_ID 0
66 #define SHAPE_ID  1
67
68 #undef NDEBUG
69 #include <assert.h>
70
71 typedef struct {
72     int64_t duration_pos;
73     int64_t tag_pos;
74     int64_t vframes_pos;
75     int samples_per_frame;
76     int sound_samples;
77     int swf_frame_number;
78     int video_frame_number;
79     int frame_rate;
80     int tag;
81     AVFifoBuffer *audio_fifo;
82     AVCodecContext *audio_enc, *video_enc;
83 #if CONFIG_ZLIB
84     AVIOContext *zpb;
85 #define ZBUF_SIZE 4096
86     uint8_t *zbuf_in;
87     uint8_t *zbuf_out;
88     z_stream zstream;
89 #endif
90 } SWFContext;
91
92 static const AVCodecTag swf_codec_tags[] = {
93     {CODEC_ID_FLV1, 0x02},
94     {CODEC_ID_VP6F, 0x04},
95     {CODEC_ID_NONE,    0},
96 };
97
98 static const AVCodecTag swf_audio_codec_tags[] = {
99     {CODEC_ID_PCM_S16LE,  0x00},
100     {CODEC_ID_ADPCM_SWF,  0x01},
101     {CODEC_ID_MP3,        0x02},
102     {CODEC_ID_PCM_S16LE,  0x03},
103   //{CODEC_ID_NELLYMOSER, 0x06},
104     {CODEC_ID_NONE,          0},
105 };
106
107 #endif /* AVFORMAT_SWF_H */