Merge commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Nov 2014 12:41:07 +0000 (13:41 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Nov 2014 12:42:41 +0000 (13:42 +0100)
* commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c':
  lavf: stop using avpriv_flac_parse_streaminfo()

Conflicts:
libavcodec/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/Makefile
libavformat/flacdec.c
libavformat/oggparseflac.c

@@@ -678,9 -567,7 +678,8 @@@ OBJS-$(CONFIG_VC1_VDPAU_HWACCEL
  OBJS-$(CONFIG_ADTS_MUXER)              += mpeg4audio.o
  OBJS-$(CONFIG_CAF_DEMUXER)             += mpeg4audio.o mpegaudiodata.o  \
                                            ac3tab.o
- OBJS-$(CONFIG_FLAC_DEMUXER)            += flac.o flacdata.o vorbis_data.o \
-                                           xiph.o
 -OBJS-$(CONFIG_FLAC_MUXER)              += flac.o flacdata.o
++OBJS-$(CONFIG_FLAC_DEMUXER)            += flac.o flacdata.o vorbis_data.o
 +OBJS-$(CONFIG_FLAC_MUXER)              += flac.o flacdata.o vorbis_data.o
  OBJS-$(CONFIG_FLV_DEMUXER)             += mpeg4audio.o
  OBJS-$(CONFIG_GXF_DEMUXER)             += mpeg12data.o
  OBJS-$(CONFIG_IFF_DEMUXER)             += iff.o
@@@ -698,14 -585,11 +697,14 @@@ OBJS-$(CONFIG_MOV_DEMUXER)             
  OBJS-$(CONFIG_MOV_MUXER)               += mpeg4audio.o mpegaudiodata.o
  OBJS-$(CONFIG_MPEGTS_MUXER)            += mpeg4audio.o
  OBJS-$(CONFIG_MPEGTS_DEMUXER)          += mpeg4audio.o mpegaudiodata.o
 +OBJS-$(CONFIG_MXF_MUXER)               += dnxhddata.o
  OBJS-$(CONFIG_NUT_MUXER)               += mpegaudiodata.o
- OBJS-$(CONFIG_OGG_DEMUXER)             += xiph.o flac.o flacdata.o     \
 +OBJS-$(CONFIG_OGA_MUXER)               += xiph.o flac.o flacdata.o
+ OBJS-$(CONFIG_OGG_DEMUXER)             += xiph.o       \
                                            mpeg12data.o \
 -                                          dirac.o
 -OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flac.o flacdata.o
 +                                          dirac.o vorbis_data.o
 +OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flac.o flacdata.o \
 +                                          vorbis_data.o
  OBJS-$(CONFIG_RTP_MUXER)               += mpeg4audio.o xiph.o
  OBJS-$(CONFIG_RTPDEC)                  += mjpeg.o
  OBJS-$(CONFIG_SPDIF_DEMUXER)           += aacadtsdec.o mpeg4audio.o
@@@ -75,13 -75,17 +74,15 @@@ static int flac_read_header(AVFormatCon
          }
  
          if (metadata_type == FLAC_METADATA_TYPE_STREAMINFO) {
-             FLACStreaminfo si;
+             uint32_t samplerate;
+             uint64_t samples;
              /* STREAMINFO can only occur once */
              if (found_streaminfo) {
 -                av_freep(&buffer);
 -                return AVERROR_INVALIDDATA;
 +                RETURN_ERROR(AVERROR_INVALIDDATA);
              }
              if (metadata_size != FLAC_STREAMINFO_SIZE) {
 -                av_freep(&buffer);
 -                return AVERROR_INVALIDDATA;
 +                RETURN_ERROR(AVERROR_INVALIDDATA);
              }
              found_streaminfo = 1;
              st->codec->extradata      = buffer;
@@@ -62,11 -61,16 +61,15 @@@ flac_header (AVFormatContext * s, int i
          st->codec->codec_id = AV_CODEC_ID_FLAC;
          st->need_parsing = AVSTREAM_PARSE_HEADERS;
  
 -        st->codec->extradata =
 -            av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
 -        memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
 -        st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
 +        if (ff_alloc_extradata(st->codec, FLAC_STREAMINFO_SIZE) < 0)
 +            return AVERROR(ENOMEM);
 +        memcpy(st->codec->extradata, streaminfo_start, st->codec->extradata_size);
  
-         avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+         samplerate = AV_RB24(st->codec->extradata + 10) >> 4;
+         if (!samplerate)
+             return AVERROR_INVALIDDATA;
+         avpriv_set_pts_info(st, 64, 1, samplerate);
      } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
          ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, os->psize - 4);
      }