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