aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2011-05-18 15:41:06 +0300
committerMartin Storsjö <martin@martin.st>2011-06-10 10:45:22 +0300
commit0558e266a267b5d90d3be1d8d86e60db2c303773 (patch)
treeff68db9dcaed4e5cf97c942fe408cf8b42c48c18 /libavformat
parentf33a6a22b4f2382a5113194335ae2a22ae957fed (diff)
downloadffmpeg-0558e266a267b5d90d3be1d8d86e60db2c303773.tar.gz
sdp: Allow passing an AVFormatContext to the SDP generation
Options from the AVFormatContext can be read for modifying the generated SDP. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/internal.h4
-rw-r--r--libavformat/movenc.c2
-rw-r--r--libavformat/sdp.c11
3 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ad3d9c91c2..7413b0906a 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -124,10 +124,12 @@ int ff_url_join(char *str, int size, const char *proto,
* @param dest_type the destination address type, may be NULL
* @param port the destination port of the media stream, 0 if unknown
* @param ttl the time to live of the stream, 0 if not multicast
+ * @param fmt the AVFormatContext, which might contain options modifying
+ * the generated SDP
*/
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
const char *dest_addr, const char *dest_type,
- int port, int ttl);
+ int port, int ttl, AVFormatContext *fmt);
/**
* Write a packet to another muxer than the one the user originally
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5f4eea49fc..b313510b25 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1359,7 +1359,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index)
char buf[1000] = "";
int len;
- ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, NULL, 0, 0);
+ ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, NULL, 0, 0, NULL);
av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
len = strlen(buf);
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index f72e2c567f..b996bf65f5 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -300,7 +300,7 @@ xiph_fail:
return NULL;
}
-static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type)
+static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt)
{
char *config = NULL;
@@ -449,7 +449,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)
+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;
@@ -472,7 +472,7 @@ 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);
+ sdp_write_media_attributes(buff, size, c, payload_type, fmt);
}
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
@@ -521,7 +521,8 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
for (j = 0; j < ac[i]->nb_streams; j++) {
ff_sdp_write_media(buf, size,
ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
- dst_type, (port > 0) ? port + j * 2 : 0, ttl);
+ dst_type, (port > 0) ? port + j * 2 : 0, ttl,
+ ac[i]);
if (port <= 0) {
av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j);
@@ -537,7 +538,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)
+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