[5/8] rtspenc: Add a latm AVOption

Message ID 1305893640-56569-6-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö May 20, 2011, 12:13 p.m.
This option is read by and passed through to the chained RTP muxer
by rtpenc_chain.
---
 libavformat/rtsp.h    |    8 ++++++++
 libavformat/rtspenc.c |   14 ++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

Patch

diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index ff66502..223eef4 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -196,6 +196,8 @@  enum RTSPServerType {
  * @todo Use AVIOContext instead of URLContext
  */
 typedef struct RTSPState {
+    const AVClass *av_class;
+
     URLContext *rtsp_hd; /* RTSP TCP connection handle */
 
     /** number of items in the 'rtsp_streams' variable */
@@ -336,6 +338,12 @@  typedef struct RTSPState {
      * Whether the server supports the GET_PARAMETER method.
      */
     int get_parameter_supported;
+
+    /**
+     * Whether we want to use MP4A-LATM instead of MPEG4-GENERIC
+     * RTP packetization for AAC.
+     */
+    int mux_mp4a_latm;
 } RTSPState;
 
 /**
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index c1fc97c..46e234b 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -33,9 +33,22 @@ 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avstring.h"
 #include "url.h"
+#include "libavutil/opt.h"
 
 #define SDP_MAX_SIZE 16384
 
+static const AVOption options[] = {
+    { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", offsetof(RTSPState, mux_mp4a_latm), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
+    { NULL },
+};
+
+static const AVClass rtsp_muxer_class = {
+    .class_name = "RTSP muxer",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
 {
     RTSPState *rt = s->priv_data;
@@ -238,5 +251,6 @@  AVOutputFormat ff_rtsp_muxer = {
     rtsp_write_packet,
     rtsp_write_close,
     .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
+    .priv_class = &rtsp_muxer_class,
 };