AVFormatParameters are converted into corresponding private options in
av_open_input_file/stream() compat wrappers, so accessing them from
demuxers is redundant.
... | ... |
@@ -60,14 +60,6 @@ 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 |
|
64 |
- if (ap->sample_rate > 0) |
|
65 |
- s->sample_rate = ap->sample_rate; |
|
66 |
- |
|
67 |
- if (ap->channels > 0) |
|
68 |
- s->channels = ap->channels; |
|
69 |
-#endif |
|
70 |
- |
|
71 | 63 |
st = av_new_stream(s1, 0); |
72 | 64 |
if (!st) { |
73 | 65 |
av_log(s1, AV_LOG_ERROR, "Cannot add stream\n"); |
... | ... |
@@ -251,17 +251,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
251 | 251 |
AVRational framerate; |
252 | 252 |
int ret = 0; |
253 | 253 |
|
254 |
-#if FF_API_FORMAT_PARAMETERS |
|
255 |
- if (ap->standard) { |
|
256 |
- if (!strcasecmp(ap->standard, "pal")) |
|
257 |
- s->standard = PAL; |
|
258 |
- else if (!strcasecmp(ap->standard, "secam")) |
|
259 |
- s->standard = SECAM; |
|
260 |
- else if (!strcasecmp(ap->standard, "ntsc")) |
|
261 |
- s->standard = NTSC; |
|
262 |
- } |
|
263 |
-#endif |
|
264 |
- |
|
265 | 254 |
if ((ret = av_parse_video_size(&width, &height, s->video_size)) < 0) { |
266 | 255 |
av_log(s1, AV_LOG_ERROR, "Could not parse video size '%s'.\n", s->video_size); |
267 | 256 |
goto out; |
... | ... |
@@ -281,14 +270,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
281 | 281 |
av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); |
282 | 282 |
goto out; |
283 | 283 |
} |
284 |
-#if FF_API_FORMAT_PARAMETERS |
|
285 |
- if (ap->width > 0) |
|
286 |
- width = ap->width; |
|
287 |
- if (ap->height > 0) |
|
288 |
- height = ap->height; |
|
289 |
- if (ap->time_base.num) |
|
290 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
291 |
-#endif |
|
292 | 284 |
|
293 | 285 |
st = av_new_stream(s1, 0); |
294 | 286 |
if (!st) { |
... | ... |
@@ -90,18 +90,6 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap |
90 | 90 |
if (!dv->dv_demux) |
91 | 91 |
goto failed; |
92 | 92 |
|
93 |
-#if FF_API_FORMAT_PARAMETERS |
|
94 |
- if (ap->standard) { |
|
95 |
- if (!strcasecmp(ap->standard, "pal")) |
|
96 |
- dv->format = DV1394_PAL; |
|
97 |
- else |
|
98 |
- dv->format = DV1394_NTSC; |
|
99 |
- } |
|
100 |
- |
|
101 |
- if (ap->channel) |
|
102 |
- dv->channel = ap->channel; |
|
103 |
-#endif |
|
104 |
- |
|
105 | 93 |
/* Open and initialize DV1394 device */ |
106 | 94 |
dv->fd = open(context->filename, O_RDONLY); |
107 | 95 |
if (dv->fd < 0) { |
... | ... |
@@ -107,10 +107,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, |
107 | 107 |
av_log(avctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", fbdev->framerate); |
108 | 108 |
return ret; |
109 | 109 |
} |
110 |
-#if FF_API_FORMAT_PARAMETERS |
|
111 |
- if (ap->time_base.num) |
|
112 |
- fbdev->framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
113 |
-#endif |
|
114 | 110 |
|
115 | 111 |
if (!(st = av_new_stream(avctx, 0))) |
116 | 112 |
return AVERROR(ENOMEM); |
... | ... |
@@ -142,16 +142,6 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, |
142 | 142 |
av_log(c, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", dc1394->framerate); |
143 | 143 |
goto out; |
144 | 144 |
} |
145 |
-#if FF_API_FORMAT_PARAMETERS |
|
146 |
- if (ap->width > 0) |
|
147 |
- width = ap->width; |
|
148 |
- if (ap->height > 0) |
|
149 |
- height = ap->height; |
|
150 |
- if (ap->pix_fmt) |
|
151 |
- pix_fmt = ap->pix_fmt; |
|
152 |
- if (ap->time_base.num) |
|
153 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
154 |
-#endif |
|
155 | 145 |
dc1394->frame_rate = av_rescale(1000, framerate.num, framerate.den); |
156 | 146 |
|
157 | 147 |
for (fmt = dc1394_frame_formats; fmt->width; fmt++) |
... | ... |
@@ -212,11 +202,6 @@ static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap) |
212 | 212 |
if (dc1394_read_common(c,ap,&fmt,&fps) != 0) |
213 | 213 |
return -1; |
214 | 214 |
|
215 |
-#if FF_API_FORMAT_PARAMETERS |
|
216 |
- if (ap->channel) |
|
217 |
- dc1394->channel = ap->channel; |
|
218 |
-#endif |
|
219 |
- |
|
220 | 215 |
/* Now let us prep the hardware. */ |
221 | 216 |
dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */ |
222 | 217 |
if (!dc1394->handle) { |
... | ... |
@@ -209,13 +209,6 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
209 | 209 |
AVStream *st; |
210 | 210 |
int ret; |
211 | 211 |
|
212 |
-#if FF_API_FORMAT_PARAMETERS |
|
213 |
- if (ap->sample_rate > 0) |
|
214 |
- s->sample_rate = ap->sample_rate; |
|
215 |
- if (ap->channels > 0) |
|
216 |
- s->channels = ap->channels; |
|
217 |
-#endif |
|
218 |
- |
|
219 | 212 |
st = av_new_stream(s1, 0); |
220 | 213 |
if (!st) { |
221 | 214 |
return AVERROR(ENOMEM); |
... | ... |
@@ -34,13 +34,6 @@ 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 |
|
38 |
- if (ap->sample_rate > 0) |
|
39 |
- s->sample_rate = ap->sample_rate; |
|
40 |
- if (ap->channels > 0) |
|
41 |
- s->channels = ap->channels; |
|
42 |
-#endif |
|
43 |
- |
|
44 | 37 |
st = av_new_stream(s1, 0); |
45 | 38 |
if (!st) |
46 | 39 |
return AVERROR(ENOMEM); |
... | ... |
@@ -142,16 +142,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
142 | 142 |
|
143 | 143 |
/* set tv standard */ |
144 | 144 |
if (!ioctl(video_fd, VIDIOCGTUNER, &tuner)) { |
145 |
-#if FF_API_FORMAT_PARAMETERS |
|
146 |
- if (ap->standard) { |
|
147 |
- if (!strcasecmp(ap->standard, "pal")) |
|
148 |
- s->standard = VIDEO_MODE_PAL; |
|
149 |
- else if (!strcasecmp(ap->standard, "secam")) |
|
150 |
- s->standard = VIDEO_MODE_SECAM; |
|
151 |
- else |
|
152 |
- s->standard = VIDEO_MODE_NTSC; |
|
153 |
- } |
|
154 |
-#endif |
|
155 | 145 |
tuner.mode = s->standard; |
156 | 146 |
ioctl(video_fd, VIDIOCSTUNER, &tuner); |
157 | 147 |
} |
... | ... |
@@ -463,12 +463,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) |
463 | 463 |
av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", s->framerate); |
464 | 464 |
return ret; |
465 | 465 |
} |
466 |
-#if FF_API_FORMAT_PARAMETERS |
|
467 |
- if (ap->channel > 0) |
|
468 |
- s->channel = ap->channel; |
|
469 |
- if (ap->time_base.num) |
|
470 |
- framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
471 |
-#endif |
|
472 | 466 |
|
473 | 467 |
/* set tv video input */ |
474 | 468 |
memset (&input, 0, sizeof (input)); |
... | ... |
@@ -486,13 +480,6 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) |
486 | 486 |
return AVERROR(EIO); |
487 | 487 |
} |
488 | 488 |
|
489 |
-#if FF_API_FORMAT_PARAMETERS |
|
490 |
- if (ap->standard) { |
|
491 |
- av_freep(&s->standard); |
|
492 |
- s->standard = av_strdup(ap->standard); |
|
493 |
- } |
|
494 |
-#endif |
|
495 |
- |
|
496 | 489 |
if (s->standard) { |
497 | 490 |
av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n", |
498 | 491 |
s->standard); |
... | ... |
@@ -609,14 +596,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
609 | 609 |
res = AVERROR(EINVAL); |
610 | 610 |
goto out; |
611 | 611 |
} |
612 |
-#if FF_API_FORMAT_PARAMETERS |
|
613 |
- if (ap->width > 0) |
|
614 |
- s->width = ap->width; |
|
615 |
- if (ap->height > 0) |
|
616 |
- s->height = ap->height; |
|
617 |
- if (ap->pix_fmt) |
|
618 |
- pix_fmt = ap->pix_fmt; |
|
619 |
-#endif |
|
620 | 612 |
|
621 | 613 |
capabilities = 0; |
622 | 614 |
s->fd = device_open(s1, &capabilities); |
... | ... |
@@ -267,11 +267,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
267 | 267 |
return AVERROR(EIO); |
268 | 268 |
} |
269 | 269 |
|
270 |
-#if FF_API_FORMAT_PARAMETERS |
|
271 |
- if (ap->time_base.num) |
|
272 |
- framerate_q = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
273 |
-#endif |
|
274 |
- |
|
275 | 270 |
ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0); |
276 | 271 |
if(!ctx->hwnd) { |
277 | 272 |
av_log(s, AV_LOG_ERROR, "Could not create capture window.\n"); |
... | ... |
@@ -329,12 +324,6 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
329 | 329 |
goto fail_bi; |
330 | 330 |
} |
331 | 331 |
} |
332 |
-#if FF_API_FORMAT_PARAMETERS |
|
333 |
- if (ap->width > 0) |
|
334 |
- bi->bmiHeader.biWidth = ap->width; |
|
335 |
- if (ap->height > 0) |
|
336 |
- bi->bmiHeader.biHeight = ap->height; |
|
337 |
-#endif |
|
338 | 332 |
|
339 | 333 |
if (0) { |
340 | 334 |
/* For testing yet unsupported compressions |
... | ... |
@@ -183,14 +183,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
183 | 183 |
av_log(s1, AV_LOG_ERROR, "Could not parse framerate: %s.\n", x11grab->framerate); |
184 | 184 |
goto out; |
185 | 185 |
} |
186 |
-#if FF_API_FORMAT_PARAMETERS |
|
187 |
- if (ap->width > 0) |
|
188 |
- x11grab->width = ap->width; |
|
189 |
- if (ap->height > 0) |
|
190 |
- x11grab->height = ap->height; |
|
191 |
- if (ap->time_base.num) |
|
192 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
193 |
-#endif |
|
194 | 186 |
av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n", |
195 | 187 |
s1->filename, param, x_off, y_off, x11grab->width, x11grab->height); |
196 | 188 |
|
... | ... |
@@ -233,16 +233,6 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) |
233 | 233 |
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); |
234 | 234 |
return ret; |
235 | 235 |
} |
236 |
-#if FF_API_FORMAT_PARAMETERS |
|
237 |
- if (ap->pix_fmt != PIX_FMT_NONE) |
|
238 |
- pix_fmt = ap->pix_fmt; |
|
239 |
- if (ap->width > 0) |
|
240 |
- width = ap->width; |
|
241 |
- if (ap->height > 0) |
|
242 |
- height = ap->height; |
|
243 |
- if (ap->time_base.num) |
|
244 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
245 |
-#endif |
|
246 | 236 |
|
247 | 237 |
#if FF_API_LOOP_INPUT |
248 | 238 |
if (s1->loop_input) |
... | ... |
@@ -1508,13 +1508,6 @@ static int mpegts_read_header(AVFormatContext *s, |
1508 | 1508 |
int len; |
1509 | 1509 |
int64_t pos; |
1510 | 1510 |
|
1511 |
-#if FF_API_FORMAT_PARAMETERS |
|
1512 |
- if (ap) { |
|
1513 |
- if (ap->mpeg2ts_compute_pcr) |
|
1514 |
- ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; |
|
1515 |
- } |
|
1516 |
-#endif |
|
1517 |
- |
|
1518 | 1511 |
/* read the first 1024 bytes to get packet size */ |
1519 | 1512 |
pos = avio_tell(pb); |
1520 | 1513 |
len = avio_read(pb, buf, sizeof(buf)); |
... | ... |
@@ -49,13 +49,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
49 | 49 |
case AVMEDIA_TYPE_AUDIO: { |
50 | 50 |
RawAudioDemuxerContext *s1 = s->priv_data; |
51 | 51 |
|
52 |
-#if FF_API_FORMAT_PARAMETERS |
|
53 |
- if (ap->sample_rate) |
|
54 |
- st->codec->sample_rate = ap->sample_rate; |
|
55 |
- if (ap->channels) |
|
56 |
- st->codec->channels = ap->channels; |
|
57 |
- else st->codec->channels = 1; |
|
58 |
-#endif |
|
52 |
+ st->codec->channels = 1; |
|
59 | 53 |
|
60 | 54 |
if (s1->sample_rate) |
61 | 55 |
st->codec->sample_rate = s1->sample_rate; |
... | ... |
@@ -87,16 +81,6 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
87 | 87 |
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate); |
88 | 88 |
goto fail; |
89 | 89 |
} |
90 |
-#if FF_API_FORMAT_PARAMETERS |
|
91 |
- if (ap->width > 0) |
|
92 |
- width = ap->width; |
|
93 |
- if (ap->height > 0) |
|
94 |
- height = ap->height; |
|
95 |
- if (ap->pix_fmt) |
|
96 |
- pix_fmt = ap->pix_fmt; |
|
97 |
- if (ap->time_base.num) |
|
98 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
99 |
-#endif |
|
100 | 90 |
av_set_pts_info(st, 64, framerate.den, framerate.num); |
101 | 91 |
st->codec->width = width; |
102 | 92 |
st->codec->height = height; |
... | ... |
@@ -170,10 +154,6 @@ int ff_raw_video_read_header(AVFormatContext *s, |
170 | 170 |
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate); |
171 | 171 |
goto fail; |
172 | 172 |
} |
173 |
-#if FF_API_FORMAT_PARAMETERS |
|
174 |
- if (ap->time_base.num) |
|
175 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
176 |
-#endif |
|
177 | 173 |
|
178 | 174 |
st->codec->time_base = (AVRational){framerate.den, framerate.num}; |
179 | 175 |
av_set_pts_info(st, 64, 1, 1200000); |
... | ... |
@@ -164,11 +164,6 @@ static int rtsp_read_header(AVFormatContext *s, |
164 | 164 |
return AVERROR(ENOMEM); |
165 | 165 |
rt->real_setup = rt->real_setup_cache + s->nb_streams; |
166 | 166 |
|
167 |
-#if FF_API_FORMAT_PARAMETERS |
|
168 |
- if (ap->initial_pause) |
|
169 |
- rt->initial_pause = ap->initial_pause; |
|
170 |
-#endif |
|
171 |
- |
|
172 | 167 |
if (rt->initial_pause) { |
173 | 168 |
/* do not start immediately */ |
174 | 169 |
} else { |
... | ... |
@@ -95,23 +95,11 @@ static int read_header(AVFormatContext *avctx, |
95 | 95 |
av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); |
96 | 96 |
goto fail; |
97 | 97 |
} |
98 |
-#if FF_API_FORMAT_PARAMETERS |
|
99 |
- if (ap->width > 0) |
|
100 |
- width = ap->width; |
|
101 |
- if (ap->height > 0) |
|
102 |
- height = ap->height; |
|
103 |
- if (ap->time_base.num) |
|
104 |
- framerate = (AVRational){ap->time_base.den, ap->time_base.num}; |
|
105 |
-#endif |
|
106 | 98 |
st->codec->width = width; |
107 | 99 |
st->codec->height = height; |
108 | 100 |
av_set_pts_info(st, 60, framerate.den, framerate.num); |
109 | 101 |
|
110 | 102 |
/* simulate tty display speed */ |
111 |
-#if FF_API_FORMAT_PARAMETERS |
|
112 |
- if (ap->sample_rate) |
|
113 |
- s->chars_per_frame = ap->sample_rate; |
|
114 |
-#endif |
|
115 | 103 |
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1); |
116 | 104 |
|
117 | 105 |
if (avctx->pb->seekable) { |