]> git.sesse.net Git - ffmpeg/commitdiff
cleanup picture / debug output code
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 10 Mar 2006 20:40:52 +0000 (20:40 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 10 Mar 2006 20:40:52 +0000 (20:40 +0000)
Originally committed as revision 5140 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h263dec.c
libavcodec/rv10.c
libavcodec/vc9.c

index 91caa48e554f25e5f00b9aa0d83d38a39bba3b9b..30303f8edf2f365382b8cd27fc54b64b5fdd8881 100644 (file)
@@ -766,22 +766,21 @@ retry:
 
 assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
 assert(s->current_picture.pict_type == s->pict_type);
-    if(s->pict_type==B_TYPE || s->low_delay){
-        *pict= *(AVFrame*)&s->current_picture;
+    if (s->pict_type == B_TYPE || s->low_delay) {
+        *pict= *(AVFrame*)s->current_picture_ptr;
+    } else if (s->last_picture_ptr != NULL) {
+        *pict= *(AVFrame*)s->last_picture_ptr;
+    }
+
+    if(s->last_picture_ptr || s->low_delay){
+        *data_size = sizeof(AVFrame);
         ff_print_debug_info(s, pict);
-    } else {
-        *pict= *(AVFrame*)&s->last_picture;
-        if(pict)
-            ff_print_debug_info(s, pict);
     }
 
     /* Return the Picture timestamp as the frame number */
     /* we substract 1 because it is added on utils.c    */
     avctx->frame_number = s->picture_number - 1;
 
-    /* don't output the last pic after seeking */
-    if(s->last_picture_ptr || s->low_delay)
-        *data_size = sizeof(AVFrame);
 #ifdef PRINT_FRAME_TIME
 av_log(avctx, AV_LOG_DEBUG, "%Ld\n", rdtsc()-time);
 #endif
index 0b90cc2c18de3d852c69820a11695ef6ef6524de..d48e0df2f08d2a9ab7e2bcfa8a8b5389ca82abc0 100644 (file)
@@ -741,15 +741,16 @@ static int rv10_decode_frame(AVCodecContext *avctx,
         ff_er_frame_end(s);
         MPV_frame_end(s);
 
-        if(s->pict_type==B_TYPE || s->low_delay){
-            *pict= *(AVFrame*)&s->current_picture;
-            ff_print_debug_info(s, pict);
-        } else {
-            *pict= *(AVFrame*)&s->last_picture;
-            ff_print_debug_info(s, pict);
+        if (s->pict_type == B_TYPE || s->low_delay) {
+            *pict= *(AVFrame*)s->current_picture_ptr;
+        } else if (s->last_picture_ptr != NULL) {
+            *pict= *(AVFrame*)s->last_picture_ptr;
         }
-        if(s->last_picture_ptr || s->low_delay)
+
+        if(s->last_picture_ptr || s->low_delay){
             *data_size = sizeof(AVFrame);
+            ff_print_debug_info(s, pict);
+        }
         s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
     }
 
index 465edda1030dd9269a0212d777422edea15ac0dc..926ef88eb19356e90fae03e6fa6a596d64658be3 100644 (file)
@@ -2606,23 +2606,22 @@ static int vc9_decode_frame(AVCodecContext *avctx,
 
     assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
     assert(s->current_picture.pict_type == s->pict_type);
-    if(s->pict_type==B_TYPE || s->low_delay){
-        *pict= *(AVFrame*)&s->current_picture;
+
+    if (s->pict_type == B_TYPE || s->low_delay) {
+        *pict= *(AVFrame*)s->current_picture_ptr;
+    } else if (s->last_picture_ptr != NULL) {
+        *pict= *(AVFrame*)s->last_picture_ptr;
+    }
+
+    if(s->last_picture_ptr || s->low_delay){
+        *data_size = sizeof(AVFrame);
         ff_print_debug_info(s, pict);
-    } else {
-        *pict= *(AVFrame*)&s->last_picture;
-        if(pict)
-            ff_print_debug_info(s, pict);
     }
 
     /* Return the Picture timestamp as the frame number */
     /* we substract 1 because it is added on utils.c    */
     avctx->frame_number = s->picture_number - 1;
 
-    /* dont output the last pic after seeking */
-    if(s->last_picture_ptr || s->low_delay)
-        *data_size = sizeof(AVFrame);
-
     av_log(avctx, AV_LOG_DEBUG, "Consumed %i/%i bits\n",
            get_bits_count(&s->gb), buf_size*8);