Merge commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Oct 2014 01:00:17 +0000 (03:00 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Oct 2014 01:00:17 +0000 (03:00 +0200)
* commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0':
  lavf: use initial_padding instead of deprecated delay

Conflicts:
libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/matroskaenc.c
libavformat/oggenc.c

@@@ -836,51 -739,28 +836,52 @@@ static int mkv_write_track(AVFormatCont
  
      // The default value for TRACKFLAGDEFAULT is 1, so add element
      // if we need to clear it.
 -    if (!(st->disposition & AV_DISPOSITION_DEFAULT))
 +    if (default_stream_exists && !(st->disposition & AV_DISPOSITION_DEFAULT))
          put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT));
  
 -    if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->initial_padding) {
 -        mkv->tracks[i].ts_offset = av_rescale_q(codec->initial_padding,
 -                                                (AVRational){ 1, codec->sample_rate },
 -                                                st->time_base);
 +    if (st->disposition & AV_DISPOSITION_FORCED)
 +        put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGFORCED, 1);
 +
 +    if (mkv->mode == MODE_WEBM && codec->codec_id == AV_CODEC_ID_WEBVTT) {
 +        const char *codec_id;
 +        if (st->disposition & AV_DISPOSITION_CAPTIONS) {
 +            codec_id = "D_WEBVTT/CAPTIONS";
 +            native_id = MATROSKA_TRACK_TYPE_SUBTITLE;
 +        } else if (st->disposition & AV_DISPOSITION_DESCRIPTIONS) {
 +            codec_id = "D_WEBVTT/DESCRIPTIONS";
 +            native_id = MATROSKA_TRACK_TYPE_METADATA;
 +        } else if (st->disposition & AV_DISPOSITION_METADATA) {
 +            codec_id = "D_WEBVTT/METADATA";
 +            native_id = MATROSKA_TRACK_TYPE_METADATA;
 +        } else {
 +            codec_id = "D_WEBVTT/SUBTITLES";
 +            native_id = MATROSKA_TRACK_TYPE_SUBTITLE;
 +        }
 +        put_ebml_string(pb, MATROSKA_ID_CODECID, codec_id);
 +    } else {
 +        // look for a codec ID string specific to mkv to use,
 +        // if none are found, use AVI codes
 +        for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
 +            if (ff_mkv_codec_tags[j].id == codec->codec_id) {
 +                put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
 +                native_id = 1;
 +                break;
 +            }
 +        }
 +    }
 +
-     if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->delay && codec->codec_id == AV_CODEC_ID_OPUS) {
- //         mkv->tracks[i].ts_offset = av_rescale_q(codec->delay,
++    if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->initial_padding && codec->codec_id == AV_CODEC_ID_OPUS) {
++//         mkv->tracks[i].ts_offset = av_rescale_q(codec->initial_padding,
 +//                                                 (AVRational){ 1, codec->sample_rate },
 +//                                                 st->time_base);
  
          put_ebml_uint(pb, MATROSKA_ID_CODECDELAY,
-                       av_rescale_q(codec->delay, (AVRational){ 1, codec->sample_rate },
+                       av_rescale_q(codec->initial_padding,
+                                    (AVRational){ 1, codec->sample_rate },
                                     (AVRational){ 1, 1000000000 }));
      }
 -
 -    // look for a codec ID string specific to mkv to use,
 -    // if none are found, use AVI codes
 -    for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
 -        if (ff_mkv_codec_tags[j].id == codec->codec_id) {
 -            put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
 -            native_id = 1;
 -            break;
 -        }
 +    if (codec->codec_id == AV_CODEC_ID_OPUS) {
 +        put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
      }
  
      if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
Simple merge