[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec h264.c,1.141,1.142
Michael Niedermayer CVS
michael
Tue Jun 28 10:13:26 CEST 2005
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv9337
Modified Files:
h264.c
Log Message:
support extracting sps/pps from bitstream and putting it in extradata
Index: h264.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/h264.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- h264.c 28 Jun 2005 06:45:41 -0000 1.141
+++ h264.c 28 Jun 2005 08:13:23 -0000 1.142
@@ -7133,6 +7133,13 @@
}
pc->frame_start_found = 1;
}
+ if((state&0xFFFFFF1F) == 0x107 || (state&0xFFFFFF1F) == 0x108 || (state&0xFFFFFF1F) == 0x109){
+ if(pc->frame_start_found){
+ pc->state=-1;
+ pc->frame_start_found= 0;
+ return i-4;
+ }
+ }
if (i<buf_size)
state= (state<<8) | buf[i];
}
@@ -7163,6 +7170,31 @@
return next;
}
+static int h264_split(AVCodecContext *avctx,
+ const uint8_t *buf, int buf_size)
+{
+ int i;
+ uint32_t state = -1;
+ int has_sps= 0;
+
+ for(i=0; i<=buf_size; i++){
+ if((state&0xFFFFFF1F) == 0x107)
+ has_sps=1;
+/* if((state&0xFFFFFF1F) == 0x101 || (state&0xFFFFFF1F) == 0x102 || (state&0xFFFFFF1F) == 0x105){
+ }*/
+ if((state&0xFFFFFF00) == 0x100 && (state&0xFFFFFF1F) != 0x107 && (state&0xFFFFFF1F) != 0x108 && (state&0xFFFFFF1F) != 0x109){
+ if(has_sps){
+ while(i>4 && buf[i-5]==0) i--;
+ return i-4;
+ }
+ }
+ if (i<buf_size)
+ state= (state<<8) | buf[i];
+ }
+ return 0;
+}
+
+
static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){
MpegEncContext * const s = &h->s;
AVCodecContext * const avctx= s->avctx;
@@ -7709,6 +7741,7 @@
NULL,
h264_parse,
ff_parse_close,
+ h264_split,
};
#include "svq3.c"
More information about the ffmpeg-cvslog
mailing list