]> git.sesse.net Git - ffmpeg/blob - libavformat/swf.h
Merge commit '0b9a237b2386ff84a6f99716bd58fa27a1b767e7'
[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 typedef struct SWFContext {
124     int64_t duration_pos;
125     int64_t tag_pos;
126     int64_t vframes_pos;
127     int samples_per_frame;
128     int sound_samples;
129     int swf_frame_number;
130     int video_frame_number;
131     int frame_rate;
132     int tag;
133     AVFifoBuffer *audio_fifo;
134     AVCodecParameters *audio_par, *video_par;
135     AVStream *video_st;
136 #if CONFIG_ZLIB
137 #define ZBUF_SIZE 4096
138     AVIOContext *zpb;
139     uint8_t *zbuf_in;
140     uint8_t *zbuf_out;
141     z_stream zstream;
142 #endif
143 } SWFContext;
144
145 extern const AVCodecTag ff_swf_codec_tags[];
146
147 #endif /* AVFORMAT_SWF_H */