changeset 6119:16ca32d9c5f0 libavformat

Use a bitstream filter for converting the extradata syntax when generating an SDP. This allows to generate correct SDPs for H.264 video in "MP4 syntax".
author lucabe
date Fri, 11 Jun 2010 08:01:45 +0000
parents 6780dc315f36
children a2a55244ca6b
files sdp.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sdp.c	Thu Jun 10 16:51:14 2010 +0000
+++ b/sdp.c	Fri Jun 11 08:01:45 2010 +0000
@@ -149,6 +149,19 @@
 
         return NULL;
     }
+    if (c->extradata[0] == 1) {
+        uint8_t *dummy_p;
+        int dummy_int;
+        AVBitStreamFilterContext *bsfc= av_bitstream_filter_init("h264_mp4toannexb");
+
+        if (!bsfc) {
+            av_log(c, AV_LOG_ERROR, "Cannot open the h264_mp4toannexb BSF!\n");
+
+            return NULL;
+        }
+        av_bitstream_filter_filter(bsfc, c, NULL, &dummy_p, &dummy_int, NULL, 0, 0);
+        av_bitstream_filter_close(bsfc);
+    }
 
     psets = av_mallocz(MAX_PSET_SIZE);
     if (psets == NULL) {