[FFmpeg-cvslog] rtspdec: add initial_pause private option.

Anton Khirnov git at videolan.org
Fri May 27 23:57:13 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue May 24 08:44:10 2011 +0200| [4779f59378d54f30644ef79ce3a5c402546f3cb9] | committer: Anton Khirnov

rtspdec: add initial_pause private option.

Deprecate corresponding AVFormatParameters field.

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

 libavformat/avformat.h |    4 ++--
 libavformat/rtsp.h     |    8 ++++++++
 libavformat/rtspdec.c  |   21 ++++++++++++++++++++-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 847e408..2ea940c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -241,9 +241,9 @@ typedef struct AVFormatParameters {
     attribute_deprecated unsigned int mpeg2ts_raw:1;  /**< deprecated, use mpegtsraw demuxer */
     /**< deprecated, use mpegtsraw demuxer-specific options instead */
     attribute_deprecated unsigned int mpeg2ts_compute_pcr:1;
+    attribute_deprecated unsigned int initial_pause:1;       /**< Do not begin to play the stream
+                                                                  immediately (RTSP only). */
 #endif
-    unsigned int initial_pause:1;       /**< Do not begin to play the stream
-                                            immediately (RTSP only). */
     unsigned int prealloced_context:1;
 } AVFormatParameters;
 
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index ff66502..f5a7fad 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -28,6 +28,8 @@
 #include "network.h"
 #include "httpauth.h"
 
+#include "libavutil/log.h"
+
 /**
  * Network layer over which RTP/etc packet data will be transported.
  */
@@ -196,6 +198,7 @@ enum RTSPServerType {
  * @todo Use AVIOContext instead of URLContext
  */
 typedef struct RTSPState {
+    const AVClass *class;             /**< Class for private options. */
     URLContext *rtsp_hd; /* RTSP TCP connection handle */
 
     /** number of items in the 'rtsp_streams' variable */
@@ -336,6 +339,11 @@ typedef struct RTSPState {
      * Whether the server supports the GET_PARAMETER method.
      */
     int get_parameter_supported;
+
+    /**
+     * Do not begin to play the stream immediately.
+     */
+    int initial_pause;
 } RTSPState;
 
 /**
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index ccfc4d8..fa6bc05 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
 #include "avformat.h"
 
 #include "internal.h"
@@ -165,7 +166,12 @@ static int rtsp_read_header(AVFormatContext *s,
         return AVERROR(ENOMEM);
     rt->real_setup = rt->real_setup_cache + s->nb_streams;
 
-    if (ap->initial_pause) {
+#if FF_API_FORMAT_PARAMETERS
+    if (ap->initial_pause)
+        rt->initial_pause = ap->initial_pause;
+#endif
+
+    if (rt->initial_pause) {
          /* do not start immediately */
     } else {
          if (rtsp_read_play(s) < 0) {
@@ -399,6 +405,18 @@ static int rtsp_read_close(AVFormatContext *s)
     return 0;
 }
 
+static const AVOption options[] = {
+    { "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 },
+    { NULL },
+};
+
+const AVClass rtsp_demuxer_class = {
+    .class_name     = "RTSP demuxer",
+    .item_name      = av_default_item_name,
+    .option         = options,
+    .version        = LIBAVUTIL_VERSION_INT,
+};
+
 AVInputFormat ff_rtsp_demuxer = {
     "rtsp",
     NULL_IF_CONFIG_SMALL("RTSP input format"),
@@ -411,4 +429,5 @@ AVInputFormat ff_rtsp_demuxer = {
     .flags = AVFMT_NOFILE,
     .read_play = rtsp_read_play,
     .read_pause = rtsp_read_pause,
+    .priv_class = &rtsp_demuxer_class,
 };



More information about the ffmpeg-cvslog mailing list