Statistics
| Branch: | Revision:

ffmpeg / libavformat / flvenc.c @ 470bce2b

History | View | Annotate | Download (12.5 KB)

1 d4f5d74a Garrick Meeker
/*
2 7fbde343 Aurelien Jacobs
 * FLV muxer
3 d4f5d74a Garrick Meeker
 * Copyright (c) 2003 The FFmpeg Project.
4
 *
5 b78e7197 Diego Biurrun
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8 d4f5d74a Garrick Meeker
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10 b78e7197 Diego Biurrun
 * version 2.1 of the License, or (at your option) any later version.
11 d4f5d74a Garrick Meeker
 *
12 b78e7197 Diego Biurrun
 * FFmpeg is distributed in the hope that it will be useful,
13 d4f5d74a Garrick Meeker
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18 b78e7197 Diego Biurrun
 * License along with FFmpeg; if not, write to the Free Software
19 5509bffa Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 d4f5d74a Garrick Meeker
 */
21
#include "avformat.h"
22 6cac3a3b Allan Hsu
#include "flv.h"
23 148c9bdb Allan Hsu
#include "riff.h"
24 f23496b5 Baptiste Coudurier
#include "avc.h"
25 d4f5d74a Garrick Meeker
26 068f2a22 Michael Niedermayer
#undef NDEBUG
27
#include <assert.h>
28
29 7caf0cc6 Michael Niedermayer
static const AVCodecTag flv_video_codec_ids[] = {
30 148c9bdb Allan Hsu
    {CODEC_ID_FLV1,    FLV_CODECID_H263  },
31
    {CODEC_ID_FLASHSV, FLV_CODECID_SCREEN},
32
    {CODEC_ID_VP6F,    FLV_CODECID_VP6   },
33 09d8c0ae Benjamin Larsson
    {CODEC_ID_VP6,     FLV_CODECID_VP6   },
34 f23496b5 Baptiste Coudurier
    {CODEC_ID_H264,    FLV_CODECID_H264  },
35 148c9bdb Allan Hsu
    {CODEC_ID_NONE,    0}
36
};
37
38 7caf0cc6 Michael Niedermayer
static const AVCodecTag flv_audio_codec_ids[] = {
39 148c9bdb Allan Hsu
    {CODEC_ID_MP3,       FLV_CODECID_MP3    >> FLV_AUDIO_CODECID_OFFSET},
40 44de39f9 Michael Niedermayer
    {CODEC_ID_PCM_S8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
41
    {CODEC_ID_PCM_S16BE, FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
42 148c9bdb Allan Hsu
    {CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET},
43
    {CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM  >> FLV_AUDIO_CODECID_OFFSET},
44 f23496b5 Baptiste Coudurier
    {CODEC_ID_AAC,       FLV_CODECID_AAC    >> FLV_AUDIO_CODECID_OFFSET},
45 b7d1cd02 Bartlomiej Wolowiec
    {CODEC_ID_NELLYMOSER, FLV_CODECID_NELLYMOSER >> FLV_AUDIO_CODECID_OFFSET},
46 148c9bdb Allan Hsu
    {CODEC_ID_NONE,      0}
47
};
48
49 d4f5d74a Garrick Meeker
typedef struct FLVContext {
50 11a8e425 Michael Niedermayer
    int reserved;
51 bc5c918e Diego Biurrun
    int64_t duration_offset;
52
    int64_t filesize_offset;
53 634b8cfa Baptiste Coudurier
    int64_t duration;
54 f23496b5 Baptiste Coudurier
    int delay; ///< first dts delay for AVC
55 d4f5d74a Garrick Meeker
} FLVContext;
56
57 37cdf93d Michael Niedermayer
static int get_audio_flags(AVCodecContext *enc){
58 dd1c8f3e Luca Abeni
    int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
59 37cdf93d Michael Niedermayer
60 f23496b5 Baptiste Coudurier
    if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters
61
        return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
62
    else {
63 37cdf93d Michael Niedermayer
    switch (enc->sample_rate) {
64
        case    44100:
65 6cac3a3b Allan Hsu
            flags |= FLV_SAMPLERATE_44100HZ;
66 37cdf93d Michael Niedermayer
            break;
67
        case    22050:
68 6cac3a3b Allan Hsu
            flags |= FLV_SAMPLERATE_22050HZ;
69 37cdf93d Michael Niedermayer
            break;
70
        case    11025:
71 6cac3a3b Allan Hsu
            flags |= FLV_SAMPLERATE_11025HZ;
72 37cdf93d Michael Niedermayer
            break;
73
        case     8000: //nellymoser only
74
        case     5512: //not mp3
75 4838727e Michael Niedermayer
            if(enc->codec_id != CODEC_ID_MP3){
76 ec627278 Michael Niedermayer
                flags |= FLV_SAMPLERATE_SPECIAL;
77
                break;
78 4838727e Michael Niedermayer
            }
79 37cdf93d Michael Niedermayer
        default:
80 755bfeab Diego Biurrun
            av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n");
81 37cdf93d Michael Niedermayer
            return -1;
82
    }
83 f23496b5 Baptiste Coudurier
    }
84 37cdf93d Michael Niedermayer
85
    if (enc->channels > 1) {
86 6cac3a3b Allan Hsu
        flags |= FLV_STEREO;
87 37cdf93d Michael Niedermayer
    }
88 115329f1 Diego Biurrun
89 37cdf93d Michael Niedermayer
    switch(enc->codec_id){
90
    case CODEC_ID_MP3:
91 6cac3a3b Allan Hsu
        flags |= FLV_CODECID_MP3    | FLV_SAMPLESSIZE_16BIT;
92 37cdf93d Michael Niedermayer
        break;
93 923bd441 Alex Beregszaszi
    case CODEC_ID_PCM_S8:
94 44de39f9 Michael Niedermayer
        flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_8BIT;
95 bb270c08 Diego Biurrun
        break;
96 923bd441 Alex Beregszaszi
    case CODEC_ID_PCM_S16BE:
97 44de39f9 Michael Niedermayer
        flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_16BIT;
98 bb270c08 Diego Biurrun
        break;
99 923bd441 Alex Beregszaszi
    case CODEC_ID_PCM_S16LE:
100 6cac3a3b Allan Hsu
        flags |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT;
101 bb270c08 Diego Biurrun
        break;
102 2fde8aae Alex Beregszaszi
    case CODEC_ID_ADPCM_SWF:
103 e9509536 Benjamin Larsson
        flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT;
104 bb270c08 Diego Biurrun
        break;
105 b7d1cd02 Bartlomiej Wolowiec
    case CODEC_ID_NELLYMOSER:
106 8ddd280d Alexander Wichers
        if (enc->sample_rate == 8000) {
107
            flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
108
        } else {
109
            flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;
110
        }
111 b7d1cd02 Bartlomiej Wolowiec
        break;
112 37cdf93d Michael Niedermayer
    case 0:
113
        flags |= enc->codec_tag<<4;
114
        break;
115
    default:
116 a254c574 Michael Niedermayer
        av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n");
117 37cdf93d Michael Niedermayer
        return -1;
118
    }
119 115329f1 Diego Biurrun
120 37cdf93d Michael Niedermayer
    return flags;
121
}
122
123 fd0fb306 Michael Niedermayer
static void put_amf_string(ByteIOContext *pb, const char *str)
124
{
125
    size_t len = strlen(str);
126
    put_be16(pb, len);
127
    put_buffer(pb, str, len);
128
}
129
130
static void put_amf_double(ByteIOContext *pb, double d)
131
{
132 6cac3a3b Allan Hsu
    put_byte(pb, AMF_DATA_TYPE_NUMBER);
133 fd0fb306 Michael Niedermayer
    put_be64(pb, av_dbl2int(d));
134
}
135
136 148c9bdb Allan Hsu
static void put_amf_bool(ByteIOContext *pb, int b) {
137
    put_byte(pb, AMF_DATA_TYPE_BOOL);
138
    put_byte(pb, !!b);
139
}
140
141 d4f5d74a Garrick Meeker
static int flv_write_header(AVFormatContext *s)
142
{
143 899681cd Björn Axelsson
    ByteIOContext *pb = s->pb;
144 d4f5d74a Garrick Meeker
    FLVContext *flv = s->priv_data;
145 5366f15d Baptiste Coudurier
    AVCodecContext *audio_enc = NULL, *video_enc = NULL;
146
    int i;
147 fd0fb306 Michael Niedermayer
    double framerate = 0.0;
148
    int metadata_size_pos, data_size;
149 d4f5d74a Garrick Meeker
150 11a8e425 Michael Niedermayer
    for(i=0; i<s->nb_streams; i++){
151 01f4895c Michael Niedermayer
        AVCodecContext *enc = s->streams[i]->codec;
152 fd0fb306 Michael Niedermayer
        if (enc->codec_type == CODEC_TYPE_VIDEO) {
153
            if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) {
154
                framerate = av_q2d(s->streams[i]->r_frame_rate);
155
            } else {
156
                framerate = 1/av_q2d(s->streams[i]->codec->time_base);
157
            }
158 5366f15d Baptiste Coudurier
            video_enc = enc;
159
            if(enc->codec_tag == 0) {
160 148c9bdb Allan Hsu
                av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n");
161
                return -1;
162
            }
163 fd0fb306 Michael Niedermayer
        } else {
164 5366f15d Baptiste Coudurier
            audio_enc = enc;
165 c45388b1 Michael Niedermayer
            if(get_audio_flags(enc)<0)
166
                return -1;
167 fd0fb306 Michael Niedermayer
        }
168 254629b1 Baptiste Coudurier
        av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
169 c45388b1 Michael Niedermayer
    }
170
    put_tag(pb,"FLV");
171
    put_byte(pb,1);
172 5366f15d Baptiste Coudurier
    put_byte(pb,   FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
173
                 + FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
174 c45388b1 Michael Niedermayer
    put_be32(pb,9);
175
    put_be32(pb,0);
176
177
    for(i=0; i<s->nb_streams; i++){
178
        if(s->streams[i]->codec->codec_tag == 5){
179 11a8e425 Michael Niedermayer
            put_byte(pb,8); // message type
180
            put_be24(pb,0); // include flags
181
            put_be24(pb,0); // time stamp
182
            put_be32(pb,0); // reserved
183
            put_be32(pb,11); // size
184
            flv->reserved=5;
185
        }
186
    }
187 d4f5d74a Garrick Meeker
188 fd0fb306 Michael Niedermayer
    /* write meta_tag */
189
    put_byte(pb, 18);         // tag type META
190
    metadata_size_pos= url_ftell(pb);
191
    put_be24(pb, 0);          // size of data part (sum of all parts below)
192
    put_be24(pb, 0);          // time stamp
193
    put_be32(pb, 0);          // reserved
194
195
    /* now data of data_size size */
196
197
    /* first event name as a string */
198 6cac3a3b Allan Hsu
    put_byte(pb, AMF_DATA_TYPE_STRING);
199 fd0fb306 Michael Niedermayer
    put_amf_string(pb, "onMetaData"); // 12 bytes
200
201
    /* mixed array (hash) with size and string/type/data tuples */
202 6cac3a3b Allan Hsu
    put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY);
203 5366f15d Baptiste Coudurier
    put_be32(pb, 5*!!video_enc + 4*!!audio_enc + 2); // +2 for duration and file size
204 fd0fb306 Michael Niedermayer
205 634b8cfa Baptiste Coudurier
    put_amf_string(pb, "duration");
206
    flv->duration_offset= url_ftell(pb);
207
    put_amf_double(pb, 0); // delayed write
208 fd0fb306 Michael Niedermayer
209 5366f15d Baptiste Coudurier
    if(video_enc){
210 fd0fb306 Michael Niedermayer
        put_amf_string(pb, "width");
211 5366f15d Baptiste Coudurier
        put_amf_double(pb, video_enc->width);
212 fd0fb306 Michael Niedermayer
213
        put_amf_string(pb, "height");
214 5366f15d Baptiste Coudurier
        put_amf_double(pb, video_enc->height);
215 fd0fb306 Michael Niedermayer
216
        put_amf_string(pb, "videodatarate");
217
        put_amf_double(pb, s->bit_rate / 1024.0);
218
219
        put_amf_string(pb, "framerate");
220
        put_amf_double(pb, framerate);
221 148c9bdb Allan Hsu
222
        put_amf_string(pb, "videocodecid");
223 5366f15d Baptiste Coudurier
        put_amf_double(pb, video_enc->codec_tag);
224 fd0fb306 Michael Niedermayer
    }
225
226 5366f15d Baptiste Coudurier
    if(audio_enc){
227 fd0fb306 Michael Niedermayer
        put_amf_string(pb, "audiosamplerate");
228 5366f15d Baptiste Coudurier
        put_amf_double(pb, audio_enc->sample_rate);
229 148c9bdb Allan Hsu
230
        put_amf_string(pb, "audiosamplesize");
231 5366f15d Baptiste Coudurier
        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_S8 ? 8 : 16);
232 148c9bdb Allan Hsu
233
        put_amf_string(pb, "stereo");
234 5366f15d Baptiste Coudurier
        put_amf_bool(pb, audio_enc->channels == 2);
235 148c9bdb Allan Hsu
236
        put_amf_string(pb, "audiocodecid");
237 5366f15d Baptiste Coudurier
        put_amf_double(pb, audio_enc->codec_tag);
238 fd0fb306 Michael Niedermayer
    }
239
240 634b8cfa Baptiste Coudurier
    put_amf_string(pb, "filesize");
241
    flv->filesize_offset= url_ftell(pb);
242
    put_amf_double(pb, 0); // delayed write
243 fd0fb306 Michael Niedermayer
244
    put_amf_string(pb, "");
245 6cac3a3b Allan Hsu
    put_byte(pb, AMF_END_OF_OBJECT);
246 fd0fb306 Michael Niedermayer
247
    /* write total size of tag */
248
    data_size= url_ftell(pb) - metadata_size_pos - 10;
249
    url_fseek(pb, metadata_size_pos, SEEK_SET);
250
    put_be24(pb, data_size);
251
    url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
252
    put_be32(pb, data_size + 11);
253
254 f23496b5 Baptiste Coudurier
    for (i = 0; i < s->nb_streams; i++) {
255
        AVCodecContext *enc = s->streams[i]->codec;
256
        if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
257 bc5c918e Diego Biurrun
            int64_t pos;
258 f23496b5 Baptiste Coudurier
            put_byte(pb, enc->codec_type == CODEC_TYPE_VIDEO ?
259
                     FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
260
            put_be24(pb, 0); // size patched later
261
            put_be24(pb, 0); // ts
262
            put_byte(pb, 0); // ts ext
263
            put_be24(pb, 0); // streamid
264
            pos = url_ftell(pb);
265
            if (enc->codec_id == CODEC_ID_AAC) {
266
                put_byte(pb, get_audio_flags(enc));
267
                put_byte(pb, 0); // AAC sequence header
268
                put_buffer(pb, enc->extradata, enc->extradata_size);
269
            } else {
270
                put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
271
                put_byte(pb, 0); // AVC sequence header
272
                put_be24(pb, 0); // composition time
273
                ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
274
            }
275
            data_size = url_ftell(pb) - pos;
276
            url_fseek(pb, -data_size - 10, SEEK_CUR);
277
            put_be24(pb, data_size);
278
            url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
279
            put_be32(pb, data_size + 11); // previous tag size
280
        }
281
    }
282
283 d4f5d74a Garrick Meeker
    return 0;
284
}
285
286
static int flv_write_trailer(AVFormatContext *s)
287
{
288 14b32253 Michael Niedermayer
    int64_t file_size;
289
290 899681cd Björn Axelsson
    ByteIOContext *pb = s->pb;
291 d4f5d74a Garrick Meeker
    FLVContext *flv = s->priv_data;
292
293 14b32253 Michael Niedermayer
    file_size = url_ftell(pb);
294 634b8cfa Baptiste Coudurier
295
    /* update informations */
296
    url_fseek(pb, flv->duration_offset, SEEK_SET);
297
    put_amf_double(pb, flv->duration / (double)1000);
298
    url_fseek(pb, flv->filesize_offset, SEEK_SET);
299
    put_amf_double(pb, file_size);
300
301 d4f5d74a Garrick Meeker
    url_fseek(pb, file_size, SEEK_SET);
302
    return 0;
303
}
304
305 e928649b Michael Niedermayer
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
306 d4f5d74a Garrick Meeker
{
307 899681cd Björn Axelsson
    ByteIOContext *pb = s->pb;
308 01f4895c Michael Niedermayer
    AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
309 d4f5d74a Garrick Meeker
    FLVContext *flv = s->priv_data;
310 f23496b5 Baptiste Coudurier
    unsigned ts;
311 e928649b Michael Niedermayer
    int size= pkt->size;
312 f683dbdc Michael Niedermayer
    int flags, flags_size;
313 d4f5d74a Garrick Meeker
314 949b1a13 Steve L'Homme
//    av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
315 115329f1 Diego Biurrun
316 f23496b5 Baptiste Coudurier
    if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F ||
317
       enc->codec_id == CODEC_ID_AAC)
318 f683dbdc Michael Niedermayer
        flags_size= 2;
319 f23496b5 Baptiste Coudurier
    else if(enc->codec_id == CODEC_ID_H264)
320
        flags_size= 5;
321 f683dbdc Michael Niedermayer
    else
322
        flags_size= 1;
323
324 d4f5d74a Garrick Meeker
    if (enc->codec_type == CODEC_TYPE_VIDEO) {
325 6cac3a3b Allan Hsu
        put_byte(pb, FLV_TAG_TYPE_VIDEO);
326 09d8c0ae Benjamin Larsson
327 bb85077f Michael Niedermayer
        flags = enc->codec_tag;
328 09d8c0ae Benjamin Larsson
        if(flags == 0) {
329
            av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
330
            return -1;
331
        }
332
333 6cac3a3b Allan Hsu
        flags |= pkt->flags & PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
334 75293f05 Michael Niedermayer
    } else {
335
        assert(enc->codec_type == CODEC_TYPE_AUDIO);
336 37cdf93d Michael Niedermayer
        flags = get_audio_flags(enc);
337 115329f1 Diego Biurrun
338 068f2a22 Michael Niedermayer
        assert(size);
339
340 6cac3a3b Allan Hsu
        put_byte(pb, FLV_TAG_TYPE_AUDIO);
341 75293f05 Michael Niedermayer
    }
342
343 7d637efa Baptiste Coudurier
    if (enc->codec_id == CODEC_ID_H264) {
344 c2acba13 Baptiste Coudurier
        /* check if extradata looks like mp4 formated */
345 7d637efa Baptiste Coudurier
        if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {
346 2ba0470e Baptiste Coudurier
            if (ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size) < 0)
347
                return -1;
348
            assert(pkt->size);
349
            size = pkt->size;
350 7d637efa Baptiste Coudurier
        }
351 6f4eb12d Baptiste Coudurier
        if (!flv->delay && pkt->dts < 0)
352
            flv->delay = -pkt->dts;
353 f23496b5 Baptiste Coudurier
    }
354
355
    ts = pkt->dts + flv->delay; // add delay to force positive dts
356 f683dbdc Michael Niedermayer
    put_be24(pb,size + flags_size);
357 f23496b5 Baptiste Coudurier
    put_be24(pb,ts);
358 b83a00b8 Baptiste Coudurier
    put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
359 018b6fb4 Alex Beregszaszi
    put_be24(pb,flv->reserved);
360 75293f05 Michael Niedermayer
    put_byte(pb,flags);
361 09d8c0ae Benjamin Larsson
    if (enc->codec_id == CODEC_ID_VP6)
362
        put_byte(pb,0);
363
    if (enc->codec_id == CODEC_ID_VP6F)
364
        put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
365 f23496b5 Baptiste Coudurier
    else if (enc->codec_id == CODEC_ID_AAC)
366
        put_byte(pb,1); // AAC raw
367
    else if (enc->codec_id == CODEC_ID_H264) {
368
        put_byte(pb,1); // AVC NALU
369 6f4eb12d Baptiste Coudurier
        put_be24(pb,pkt->pts - pkt->dts);
370 f23496b5 Baptiste Coudurier
    }
371 75293f05 Michael Niedermayer
    put_buffer(pb, pkt->data, size);
372 f683dbdc Michael Niedermayer
    put_be32(pb,size+flags_size+11); // previous tag size
373 f23496b5 Baptiste Coudurier
    flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
374 115329f1 Diego Biurrun
375 d4f5d74a Garrick Meeker
    put_flush_packet(pb);
376
    return 0;
377
}
378
379 ff70e601 Måns Rullgård
AVOutputFormat flv_muxer = {
380 d4f5d74a Garrick Meeker
    "flv",
381 bde15e74 Stefano Sabatini
    NULL_IF_CONFIG_SMALL("FLV format"),
382 e817a73d Michael Niedermayer
    "video/x-flv",
383 d4f5d74a Garrick Meeker
    "flv",
384
    sizeof(FLVContext),
385 6ebe07fb Diego Biurrun
#ifdef CONFIG_LIBMP3LAME
386 80783dc2 Fabrice Bellard
    CODEC_ID_MP3,
387 6ebe07fb Diego Biurrun
#else // CONFIG_LIBMP3LAME
388 964ff354 Alex Beregszaszi
    CODEC_ID_ADPCM_SWF,
389 6ebe07fb Diego Biurrun
#endif // CONFIG_LIBMP3LAME
390 d4f5d74a Garrick Meeker
    CODEC_ID_FLV1,
391
    flv_write_header,
392
    flv_write_packet,
393
    flv_write_trailer,
394 c1854592 Reimar Döffinger
    .codec_tag= (const AVCodecTag* const []){flv_video_codec_ids, flv_audio_codec_ids, 0},
395 f23496b5 Baptiste Coudurier
    .flags= AVFMT_GLOBALHEADER,
396 d4f5d74a Garrick Meeker
};