[1/4] rtsp: Merge the AVOption lists

Message ID 1318442175-89118-1-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö Oct. 12, 2011, 5:56 p.m.
This eases adding options that are common for both. The
AV_OPT_FLAG_EN/DECODING_PARAM still indicates whether they belong
to the muxer or demuxer.
---
 libavformat/rtsp.c    |    7 +++++++
 libavformat/rtsp.h    |    3 +++
 libavformat/rtspdec.c |    8 +-------
 libavformat/rtspenc.c |    9 +--------
 4 files changed, 12 insertions(+), 15 deletions(-)

Comments

Anton Khirnov Oct. 12, 2011, 8:17 p.m. | #1
On Wed, 12 Oct 2011 20:56:12 +0300, Martin Storsjö <martin@martin.st> wrote:
> This eases adding options that are common for both. The
> AV_OPT_FLAG_EN/DECODING_PARAM still indicates whether they belong
> to the muxer or demuxer.
> ---
>  libavformat/rtsp.c    |    7 +++++++
>  libavformat/rtsp.h    |    3 +++
>  libavformat/rtspdec.c |    8 +-------
>  libavformat/rtspenc.c |    9 +--------
>  4 files changed, 12 insertions(+), 15 deletions(-)
> 

Looks ok except that it's AV_OPT_TYPE_* instead of FF_OPT_TYPE_* now.
Obviously that applies to the other patches too.
Martin Storsjö Oct. 12, 2011, 8:30 p.m. | #2
On Wed, 12 Oct 2011, Anton Khirnov wrote:

>
> On Wed, 12 Oct 2011 20:56:12 +0300, Martin Storsjö <martin@martin.st> wrote:
>> This eases adding options that are common for both. The
>> AV_OPT_FLAG_EN/DECODING_PARAM still indicates whether they belong
>> to the muxer or demuxer.
>> ---
>>  libavformat/rtsp.c    |    7 +++++++
>>  libavformat/rtsp.h    |    3 +++
>>  libavformat/rtspdec.c |    8 +-------
>>  libavformat/rtspenc.c |    9 +--------
>>  4 files changed, 12 insertions(+), 15 deletions(-)
>>
>
> Looks ok except that it's AV_OPT_TYPE_* instead of FF_OPT_TYPE_* now.
> Obviously that applies to the other patches too.

Ah, updated the patch series locally for that change.

// Martin

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 674a8b6..bd94c09 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -45,6 +45,7 @@ 
 #include "rtpdec_formats.h"
 #include "rtpenc_chain.h"
 #include "url.h"
+#include "rtpenc.h"
 
 //#define DEBUG
 
@@ -56,6 +57,12 @@ 
 #define SDP_MAX_SIZE 16384
 #define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH
 
+const AVOption ff_rtsp_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 },
+    FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
+    { NULL },
+};
+
 static void get_word_until_chars(char *buf, int buf_size,
                                  const char *sep, const char **pp)
 {
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 62ca483..5327b00 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -29,6 +29,7 @@ 
 #include "httpauth.h"
 
 #include "libavutil/log.h"
+#include "libavutil/opt.h"
 
 /**
  * Network layer over which RTP/etc packet data will be transported.
@@ -537,4 +538,6 @@  int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
  */
 void ff_rtsp_undo_setup(AVFormatContext *s);
 
+extern const AVOption ff_rtsp_options[];
+
 #endif /* AVFORMAT_RTSP_H */
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 88daa9d..c453b82 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -22,7 +22,6 @@ 
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
-#include "libavutil/opt.h"
 #include "avformat.h"
 
 #include "internal.h"
@@ -388,15 +387,10 @@  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,
+    .option         = ff_rtsp_options,
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index faf76c0..e4e79ca 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -33,20 +33,13 @@ 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avstring.h"
 #include "url.h"
-#include "libavutil/opt.h"
-#include "rtpenc.h"
 
 #define SDP_MAX_SIZE 16384
 
-static const AVOption options[] = {
-    FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
-    { NULL },
-};
-
 static const AVClass rtsp_muxer_class = {
     .class_name = "RTSP muxer",
     .item_name  = av_default_item_name,
-    .option     = options,
+    .option     = ff_rtsp_options,
     .version    = LIBAVUTIL_VERSION_INT,
 };