diff mpeg12.c @ 1218:358bbc952e27 libavcodec

10l (returning negative number of consumed bytes if the first startcode of a frame was split between 2 buffers)
author michaelni
date Sun, 27 Apr 2003 01:11:26 +0000
parents 126f766bc4c5
children 78a51075aacb
line wrap: on
line diff
--- a/mpeg12.c	Fri Apr 25 20:03:17 2003 +0000
+++ b/mpeg12.c	Sun Apr 27 01:11:26 2003 +0000
@@ -2190,7 +2190,7 @@
         }
     }        
     pc->state= state;
-    return -1;
+    return END_NOT_FOUND;
 }
 
 /* handle buffering and image synchronisation */
@@ -2218,9 +2218,7 @@
     }
 
     if(s2->flags&CODEC_FLAG_TRUNCATED){
-        int next;
-        
-        next= mpeg1_find_frame_end(s2, buf, buf_size);
+        int next= mpeg1_find_frame_end(s2, buf, buf_size);
         
         if( ff_combine_frame(s2, next, &buf, &buf_size) < 0 )
             return buf_size;
@@ -2288,7 +2286,7 @@
                         if (ret == DECODE_SLICE_EOP) {
                             if(s2->last_picture_ptr) //FIXME merge with the stuff in mpeg_decode_slice
                                 *data_size = sizeof(AVPicture);
-                            return FFMAX(1, buf_ptr - buf - s2->parse_context.last_index);
+                            return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);
                         }else if(ret < 0){
                             if(ret == DECODE_SLICE_ERROR)
                                 ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);