[05/10] rtpenc: Declare the rtp flags private AVOptions in rtpenc.h

Message ID 1306759304-52856-6-git-send-email-martin@martin.st
State Committed
Commit 635fac9af10092b0d5780a7d1b422b3044f9abd9
Headers show

Commit Message

Martin Storsjö May 30, 2011, 12:41 p.m.
This allows other muxers that chain a RTP muxer to declare
the same options easily.
---
 libavformat/rtpenc.c |    3 +--
 libavformat/rtpenc.h |    4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

Patch

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index c264b30..3da6dfb 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -30,8 +30,7 @@ 
 //#define DEBUG
 
 static const AVOption options[] = {
-    { "rtpflags", "RTP muxer flags", offsetof(RTPMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" },
-    { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" },
+    FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
     { NULL },
 };
 
diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h
index ac5a622..3a9e19b 100644
--- a/libavformat/rtpenc.h
+++ b/libavformat/rtpenc.h
@@ -65,6 +65,10 @@  typedef struct RTPMuxContext RTPMuxContext;
 
 #define FF_RTP_FLAG_MP4A_LATM 1
 
+#define FF_RTP_FLAG_OPTS(ctx, fieldname) \
+    { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
+    { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \
+
 void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
 
 void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);