234
221
case AVMEDIA_TYPE_SUBTITLE:
235
222
// XSUB subtitles behave like video tracks, other subtitles
236
223
// are not (yet) supported.
237
if (stream->codec_id != CODEC_ID_XSUB) {
224
if (stream->codec_id != AV_CODEC_ID_XSUB) {
238
225
av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
239
226
return AVERROR_PATCHWELCOME;
244
231
case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break;
246
233
if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
247
stream->codec_id == CODEC_ID_XSUB)
234
stream->codec_id == AV_CODEC_ID_XSUB)
248
235
avio_wl32(pb, stream->codec_tag);
250
237
avio_wl32(pb, 1);
286
273
case AVMEDIA_TYPE_SUBTITLE:
287
274
// XSUB subtitles behave like video tracks, other subtitles
288
275
// are not (yet) supported.
289
if (stream->codec_id != CODEC_ID_XSUB) break;
276
if (stream->codec_id != AV_CODEC_ID_XSUB) break;
290
277
case AVMEDIA_TYPE_VIDEO:
291
278
ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0);
301
288
ff_end_tag(pb, strf);
302
289
if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
303
avi_write_info_tag(s->pb, "strn", t->value);
290
ff_riff_write_info_tag(s->pb, "strn", t->value);
378
365
ff_end_tag(pb, list1);
380
list2 = ff_start_tag(pb, "LIST");
381
ffio_wfourcc(pb, "INFO");
382
ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
383
for (i = 0; *ff_riff_tags[i]; i++) {
384
if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
385
avi_write_info_tag(s->pb, t->key, t->value);
387
ff_end_tag(pb, list2);
367
ff_riff_write_info(s);
389
369
/* some padding for easier tag editing */
390
370
list2 = ff_start_tag(pb, "JUNK");
520
500
AVCodecContext *enc= s->streams[stream_index]->codec;
521
501
int size= pkt->size;
523
// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
524
503
while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){
525
504
AVPacket empty_packet;
529
508
empty_packet.data= NULL;
530
509
empty_packet.stream_index= stream_index;
531
510
avi_write_packet(s, &empty_packet);
532
// av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]);
534
512
avist->packet_count++;
615
593
if (nb_frames < avist->packet_count)
616
594
nb_frames = avist->packet_count;
618
if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
596
if (stream->codec_id == AV_CODEC_ID_MP2 || stream->codec_id == AV_CODEC_ID_MP3) {
619
597
nb_frames += avist->packet_count;
642
619
AVOutputFormat ff_avi_muxer = {
644
.long_name = NULL_IF_CONFIG_SMALL("AVI format"),
621
.long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
645
622
.mime_type = "video/x-msvideo",
646
623
.extensions = "avi",
647
624
.priv_data_size = sizeof(AVIContext),
648
#if CONFIG_LIBMP3LAME_ENCODER
649
.audio_codec = CODEC_ID_MP3,
651
.audio_codec = CODEC_ID_AC3,
653
.video_codec = CODEC_ID_MPEG4,
625
.audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,
626
.video_codec = AV_CODEC_ID_MPEG4,
654
627
.write_header = avi_write_header,
655
628
.write_packet = avi_write_packet,
656
629
.write_trailer = avi_write_trailer,
657
.codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
658
.flags= AVFMT_VARIABLE_FPS,
630
.codec_tag = (const AVCodecTag* const []){
631
ff_codec_bmp_tags, ff_codec_wav_tags, 0
633
.flags = AVFMT_VARIABLE_FPS,