[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec parser.c,1.34,1.35
Michael Niedermayer CVS
michael
Thu Feb 2 19:38:50 CET 2006
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv28141
Modified Files:
parser.c
Log Message:
output last ac3 frame and simplify
Index: parser.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/parser.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- parser.c 24 Jan 2006 10:33:13 -0000 1.34
+++ parser.c 2 Feb 2006 18:38:47 -0000 1.35
@@ -873,9 +873,8 @@
len = s->inbuf_ptr - s->inbuf;
if (s->frame_size == 0) {
/* no header seen : find one. We need at least 7 bytes to parse it */
- len = AC3_HEADER_SIZE - len;
- if (len > buf_size)
- len = buf_size;
+ len = FFMIN(AC3_HEADER_SIZE - len, buf_size);
+
memcpy(s->inbuf_ptr, buf_ptr, len);
buf_ptr += len;
s->inbuf_ptr += len;
@@ -898,21 +897,21 @@
avctx->frame_size = 6 * 256;
}
}
- } else if (len < s->frame_size) {
- len = s->frame_size - len;
- if (len > buf_size)
- len = buf_size;
+ } else {
+ len = FFMIN(s->frame_size - len, buf_size);
memcpy(s->inbuf_ptr, buf_ptr, len);
buf_ptr += len;
s->inbuf_ptr += len;
buf_size -= len;
- } else {
- *poutbuf = s->inbuf;
- *poutbuf_size = s->frame_size;
- s->inbuf_ptr = s->inbuf;
- s->frame_size = 0;
- break;
+
+ if(s->inbuf_ptr - s->inbuf == s->frame_size){
+ *poutbuf = s->inbuf;
+ *poutbuf_size = s->frame_size;
+ s->inbuf_ptr = s->inbuf;
+ s->frame_size = 0;
+ break;
+ }
}
}
return buf_ptr - buf;
More information about the ffmpeg-cvslog
mailing list