[FFmpeg-cvslog] lavf: deprecate AVFormatParameters.{channels, sample_rate}.

Anton Khirnov git at videolan.org
Thu May 26 03:32:21 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon May 23 20:13:28 2011 +0200| [bffd4dd1d36b1e9b9479c81b370c134ffb434e1a] | committer: Anton Khirnov

lavf: deprecate AVFormatParameters.{channels,sample_rate}.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bffd4dd1d36b1e9b9479c81b370c134ffb434e1a
---

 libavdevice/alsa-audio-dec.c |    2 ++
 libavdevice/oss_audio.c      |    2 ++
 libavdevice/sndio_dec.c      |    2 ++
 libavformat/avformat.h       |    6 ++++--
 libavformat/rawdec.c         |    2 ++
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 285d338..937f6a6 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -60,11 +60,13 @@ static av_cold int audio_read_header(AVFormatContext *s1,
     enum CodecID codec_id;
     snd_pcm_sw_params_t *sw_params;
 
+#if FF_API_FORMAT_PARAMETERS
     if (ap->sample_rate > 0)
         s->sample_rate = ap->sample_rate;
 
     if (ap->channels > 0)
         s->channels = ap->channels;
+#endif
 
     st = av_new_stream(s1, 0);
     if (!st) {
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index bcd6540..af46ea8 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -218,10 +218,12 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     AVStream *st;
     int ret;
 
+#if FF_API_FORMAT_PARAMETERS
     if (ap->sample_rate > 0)
         s->sample_rate = ap->sample_rate;
     if (ap->channels > 0)
         s->channels = ap->channels;
+#endif
 
     st = av_new_stream(s1, 0);
     if (!st) {
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index abe13e1..2690ee3 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -34,10 +34,12 @@ static av_cold int audio_read_header(AVFormatContext *s1,
     AVStream *st;
     int ret;
 
+#if FF_API_FORMAT_PARAMETERS
     if (ap->sample_rate > 0)
         s->sample_rate = ap->sample_rate;
     if (ap->channels > 0)
         s->channels = ap->channels;
+#endif
 
     st = av_new_stream(s1, 0);
     if (!st)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 35e6c15..64bbd22 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -228,8 +228,10 @@ typedef struct AVProbeData {
 
 typedef struct AVFormatParameters {
     AVRational time_base;
-    int sample_rate;
-    int channels;
+#if FF_API_FORMAT_PARAMETERS
+    attribute_deprecated int sample_rate;
+    attribute_deprecated int channels;
+#endif
     int width;
     int height;
     enum PixelFormat pix_fmt;
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 81a6459..b545dbd 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -47,11 +47,13 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
         case AVMEDIA_TYPE_AUDIO: {
             RawAudioDemuxerContext *s1 = s->priv_data;
 
+#if FF_API_FORMAT_PARAMETERS
             if (ap->sample_rate)
                 st->codec->sample_rate = ap->sample_rate;
             if (ap->channels)
                 st->codec->channels    = ap->channels;
             else st->codec->channels   = 1;
+#endif
 
             if (s1->sample_rate)
                 st->codec->sample_rate = s1->sample_rate;



More information about the ffmpeg-cvslog mailing list