[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec x264.c,1.15,1.16

Måns Rullgård CVS mru
Fri Jan 20 22:20:48 CET 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv22522

Modified Files:
	x264.c 
Log Message:
place SPS/PPS in extradata if GLOBAL_HEADER flag is set


Index: x264.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/x264.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- x264.c	12 Jan 2006 22:43:17 -0000	1.15
+++ x264.c	20 Jan 2006 21:20:46 -0000	1.16
@@ -247,12 +247,30 @@
 
     x4->params.i_threads = avctx->thread_count;
 
+    if(avctx->flags & CODEC_FLAG_GLOBAL_HEADER){
+        x4->params.b_repeat_headers = 0;
+    }
+
     x4->enc = x264_encoder_open(&x4->params);
     if(!x4->enc)
         return -1;
 
     avctx->coded_frame = &x4->out_pic;
 
+    if(avctx->flags & CODEC_FLAG_GLOBAL_HEADER){
+	x264_nal_t *nal;
+	int nnal, i, s = 0;
+
+	x264_encoder_headers(x4->enc, &nal, &nnal);
+
+	/* 5 bytes NAL header + worst case escaping */
+	for(i = 0; i < nnal; i++)
+	    s += 5 + nal[i].i_payload * 4 / 3;
+
+        avctx->extradata = av_malloc(s);
+        avctx->extradata_size = encode_nals(avctx->extradata, s, nal, nnal);
+    }
+
     return 0;
 }
 





More information about the ffmpeg-cvslog mailing list