Deprecate corresponding AVFormatParameters field.
Anton Khirnov authored on 2011/05/24 15:44:10... | ... |
@@ -241,9 +241,9 @@ typedef struct AVFormatParameters { |
241 | 241 |
attribute_deprecated unsigned int mpeg2ts_raw:1; /**< deprecated, use mpegtsraw demuxer */ |
242 | 242 |
/**< deprecated, use mpegtsraw demuxer-specific options instead */ |
243 | 243 |
attribute_deprecated unsigned int mpeg2ts_compute_pcr:1; |
244 |
+ attribute_deprecated unsigned int initial_pause:1; /**< Do not begin to play the stream |
|
245 |
+ immediately (RTSP only). */ |
|
244 | 246 |
#endif |
245 |
- unsigned int initial_pause:1; /**< Do not begin to play the stream |
|
246 |
- immediately (RTSP only). */ |
|
247 | 247 |
unsigned int prealloced_context:1; |
248 | 248 |
} AVFormatParameters; |
249 | 249 |
|
... | ... |
@@ -28,6 +28,8 @@ |
28 | 28 |
#include "network.h" |
29 | 29 |
#include "httpauth.h" |
30 | 30 |
|
31 |
+#include "libavutil/log.h" |
|
32 |
+ |
|
31 | 33 |
/** |
32 | 34 |
* Network layer over which RTP/etc packet data will be transported. |
33 | 35 |
*/ |
... | ... |
@@ -196,6 +198,7 @@ enum RTSPServerType { |
196 | 196 |
* @todo Use AVIOContext instead of URLContext |
197 | 197 |
*/ |
198 | 198 |
typedef struct RTSPState { |
199 |
+ const AVClass *class; /**< Class for private options. */ |
|
199 | 200 |
URLContext *rtsp_hd; /* RTSP TCP connection handle */ |
200 | 201 |
|
201 | 202 |
/** number of items in the 'rtsp_streams' variable */ |
... | ... |
@@ -336,6 +339,11 @@ typedef struct RTSPState { |
336 | 336 |
* Whether the server supports the GET_PARAMETER method. |
337 | 337 |
*/ |
338 | 338 |
int get_parameter_supported; |
339 |
+ |
|
340 |
+ /** |
|
341 |
+ * Do not begin to play the stream immediately. |
|
342 |
+ */ |
|
343 |
+ int initial_pause; |
|
339 | 344 |
} RTSPState; |
340 | 345 |
|
341 | 346 |
/** |
... | ... |
@@ -21,6 +21,7 @@ |
21 | 21 |
|
22 | 22 |
#include "libavutil/avstring.h" |
23 | 23 |
#include "libavutil/intreadwrite.h" |
24 |
+#include "libavutil/opt.h" |
|
24 | 25 |
#include "avformat.h" |
25 | 26 |
|
26 | 27 |
#include "internal.h" |
... | ... |
@@ -165,7 +166,12 @@ static int rtsp_read_header(AVFormatContext *s, |
165 | 165 |
return AVERROR(ENOMEM); |
166 | 166 |
rt->real_setup = rt->real_setup_cache + s->nb_streams; |
167 | 167 |
|
168 |
- if (ap->initial_pause) { |
|
168 |
+#if FF_API_FORMAT_PARAMETERS |
|
169 |
+ if (ap->initial_pause) |
|
170 |
+ rt->initial_pause = ap->initial_pause; |
|
171 |
+#endif |
|
172 |
+ |
|
173 |
+ if (rt->initial_pause) { |
|
169 | 174 |
/* do not start immediately */ |
170 | 175 |
} else { |
171 | 176 |
if (rtsp_read_play(s) < 0) { |
... | ... |
@@ -399,6 +405,18 @@ static int rtsp_read_close(AVFormatContext *s) |
399 | 399 |
return 0; |
400 | 400 |
} |
401 | 401 |
|
402 |
+static const AVOption options[] = { |
|
403 |
+ { "initial_pause", "Don't start playing the stream immediately", offsetof(RTSPState, initial_pause), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, |
|
404 |
+ { NULL }, |
|
405 |
+}; |
|
406 |
+ |
|
407 |
+const AVClass rtsp_demuxer_class = { |
|
408 |
+ .class_name = "RTSP demuxer", |
|
409 |
+ .item_name = av_default_item_name, |
|
410 |
+ .option = options, |
|
411 |
+ .version = LIBAVUTIL_VERSION_INT, |
|
412 |
+}; |
|
413 |
+ |
|
402 | 414 |
AVInputFormat ff_rtsp_demuxer = { |
403 | 415 |
"rtsp", |
404 | 416 |
NULL_IF_CONFIG_SMALL("RTSP input format"), |
... | ... |
@@ -411,4 +429,5 @@ AVInputFormat ff_rtsp_demuxer = { |
411 | 411 |
.flags = AVFMT_NOFILE, |
412 | 412 |
.read_play = rtsp_read_play, |
413 | 413 |
.read_pause = rtsp_read_pause, |
414 |
+ .priv_class = &rtsp_demuxer_class, |
|
414 | 415 |
}; |