]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/sdp.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavformat / sdp.c
index 409948ebbbc59b34d9b9c19f89ffd5b99d3fe955..32cef499169fde9dedc0c6f16c3937c68a3d06d6 100644 (file)
@@ -21,7 +21,9 @@
 #include <string.h>
 #include "libavutil/avstring.h"
 #include "libavutil/base64.h"
+#include "libavutil/dict.h"
 #include "libavutil/parseutils.h"
+#include "libavutil/opt.h"
 #include "libavcodec/xiph.h"
 #include "libavcodec/mpeg4audio.h"
 #include "avformat.h"
@@ -300,7 +302,8 @@ xiph_fail:
     return NULL;
 }
 
-static int latm_context2profilelevel(AVCodecContext *c) {
+static int latm_context2profilelevel(AVCodecContext *c)
+{
     /* MP4A-LATM
      * The RTP payload format specification is described in RFC 3016
      * The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -328,7 +331,8 @@ static int latm_context2profilelevel(AVCodecContext *c) {
     return profile_level;
 }
 
-static char *latm_context2config(AVCodecContext *c) {
+static char *latm_context2config(AVCodecContext *c)
+{
     /* MP4A-LATM
      * The RTP payload format specification is described in RFC 3016
      * The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -363,7 +367,7 @@ static char *latm_context2config(AVCodecContext *c) {
     return config;
 }
 
-static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, int flags)
+static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt)
 {
     char *config = NULL;
 
@@ -398,7 +402,8 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
                                      payload_type, config ? config : "");
             break;
         case CODEC_ID_AAC:
-            if (flags & AVFMT_FLAG_MP4A_LATM) {
+            if (fmt && fmt->oformat->priv_class &&
+                av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
                 config = latm_context2config(c);
                 if (!config)
                     return NULL;
@@ -522,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
     return buff;
 }
 
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)
+void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
 {
     const char *type;
     int payload_type;
@@ -545,12 +550,12 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
         av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);
     }
 
-    sdp_write_media_attributes(buff, size, c, payload_type, flags);
+    sdp_write_media_attributes(buff, size, c, payload_type, fmt);
 }
 
 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
 {
-    AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0);
+    AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
     struct sdp_session_level s;
     int i, j, port, ttl, is_multicast;
     char dst[32], dst_type[5];
@@ -595,7 +600,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
             ff_sdp_write_media(buf, size,
                                   ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
                                   dst_type, (port > 0) ? port + j * 2 : 0, ttl,
-                                  ac[i]->flags);
+                                  ac[i]);
             if (port <= 0) {
                 av_strlcatf(buf, size,
                                    "a=control:streamid=%d\r\n", i + j);
@@ -611,7 +616,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
     return AVERROR(ENOSYS);
 }
 
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)
+void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
 {
 }
 #endif