From 06b5246c845b4342ad1c5eaad6b2f18004d9223c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 28 Aug 2012 14:57:26 +0300 Subject: sdp: Include profile-level-id for H264 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required for playback with the Stagefright RTSP framework on Android. Signed-off-by: Martin Storsjö --- libavformat/sdp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libavformat/sdp.c') diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 2304a68..7413386 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -155,8 +155,10 @@ static char *extradata2psets(AVCodecContext *c) char *psets, *p; const uint8_t *r; const char *pset_string = "; sprop-parameter-sets="; + const char *profile_string = "; profile-level-id="; uint8_t *orig_extradata = NULL; int orig_extradata_size = 0; + const uint8_t *sps = NULL, *sps_end; if (c->extradata_size > MAX_EXTRADATA_SIZE) { av_log(c, AV_LOG_ERROR, "Too much extradata!\n"); @@ -210,6 +212,10 @@ static char *extradata2psets(AVCodecContext *c) *p = ','; p++; } + if (!sps) { + sps = r; + sps_end = r1; + } if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) { av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r); av_free(psets); @@ -219,6 +225,12 @@ static char *extradata2psets(AVCodecContext *c) p += strlen(p); r = r1; } + if (sps && sps_end - sps >= 4) { + memcpy(p, profile_string, strlen(profile_string)); + p += strlen(p); + ff_data_to_hex(p, sps + 1, 3, 0); + p[6] = '\0'; + } if (orig_extradata) { av_free(c->extradata); c->extradata = orig_extradata; -- cgit v1.1 From d4bba93f4d9942ffede16c0f9d810eef7f81fe97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 28 Aug 2012 19:24:14 +0300 Subject: sdp: Use static const char arrays instead of pointers to strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/sdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavformat/sdp.c') diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 7413386..9bb4815 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -154,8 +154,8 @@ static char *extradata2psets(AVCodecContext *c) { char *psets, *p; const uint8_t *r; - const char *pset_string = "; sprop-parameter-sets="; - const char *profile_string = "; profile-level-id="; + static const char pset_string[] = "; sprop-parameter-sets="; + static const char profile_string[] = "; profile-level-id="; uint8_t *orig_extradata = NULL; int orig_extradata_size = 0; const uint8_t *sps = NULL, *sps_end; -- cgit v1.1