summaryrefslogtreecommitdiffstats
path: root/libmpeg2
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-03 18:22:59 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-03 18:22:59 +0000
commitac2afeb46f21372fba01fc648d3ab07e66147d1f (patch)
tree8d7163476f078e76e79338bb5cd5c3a0870ccb5f /libmpeg2
parent6464ede7732581d78788cf2f019d4067b1c50f2f (diff)
downloadmpv-ac2afeb46f21372fba01fc648d3ab07e66147d1f.tar.bz2
mpv-ac2afeb46f21372fba01fc648d3ab07e66147d1f.tar.xz
-framedrop worx fro mpeg files
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@968 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpeg2')
-rw-r--r--libmpeg2/decode.c24
-rw-r--r--libmpeg2/mpeg2.h4
2 files changed, 15 insertions, 13 deletions
diff --git a/libmpeg2/decode.c b/libmpeg2/decode.c
index 37f7328456..e6ef6b77ba 100644
--- a/libmpeg2/decode.c
+++ b/libmpeg2/decode.c
@@ -52,7 +52,7 @@ mpeg2_config_t config;
//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 void copy_slice (vo_frame_t * frame, uint8_t ** src){
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 @@ static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer)
// 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 @@ static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer)
//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 @@ static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer)
#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 @@ static void mpeg2_sighandler(int sig){
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 @@ while(current<end){
//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 @@ while(current<end){
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;
+//}
diff --git a/libmpeg2/mpeg2.h b/libmpeg2/mpeg2.h
index c3bce07805..5946be6e79 100644
--- a/libmpeg2/mpeg2.h
+++ b/libmpeg2/mpeg2.h
@@ -51,9 +51,9 @@ typedef struct mpeg2dec_s {
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);