changeset 967:5f07e67982d6

-framedrop worx fro mpeg files
author arpi_esp
date Sun, 03 Jun 2001 18:22:59 +0000
parents 69b4f944ce08
children 064a6422fd42
files libmpeg2/decode.c libmpeg2/mpeg2.h mplayer.c
diffstat 3 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpeg2/decode.c	Sun Jun 03 10:48:36 2001 +0000
+++ b/libmpeg2/decode.c	Sun Jun 03 18:22:59 2001 +0000
@@ -52,7 +52,7 @@
 //static uint8_t chunk_buffer[224 * 1024 + 4];
 //static uint32_t shift = 0;
 
-static int drop_flag = 0;
+//static int drop_flag = 0;
 static int drop_frame = 0;
 
 #ifdef MPEG12_POSTPROC
@@ -151,7 +151,7 @@
 
 static int in_slice_flag=0;
 
-static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer)
+static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer, int framedrop)
 {
     int is_frame_done = 0;
 
@@ -163,6 +163,7 @@
         
 //        if(picture->picture_structure != FRAME_PICTURE) printf("Field! %d  \n",picture->second_field);
         
+	if(!framedrop)
 	if (((picture->picture_structure == FRAME_PICTURE) ||
 		 (picture->second_field))
            ) {
@@ -208,7 +209,8 @@
 	    //exit (1);
 	}
 
-	drop_frame = drop_flag && (picture->picture_coding_type == B_TYPE);
+	drop_frame = framedrop && (picture->picture_coding_type == B_TYPE);
+	drop_frame |= framedrop>=2; // hard drop
 	//decode_reorder_frames ();
 	break;
 
@@ -259,7 +261,7 @@
 #endif
 		    picture->current_frame->copy=copy_slice;
 #endif
-	    
+	    if(framedrop) picture->current_frame->copy=NULL;
 	    picture->current_frame->vo=output;
 	    picture->slice=0;
 
@@ -285,7 +287,7 @@
     longjmp(mpeg2_jmp_buf,1);
 }
 
-int mpeg2_decode_data (vo_functions_t *output, uint8_t *current, uint8_t *end)
+int mpeg2_decode_data (vo_functions_t *output, uint8_t *current, uint8_t *end,int framedrop)
 {
     //static uint8_t code = 0xff;
     //static uint8_t chunk_buffer[65536];
@@ -323,7 +325,7 @@
     //if((code&0x100)!=0x100) printf("libmpeg2: FATAL! code=%X\n",code);
     //printf("pos=%d  chunk %3X  size=%d  next-code=%X\n",pos-start,code,current-pos,head|c);
     if(setjmp(mpeg2_jmp_buf)==0){
-      ret+=parse_chunk(output, code&0xFF, pos);
+      ret+=parse_chunk(output, code&0xFF, pos, framedrop);
     } else {
 #ifdef ARCH_X86
 	    if (config.flags & MM_ACCEL_X86_MMX) emms ();
@@ -337,13 +339,13 @@
 
   signal(SIGSEGV,old_sigh); // restore sighandler
 
-  if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL); // send 'end of frame'
+  if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL, framedrop); // send 'end of frame'
 
     return ret;
 }
 
-void mpeg2_drop (int flag)
-{
-    drop_flag = flag;
-}
+//void mpeg2_drop (int flag)
+//{
+//    drop_flag = flag;
+//}
 
--- a/libmpeg2/mpeg2.h	Sun Jun 03 10:48:36 2001 +0000
+++ b/libmpeg2/mpeg2.h	Sun Jun 03 18:22:59 2001 +0000
@@ -51,9 +51,9 @@
 
 void mpeg2_init (void);
 //void mpeg2_allocate_image_buffers (picture_t * picture);
-int mpeg2_decode_data (vo_functions_t *, uint8_t * data_start, uint8_t * data_end);
+int mpeg2_decode_data (vo_functions_t *, uint8_t * data_start, uint8_t * data_end,int framedrop);
 //void mpeg2_close (vo_functions_t *);
-void mpeg2_drop (int flag);
+//void mpeg2_drop (int flag);
 
 
 
--- a/mplayer.c	Sun Jun 03 10:48:36 2001 +0000
+++ b/mplayer.c	Sun Jun 03 18:22:59 2001 +0000
@@ -1711,7 +1711,7 @@
 	}
         
         t-=GetTimer();
-          mpeg2_decode_data(video_out, videobuffer, videobuffer+videobuf_len);
+          mpeg2_decode_data(video_out, videobuffer, videobuffer+videobuf_len,drop_frame);
         t+=GetTimer(); video_time_usage+=t*0.000001;
 
         newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;