Merge commit 'ecab1c77410f023b437c6ed3a3281be8f039e574'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Oct 2013 07:07:59 +0000 (09:07 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Oct 2013 07:09:43 +0000 (09:09 +0200)
* commit 'ecab1c77410f023b437c6ed3a3281be8f039e574':
  oggdec: add support for Opus in Ogg demuxing

Conflicts:
Changelog
libavformat/oggparseopus.c
libavformat/version.h

See: e62fd6619f7aa91956a1b4ccfa7b0b8d7bc4ba90
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/oggparseopus.c

@@@ -48,16 -48,14 +48,17 @@@ static int opus_header(AVFormatContext 
          if (!priv)
              return AVERROR(ENOMEM);
      }
++
      if (os->flags & OGG_FLAG_BOS) {
          if (os->psize < OPUS_HEAD_SIZE || (AV_RL8(packet + 8) & 0xF0) != 0)
              return AVERROR_INVALIDDATA;
-         st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-         st->codec->codec_id    = AV_CODEC_ID_OPUS;
-         st->codec->channels    = AV_RL8 (packet + 9);
-         priv->pre_skip         = AV_RL16(packet + 10);
-         /*orig_sample_rate     = AV_RL32(packet + 12);*/
-         /*gain                 = AV_RL16(packet + 16);*/
-         /*channel_map          = AV_RL8 (packet + 18);*/
 -
+         st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+         st->codec->codec_id   = AV_CODEC_ID_OPUS;
 -        st->codec->channels   = AV_RL8(packet + 9);
++        st->codec->channels   = AV_RL8 (packet + 9);
+         priv->pre_skip        = AV_RL16(packet + 10);
++        /*orig_sample_rate    = AV_RL32(packet + 12);*/
++        /*gain                = AV_RL16(packet + 16);*/
++        /*channel_map         = AV_RL8 (packet + 18);*/
  
          extradata = av_malloc(os->psize + FF_INPUT_BUFFER_PADDING_SIZE);
          if (!extradata)
@@@ -118,19 -121,22 +124,20 @@@ static int opus_packet(AVFormatContext 
          skip = FFMIN(skip, os->pduration);
          if (skip > 0) {
              os->pduration = skip < os->pduration ? os->pduration - skip : 1;
 -            av_log(avf, AV_LOG_WARNING,
 -                   "Last packet is truncated to %d (because of unimplemented end trim support).\n",
 +            os->end_trimming = skip;
 +            av_log(avf, AV_LOG_DEBUG,
 +                   "Last packet was truncated to %d due to end trimming.\n",
                     os->pduration);
 -            return AVERROR_PATCHWELCOME;
          }
      }
      return 0;
  }
  
  const struct ogg_codec ff_opus_codec = {
-     .name      = "Opus",
-     .magic     = "OpusHead",
-     .magicsize = 8,
-     .header    = opus_header,
-     .packet    = opus_packet,
+     .name             = "Opus",
+     .magic            = "OpusHead",
+     .magicsize        = 8,
+     .header           = opus_header,
+     .packet           = opus_packet,
 -    .granule_is_start = 1,
 -    .nb_header        = 1,
  };