Mercurial > mplayer.hg
comparison libmpeg2/decode.c @ 967:5f07e67982d6
-framedrop worx fro mpeg files
author | arpi_esp |
---|---|
date | Sun, 03 Jun 2001 18:22:59 +0000 |
parents | 3601edb3805c |
children | 3c33deb3e561 |
comparison
equal
deleted
inserted
replaced
966:69b4f944ce08 | 967:5f07e67982d6 |
---|---|
50 // the maximum chunk size is determined by vbv_buffer_size which is 224K for | 50 // the maximum chunk size is determined by vbv_buffer_size which is 224K for |
51 // MP@ML streams. (we make no pretenses ofdecoding anything more than that) | 51 // MP@ML streams. (we make no pretenses ofdecoding anything more than that) |
52 //static uint8_t chunk_buffer[224 * 1024 + 4]; | 52 //static uint8_t chunk_buffer[224 * 1024 + 4]; |
53 //static uint32_t shift = 0; | 53 //static uint32_t shift = 0; |
54 | 54 |
55 static int drop_flag = 0; | 55 //static int drop_flag = 0; |
56 static int drop_frame = 0; | 56 static int drop_frame = 0; |
57 | 57 |
58 #ifdef MPEG12_POSTPROC | 58 #ifdef MPEG12_POSTPROC |
59 int quant_store[MBR+1][MBC+1]; // [Review] | 59 int quant_store[MBR+1][MBC+1]; // [Review] |
60 #endif | 60 #endif |
149 ++picture->slice; | 149 ++picture->slice; |
150 } | 150 } |
151 | 151 |
152 static int in_slice_flag=0; | 152 static int in_slice_flag=0; |
153 | 153 |
154 static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer) | 154 static int parse_chunk (vo_functions_t * output, int code, uint8_t * buffer, int framedrop) |
155 { | 155 { |
156 int is_frame_done = 0; | 156 int is_frame_done = 0; |
157 | 157 |
158 stats_header (code, buffer); | 158 stats_header (code, buffer); |
159 | 159 |
161 if (is_frame_done) { | 161 if (is_frame_done) { |
162 in_slice_flag = 0; | 162 in_slice_flag = 0; |
163 | 163 |
164 // if(picture->picture_structure != FRAME_PICTURE) printf("Field! %d \n",picture->second_field); | 164 // if(picture->picture_structure != FRAME_PICTURE) printf("Field! %d \n",picture->second_field); |
165 | 165 |
166 if(!framedrop) | |
166 if (((picture->picture_structure == FRAME_PICTURE) || | 167 if (((picture->picture_structure == FRAME_PICTURE) || |
167 (picture->second_field)) | 168 (picture->second_field)) |
168 ) { | 169 ) { |
169 #ifdef MPEG12_POSTPROC | 170 #ifdef MPEG12_POSTPROC |
170 if(picture->pp_options){ | 171 if(picture->pp_options){ |
206 if (header_process_picture_header (picture, buffer)) { | 207 if (header_process_picture_header (picture, buffer)) { |
207 printf ("bad picture header\n"); | 208 printf ("bad picture header\n"); |
208 //exit (1); | 209 //exit (1); |
209 } | 210 } |
210 | 211 |
211 drop_frame = drop_flag && (picture->picture_coding_type == B_TYPE); | 212 drop_frame = framedrop && (picture->picture_coding_type == B_TYPE); |
213 drop_frame |= framedrop>=2; // hard drop | |
212 //decode_reorder_frames (); | 214 //decode_reorder_frames (); |
213 break; | 215 break; |
214 | 216 |
215 case 0xb3: /* sequence_header_code */ | 217 case 0xb3: /* sequence_header_code */ |
216 if (header_process_sequence_header (picture, buffer)) { | 218 if (header_process_sequence_header (picture, buffer)) { |
257 if(picture->pp_options) | 259 if(picture->pp_options) |
258 picture->current_frame->copy=NULL; else | 260 picture->current_frame->copy=NULL; else |
259 #endif | 261 #endif |
260 picture->current_frame->copy=copy_slice; | 262 picture->current_frame->copy=copy_slice; |
261 #endif | 263 #endif |
262 | 264 if(framedrop) picture->current_frame->copy=NULL; |
263 picture->current_frame->vo=output; | 265 picture->current_frame->vo=output; |
264 picture->slice=0; | 266 picture->slice=0; |
265 | 267 |
266 } | 268 } |
267 | 269 |
283 | 285 |
284 static void mpeg2_sighandler(int sig){ | 286 static void mpeg2_sighandler(int sig){ |
285 longjmp(mpeg2_jmp_buf,1); | 287 longjmp(mpeg2_jmp_buf,1); |
286 } | 288 } |
287 | 289 |
288 int mpeg2_decode_data (vo_functions_t *output, uint8_t *current, uint8_t *end) | 290 int mpeg2_decode_data (vo_functions_t *output, uint8_t *current, uint8_t *end,int framedrop) |
289 { | 291 { |
290 //static uint8_t code = 0xff; | 292 //static uint8_t code = 0xff; |
291 //static uint8_t chunk_buffer[65536]; | 293 //static uint8_t chunk_buffer[65536]; |
292 //static uint8_t *chunk_ptr = chunk_buffer; | 294 //static uint8_t *chunk_ptr = chunk_buffer; |
293 //static uint32_t shift = 0; | 295 //static uint32_t shift = 0; |
321 //-------------------- | 323 //-------------------- |
322 if(pos){ | 324 if(pos){ |
323 //if((code&0x100)!=0x100) printf("libmpeg2: FATAL! code=%X\n",code); | 325 //if((code&0x100)!=0x100) printf("libmpeg2: FATAL! code=%X\n",code); |
324 //printf("pos=%d chunk %3X size=%d next-code=%X\n",pos-start,code,current-pos,head|c); | 326 //printf("pos=%d chunk %3X size=%d next-code=%X\n",pos-start,code,current-pos,head|c); |
325 if(setjmp(mpeg2_jmp_buf)==0){ | 327 if(setjmp(mpeg2_jmp_buf)==0){ |
326 ret+=parse_chunk(output, code&0xFF, pos); | 328 ret+=parse_chunk(output, code&0xFF, pos, framedrop); |
327 } else { | 329 } else { |
328 #ifdef ARCH_X86 | 330 #ifdef ARCH_X86 |
329 if (config.flags & MM_ACCEL_X86_MMX) emms (); | 331 if (config.flags & MM_ACCEL_X86_MMX) emms (); |
330 #endif | 332 #endif |
331 printf("@@@ libmpeg2 returned from sig11... (bad file?) @@@\n"); | 333 printf("@@@ libmpeg2 returned from sig11... (bad file?) @@@\n"); |
335 pos=current;code=head|c; | 337 pos=current;code=head|c; |
336 } | 338 } |
337 | 339 |
338 signal(SIGSEGV,old_sigh); // restore sighandler | 340 signal(SIGSEGV,old_sigh); // restore sighandler |
339 | 341 |
340 if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL); // send 'end of frame' | 342 if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL, framedrop); // send 'end of frame' |
341 | 343 |
342 return ret; | 344 return ret; |
343 } | 345 } |
344 | 346 |
345 void mpeg2_drop (int flag) | 347 //void mpeg2_drop (int flag) |
346 { | 348 //{ |
347 drop_flag = flag; | 349 // drop_flag = flag; |
348 } | 350 //} |
349 | 351 |