Browse code

lavf: deprecate AVFormatParameters.{channels,sample_rate}.

Anton Khirnov authored on 2011/05/24 03:13:28
Showing 5 changed files
... ...
@@ -60,11 +60,13 @@ static av_cold int audio_read_header(AVFormatContext *s1,
60 60
     enum CodecID codec_id;
61 61
     snd_pcm_sw_params_t *sw_params;
62 62
 
63
+#if FF_API_FORMAT_PARAMETERS
63 64
     if (ap->sample_rate > 0)
64 65
         s->sample_rate = ap->sample_rate;
65 66
 
66 67
     if (ap->channels > 0)
67 68
         s->channels = ap->channels;
69
+#endif
68 70
 
69 71
     st = av_new_stream(s1, 0);
70 72
     if (!st) {
... ...
@@ -218,10 +218,12 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
218 218
     AVStream *st;
219 219
     int ret;
220 220
 
221
+#if FF_API_FORMAT_PARAMETERS
221 222
     if (ap->sample_rate > 0)
222 223
         s->sample_rate = ap->sample_rate;
223 224
     if (ap->channels > 0)
224 225
         s->channels = ap->channels;
226
+#endif
225 227
 
226 228
     st = av_new_stream(s1, 0);
227 229
     if (!st) {
... ...
@@ -34,10 +34,12 @@ static av_cold int audio_read_header(AVFormatContext *s1,
34 34
     AVStream *st;
35 35
     int ret;
36 36
 
37
+#if FF_API_FORMAT_PARAMETERS
37 38
     if (ap->sample_rate > 0)
38 39
         s->sample_rate = ap->sample_rate;
39 40
     if (ap->channels > 0)
40 41
         s->channels = ap->channels;
42
+#endif
41 43
 
42 44
     st = av_new_stream(s1, 0);
43 45
     if (!st)
... ...
@@ -228,8 +228,10 @@ typedef struct AVProbeData {
228 228
 
229 229
 typedef struct AVFormatParameters {
230 230
     AVRational time_base;
231
-    int sample_rate;
232
-    int channels;
231
+#if FF_API_FORMAT_PARAMETERS
232
+    attribute_deprecated int sample_rate;
233
+    attribute_deprecated int channels;
234
+#endif
233 235
     int width;
234 236
     int height;
235 237
     enum PixelFormat pix_fmt;
... ...
@@ -47,11 +47,13 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
47 47
         case AVMEDIA_TYPE_AUDIO: {
48 48
             RawAudioDemuxerContext *s1 = s->priv_data;
49 49
 
50
+#if FF_API_FORMAT_PARAMETERS
50 51
             if (ap->sample_rate)
51 52
                 st->codec->sample_rate = ap->sample_rate;
52 53
             if (ap->channels)
53 54
                 st->codec->channels    = ap->channels;
54 55
             else st->codec->channels   = 1;
56
+#endif
55 57
 
56 58
             if (s1->sample_rate)
57 59
                 st->codec->sample_rate = s1->sample_rate;