00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "avformat.h"
00022 #include "internal.h"
00023 #include "avi.h"
00024 #include "avio_internal.h"
00025 #include "riff.h"
00026 #include "libavutil/intreadwrite.h"
00027 #include "libavutil/dict.h"
00028 #include "libavutil/avassert.h"
00029
00030
00031
00032
00033
00034
00035 typedef struct AVIIentry {
00036 unsigned int flags, pos, len;
00037 } AVIIentry;
00038
00039 #define AVI_INDEX_CLUSTER_SIZE 16384
00040
00041 typedef struct AVIIndex {
00042 int64_t indx_start;
00043 int entry;
00044 int ents_allocated;
00045 AVIIentry** cluster;
00046 } AVIIndex;
00047
00048 typedef struct {
00049 int64_t riff_start, movi_list, odml_list;
00050 int64_t frames_hdr_all;
00051 int riff_id;
00052 } AVIContext;
00053
00054 typedef struct {
00055 int64_t frames_hdr_strm;
00056 int audio_strm_length;
00057 int packet_count;
00058 int entry;
00059
00060 AVIIndex indexes;
00061 } AVIStream ;
00062
00063 static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
00064 {
00065 int cl = ent_id / AVI_INDEX_CLUSTER_SIZE;
00066 int id = ent_id % AVI_INDEX_CLUSTER_SIZE;
00067 return &idx->cluster[cl][id];
00068 }
00069
00070 static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb,
00071 const char* riff_tag, const char* list_tag)
00072 {
00073 AVIContext *avi= s->priv_data;
00074 int64_t loff;
00075 int i;
00076
00077 avi->riff_id++;
00078 for (i=0; i<s->nb_streams; i++){
00079 AVIStream *avist= s->streams[i]->priv_data;
00080 avist->indexes.entry = 0;
00081 }
00082
00083 avi->riff_start = ff_start_tag(pb, "RIFF");
00084 ffio_wfourcc(pb, riff_tag);
00085 loff = ff_start_tag(pb, "LIST");
00086 ffio_wfourcc(pb, list_tag);
00087 return loff;
00088 }
00089
00090 static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
00091 {
00092 tag[0] = '0' + index/10;
00093 tag[1] = '0' + index%10;
00094 if (type == AVMEDIA_TYPE_VIDEO) {
00095 tag[2] = 'd';
00096 tag[3] = 'c';
00097 } else if (type == AVMEDIA_TYPE_SUBTITLE) {
00098
00099 tag[2] = 's';
00100 tag[3] = 'b';
00101 } else {
00102 tag[2] = 'w';
00103 tag[3] = 'b';
00104 }
00105 tag[4] = '\0';
00106 return tag;
00107 }
00108
00109 static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
00110 {
00111 int len = strlen(str);
00112 if (len > 0) {
00113 len++;
00114 ffio_wfourcc(pb, tag);
00115 avio_wl32(pb, len);
00116 avio_put_str(pb, str);
00117 if (len & 1)
00118 avio_w8(pb, 0);
00119 }
00120 }
00121
00122 static int avi_write_counters(AVFormatContext* s, int riff_id)
00123 {
00124 AVIOContext *pb = s->pb;
00125 AVIContext *avi = s->priv_data;
00126 int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
00127 int64_t file_size;
00128 AVCodecContext* stream;
00129
00130 file_size = avio_tell(pb);
00131 for(n = 0; n < s->nb_streams; n++) {
00132 AVIStream *avist= s->streams[n]->priv_data;
00133
00134 av_assert0(avist->frames_hdr_strm);
00135 stream = s->streams[n]->codec;
00136 avio_seek(pb, avist->frames_hdr_strm, SEEK_SET);
00137 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
00138 if(au_ssize == 0) {
00139 avio_wl32(pb, avist->packet_count);
00140 } else {
00141 avio_wl32(pb, avist->audio_strm_length / au_ssize);
00142 }
00143 if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
00144 nb_frames = FFMAX(nb_frames, avist->packet_count);
00145 }
00146 if(riff_id == 1) {
00147 av_assert0(avi->frames_hdr_all);
00148 avio_seek(pb, avi->frames_hdr_all, SEEK_SET);
00149 avio_wl32(pb, nb_frames);
00150 }
00151 avio_seek(pb, file_size, SEEK_SET);
00152
00153 return 0;
00154 }
00155
00156 static int avi_write_header(AVFormatContext *s)
00157 {
00158 AVIContext *avi = s->priv_data;
00159 AVIOContext *pb = s->pb;
00160 int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
00161 AVCodecContext *stream, *video_enc;
00162 int64_t list1, list2, strh, strf;
00163 AVDictionaryEntry *t = NULL;
00164
00165 if (s->nb_streams > AVI_MAX_STREAM_COUNT) {
00166 av_log(s, AV_LOG_ERROR, "AVI does not support >%d streams\n",
00167 AVI_MAX_STREAM_COUNT);
00168 return -1;
00169 }
00170
00171 for(n=0;n<s->nb_streams;n++) {
00172 s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
00173 if(!s->streams[n]->priv_data)
00174 return AVERROR(ENOMEM);
00175 }
00176
00177
00178 avi->riff_id = 0;
00179 list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl");
00180
00181
00182 ffio_wfourcc(pb, "avih");
00183 avio_wl32(pb, 14 * 4);
00184 bitrate = 0;
00185
00186 video_enc = NULL;
00187 for(n=0;n<s->nb_streams;n++) {
00188 stream = s->streams[n]->codec;
00189 bitrate += stream->bit_rate;
00190 if (stream->codec_type == AVMEDIA_TYPE_VIDEO)
00191 video_enc = stream;
00192 }
00193
00194 nb_frames = 0;
00195
00196 if(video_enc){
00197 avio_wl32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
00198 } else {
00199 avio_wl32(pb, 0);
00200 }
00201 avio_wl32(pb, bitrate / 8);
00202 avio_wl32(pb, 0);
00203 if (!pb->seekable)
00204 avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED);
00205 else
00206 avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED);
00207 avi->frames_hdr_all = avio_tell(pb);
00208 avio_wl32(pb, nb_frames);
00209 avio_wl32(pb, 0);
00210 avio_wl32(pb, s->nb_streams);
00211 avio_wl32(pb, 1024 * 1024);
00212 if(video_enc){
00213 avio_wl32(pb, video_enc->width);
00214 avio_wl32(pb, video_enc->height);
00215 } else {
00216 avio_wl32(pb, 0);
00217 avio_wl32(pb, 0);
00218 }
00219 avio_wl32(pb, 0);
00220 avio_wl32(pb, 0);
00221 avio_wl32(pb, 0);
00222 avio_wl32(pb, 0);
00223
00224
00225 for(i=0;i<n;i++) {
00226 AVIStream *avist= s->streams[i]->priv_data;
00227 list2 = ff_start_tag(pb, "LIST");
00228 ffio_wfourcc(pb, "strl");
00229
00230 stream = s->streams[i]->codec;
00231
00232
00233 strh = ff_start_tag(pb, "strh");
00234 switch(stream->codec_type) {
00235 case AVMEDIA_TYPE_SUBTITLE:
00236
00237
00238 if (stream->codec_id != AV_CODEC_ID_XSUB) {
00239 av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
00240 return AVERROR_PATCHWELCOME;
00241 }
00242 case AVMEDIA_TYPE_VIDEO: ffio_wfourcc(pb, "vids"); break;
00243 case AVMEDIA_TYPE_AUDIO: ffio_wfourcc(pb, "auds"); break;
00244
00245 case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break;
00246 }
00247 if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
00248 stream->codec_id == AV_CODEC_ID_XSUB)
00249 avio_wl32(pb, stream->codec_tag);
00250 else
00251 avio_wl32(pb, 1);
00252 avio_wl32(pb, 0);
00253 avio_wl16(pb, 0);
00254 avio_wl16(pb, 0);
00255 avio_wl32(pb, 0);
00256
00257 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
00258
00259 avpriv_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
00260 if(stream->codec_id == AV_CODEC_ID_XSUB)
00261 au_scale = au_byterate = 0;
00262
00263 avio_wl32(pb, au_scale);
00264 avio_wl32(pb, au_byterate);
00265
00266 avio_wl32(pb, 0);
00267 avist->frames_hdr_strm = avio_tell(pb);
00268 if (!pb->seekable)
00269 avio_wl32(pb, AVI_MAX_RIFF_SIZE);
00270 else
00271 avio_wl32(pb, 0);
00272
00273
00274 if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
00275 avio_wl32(pb, 1024 * 1024);
00276 else if(stream->codec_type == AVMEDIA_TYPE_AUDIO)
00277 avio_wl32(pb, 12 * 1024);
00278 else
00279 avio_wl32(pb, 0);
00280 avio_wl32(pb, -1);
00281 avio_wl32(pb, au_ssize);
00282 avio_wl32(pb, 0);
00283 avio_wl16(pb, stream->width);
00284 avio_wl16(pb, stream->height);
00285 ff_end_tag(pb, strh);
00286
00287 if(stream->codec_type != AVMEDIA_TYPE_DATA){
00288 strf = ff_start_tag(pb, "strf");
00289 switch(stream->codec_type) {
00290 case AVMEDIA_TYPE_SUBTITLE:
00291
00292
00293 if (stream->codec_id != AV_CODEC_ID_XSUB) break;
00294 case AVMEDIA_TYPE_VIDEO:
00295 ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0);
00296 break;
00297 case AVMEDIA_TYPE_AUDIO:
00298 if (ff_put_wav_header(pb, stream) < 0) {
00299 return -1;
00300 }
00301 break;
00302 default:
00303 return -1;
00304 }
00305 ff_end_tag(pb, strf);
00306 if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
00307 avi_write_info_tag(s->pb, "strn", t->value);
00308 t = NULL;
00309 }
00310 }
00311
00312 if (pb->seekable) {
00313 unsigned char tag[5];
00314 int j;
00315
00316
00317
00318
00319
00320
00321 avist->indexes.entry = avist->indexes.ents_allocated = 0;
00322 avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
00323 avio_wl16(pb, 4);
00324 avio_w8(pb, 0);
00325 avio_w8(pb, 0);
00326 avio_wl32(pb, 0);
00327 ffio_wfourcc(pb, avi_stream2fourcc(tag, i, stream->codec_type));
00328
00329 avio_wl64(pb, 0);
00330
00331 for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
00332 avio_wl64(pb, 0);
00333 ff_end_tag(pb, avist->indexes.indx_start);
00334 }
00335
00336 if( stream->codec_type == AVMEDIA_TYPE_VIDEO
00337 && s->streams[i]->sample_aspect_ratio.num>0
00338 && s->streams[i]->sample_aspect_ratio.den>0){
00339 int vprp= ff_start_tag(pb, "vprp");
00340 AVRational dar = av_mul_q(s->streams[i]->sample_aspect_ratio,
00341 (AVRational){stream->width, stream->height});
00342 int num, den;
00343 av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
00344
00345 avio_wl32(pb, 0);
00346 avio_wl32(pb, 0);
00347 avio_wl32(pb, lrintf(1.0/av_q2d(stream->time_base)));
00348 avio_wl32(pb, stream->width );
00349 avio_wl32(pb, stream->height);
00350 avio_wl16(pb, den);
00351 avio_wl16(pb, num);
00352 avio_wl32(pb, stream->width );
00353 avio_wl32(pb, stream->height);
00354 avio_wl32(pb, 1);
00355
00356 avio_wl32(pb, stream->height);
00357 avio_wl32(pb, stream->width );
00358 avio_wl32(pb, stream->height);
00359 avio_wl32(pb, stream->width );
00360 avio_wl32(pb, 0);
00361 avio_wl32(pb, 0);
00362
00363 avio_wl32(pb, 0);
00364 avio_wl32(pb, 0);
00365 ff_end_tag(pb, vprp);
00366 }
00367
00368 ff_end_tag(pb, list2);
00369 }
00370
00371 if (pb->seekable) {
00372
00373 avi->odml_list = ff_start_tag(pb, "JUNK");
00374 ffio_wfourcc(pb, "odml");
00375 ffio_wfourcc(pb, "dmlh");
00376 avio_wl32(pb, 248);
00377 for (i = 0; i < 248; i+= 4)
00378 avio_wl32(pb, 0);
00379 ff_end_tag(pb, avi->odml_list);
00380 }
00381
00382 ff_end_tag(pb, list1);
00383
00384 list2 = ff_start_tag(pb, "LIST");
00385 ffio_wfourcc(pb, "INFO");
00386 ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
00387 for (i = 0; *ff_riff_tags[i]; i++) {
00388 if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
00389 avi_write_info_tag(s->pb, t->key, t->value);
00390 }
00391 ff_end_tag(pb, list2);
00392
00393
00394 list2 = ff_start_tag(pb, "JUNK");
00395 for (i = 0; i < 1016; i += 4)
00396 avio_wl32(pb, 0);
00397 ff_end_tag(pb, list2);
00398
00399 avi->movi_list = ff_start_tag(pb, "LIST");
00400 ffio_wfourcc(pb, "movi");
00401
00402 avio_flush(pb);
00403
00404 return 0;
00405 }
00406
00407 static int avi_write_ix(AVFormatContext *s)
00408 {
00409 AVIOContext *pb = s->pb;
00410 AVIContext *avi = s->priv_data;
00411 char tag[5];
00412 char ix_tag[] = "ix00";
00413 int i, j;
00414
00415 av_assert0(pb->seekable);
00416
00417 if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
00418 return -1;
00419
00420 for (i=0;i<s->nb_streams;i++) {
00421 AVIStream *avist= s->streams[i]->priv_data;
00422 int64_t ix, pos;
00423
00424 avi_stream2fourcc(tag, i, s->streams[i]->codec->codec_type);
00425 ix_tag[3] = '0' + i;
00426
00427
00428 ix = avio_tell(pb);
00429 ffio_wfourcc(pb, ix_tag);
00430 avio_wl32(pb, avist->indexes.entry * 8 + 24);
00431
00432 avio_wl16(pb, 2);
00433 avio_w8(pb, 0);
00434 avio_w8(pb, 1);
00435 avio_wl32(pb, avist->indexes.entry);
00436
00437 ffio_wfourcc(pb, tag);
00438 avio_wl64(pb, avi->movi_list);
00439 avio_wl32(pb, 0);
00440
00441 for (j=0; j<avist->indexes.entry; j++) {
00442 AVIIentry* ie = avi_get_ientry(&avist->indexes, j);
00443 avio_wl32(pb, ie->pos + 8);
00444 avio_wl32(pb, ((uint32_t)ie->len & ~0x80000000) |
00445 (ie->flags & 0x10 ? 0 : 0x80000000));
00446 }
00447 avio_flush(pb);
00448 pos = avio_tell(pb);
00449
00450
00451 avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
00452 ffio_wfourcc(pb, "indx");
00453 avio_skip(pb, 8);
00454 avio_wl32(pb, avi->riff_id);
00455 avio_skip(pb, 16*avi->riff_id);
00456 avio_wl64(pb, ix);
00457 avio_wl32(pb, pos - ix);
00458 avio_wl32(pb, avist->indexes.entry);
00459
00460 avio_seek(pb, pos, SEEK_SET);
00461 }
00462 return 0;
00463 }
00464
00465 static int avi_write_idx1(AVFormatContext *s)
00466 {
00467 AVIOContext *pb = s->pb;
00468 AVIContext *avi = s->priv_data;
00469 int64_t idx_chunk;
00470 int i;
00471 char tag[5];
00472
00473 if (pb->seekable) {
00474 AVIStream *avist;
00475 AVIIentry* ie = 0, *tie;
00476 int empty, stream_id = -1;
00477
00478 idx_chunk = ff_start_tag(pb, "idx1");
00479 for(i=0; i<s->nb_streams; i++){
00480 avist= s->streams[i]->priv_data;
00481 avist->entry=0;
00482 }
00483
00484 do {
00485 empty = 1;
00486 for (i=0; i<s->nb_streams; i++) {
00487 avist= s->streams[i]->priv_data;
00488 if (avist->indexes.entry <= avist->entry)
00489 continue;
00490
00491 tie = avi_get_ientry(&avist->indexes, avist->entry);
00492 if (empty || tie->pos < ie->pos) {
00493 ie = tie;
00494 stream_id = i;
00495 }
00496 empty = 0;
00497 }
00498 if (!empty) {
00499 avist= s->streams[stream_id]->priv_data;
00500 avi_stream2fourcc(tag, stream_id,
00501 s->streams[stream_id]->codec->codec_type);
00502 ffio_wfourcc(pb, tag);
00503 avio_wl32(pb, ie->flags);
00504 avio_wl32(pb, ie->pos);
00505 avio_wl32(pb, ie->len);
00506 avist->entry++;
00507 }
00508 } while (!empty);
00509 ff_end_tag(pb, idx_chunk);
00510
00511 avi_write_counters(s, avi->riff_id);
00512 }
00513 return 0;
00514 }
00515
00516 static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
00517 {
00518 AVIContext *avi = s->priv_data;
00519 AVIOContext *pb = s->pb;
00520 unsigned char tag[5];
00521 unsigned int flags=0;
00522 const int stream_index= pkt->stream_index;
00523 AVIStream *avist= s->streams[stream_index]->priv_data;
00524 AVCodecContext *enc= s->streams[stream_index]->codec;
00525 int size= pkt->size;
00526
00527
00528 while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != AV_CODEC_ID_XSUB){
00529 AVPacket empty_packet;
00530
00531 if(pkt->dts - avist->packet_count > 60000){
00532 av_log(s, AV_LOG_ERROR, "Too large number of skiped frames %"PRId64"\n", pkt->dts - avist->packet_count);
00533 return AVERROR(EINVAL);
00534 }
00535
00536 av_init_packet(&empty_packet);
00537 empty_packet.size= 0;
00538 empty_packet.data= NULL;
00539 empty_packet.stream_index= stream_index;
00540 avi_write_packet(s, &empty_packet);
00541
00542 }
00543 avist->packet_count++;
00544
00545
00546 if (pb->seekable &&
00547 (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
00548
00549 avi_write_ix(s);
00550 ff_end_tag(pb, avi->movi_list);
00551
00552 if (avi->riff_id == 1)
00553 avi_write_idx1(s);
00554
00555 ff_end_tag(pb, avi->riff_start);
00556 avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi");
00557 }
00558
00559 avi_stream2fourcc(tag, stream_index, enc->codec_type);
00560 if(pkt->flags&AV_PKT_FLAG_KEY)
00561 flags = 0x10;
00562 if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
00563 avist->audio_strm_length += size;
00564 }
00565
00566 if (s->pb->seekable) {
00567 AVIIndex* idx = &avist->indexes;
00568 int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
00569 int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
00570 if (idx->ents_allocated <= idx->entry) {
00571 idx->cluster = av_realloc_f(idx->cluster, sizeof(void*), cl+1);
00572 if (!idx->cluster)
00573 return -1;
00574 idx->cluster[cl] = av_malloc(AVI_INDEX_CLUSTER_SIZE*sizeof(AVIIentry));
00575 if (!idx->cluster[cl])
00576 return -1;
00577 idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE;
00578 }
00579
00580 idx->cluster[cl][id].flags = flags;
00581 idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list;
00582 idx->cluster[cl][id].len = size;
00583 idx->entry++;
00584 }
00585
00586 avio_write(pb, tag, 4);
00587 avio_wl32(pb, size);
00588 avio_write(pb, pkt->data, size);
00589 if (size & 1)
00590 avio_w8(pb, 0);
00591
00592 avio_flush(pb);
00593 return 0;
00594 }
00595
00596 static int avi_write_trailer(AVFormatContext *s)
00597 {
00598 AVIContext *avi = s->priv_data;
00599 AVIOContext *pb = s->pb;
00600 int res = 0;
00601 int i, j, n, nb_frames;
00602 int64_t file_size;
00603
00604 if (pb->seekable){
00605 if (avi->riff_id == 1) {
00606 ff_end_tag(pb, avi->movi_list);
00607 res = avi_write_idx1(s);
00608 ff_end_tag(pb, avi->riff_start);
00609 } else {
00610 avi_write_ix(s);
00611 ff_end_tag(pb, avi->movi_list);
00612 ff_end_tag(pb, avi->riff_start);
00613
00614 file_size = avio_tell(pb);
00615 avio_seek(pb, avi->odml_list - 8, SEEK_SET);
00616 ffio_wfourcc(pb, "LIST");
00617 avio_skip(pb, 16);
00618
00619 for (n=nb_frames=0;n<s->nb_streams;n++) {
00620 AVCodecContext *stream = s->streams[n]->codec;
00621 AVIStream *avist= s->streams[n]->priv_data;
00622
00623 if (stream->codec_type == AVMEDIA_TYPE_VIDEO) {
00624 if (nb_frames < avist->packet_count)
00625 nb_frames = avist->packet_count;
00626 } else {
00627 if (stream->codec_id == AV_CODEC_ID_MP2 || stream->codec_id == AV_CODEC_ID_MP3) {
00628 nb_frames += avist->packet_count;
00629 }
00630 }
00631 }
00632 avio_wl32(pb, nb_frames);
00633 avio_seek(pb, file_size, SEEK_SET);
00634
00635 avi_write_counters(s, avi->riff_id);
00636 }
00637 }
00638
00639 for (i=0; i<s->nb_streams; i++) {
00640 AVIStream *avist= s->streams[i]->priv_data;
00641 for (j=0; j<avist->indexes.ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++)
00642 av_free(avist->indexes.cluster[j]);
00643 av_freep(&avist->indexes.cluster);
00644 avist->indexes.ents_allocated = avist->indexes.entry = 0;
00645 }
00646
00647 return res;
00648 }
00649
00650 AVOutputFormat ff_avi_muxer = {
00651 .name = "avi",
00652 .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
00653 .mime_type = "video/x-msvideo",
00654 .extensions = "avi",
00655 .priv_data_size = sizeof(AVIContext),
00656 .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,
00657 .video_codec = AV_CODEC_ID_MPEG4,
00658 .write_header = avi_write_header,
00659 .write_packet = avi_write_packet,
00660 .write_trailer = avi_write_trailer,
00661 .codec_tag = (const AVCodecTag* const []){
00662 ff_codec_bmp_tags, ff_codec_wav_tags, 0
00663 },
00664 .flags = AVFMT_VARIABLE_FPS,
00665 };