diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-05-24 21:41:27 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-05-24 21:41:27 +0000 |
commit | f2e7ffa88dedcd7ce06f89dc5eb96eb766af4bed (patch) | |
tree | ca43c7c300caad1959a822e7b97c77ece66f75a9 /src | |
parent | df2eb164e1af3a7f267ce5fc42578b3816eb15fb (diff) | |
download | xine-lib-f2e7ffa88dedcd7ce06f89dc5eb96eb766af4bed.tar.gz xine-lib-f2e7ffa88dedcd7ce06f89dc5eb96eb766af4bed.tar.bz2 |
updated libmpeg2 to the latest version
CVS patchset: 79
CVS date: 2001/05/24 21:41:27
Diffstat (limited to 'src')
-rw-r--r-- | src/libmpeg2/decode.c | 356 | ||||
-rw-r--r-- | src/libmpeg2/header.c | 6 | ||||
-rw-r--r-- | src/libmpeg2/idct.c | 2 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 1 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2_internal.h | 2 | ||||
-rw-r--r-- | src/libmpeg2/slice.c | 89 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 18 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 4 | ||||
-rw-r--r-- | src/xine-engine/metronom.c | 5 | ||||
-rw-r--r-- | src/xine-engine/video_out.c | 16 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 4 |
11 files changed, 191 insertions, 312 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index ce0d97643..8feb005dc 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -17,6 +17,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * xine-specific version by G. Bartsch + * */ #include "config.h" @@ -32,10 +35,12 @@ #include "cpu_accel.h" #include "utils.h" +#define BUFFER_SIZE (224 * 1024) + mpeg2_config_t config; void mpeg2_init (mpeg2dec_t * mpeg2dec, - vo_instance_t * output) + vo_instance_t * output) { static int do_init = 1; @@ -46,125 +51,29 @@ void mpeg2_init (mpeg2dec_t * mpeg2dec, motion_comp_init (); } - mpeg2dec->chunk_buffer = xmalloc_aligned (16, 224 * 1024 + 4); + mpeg2dec->chunk_buffer = xmalloc_aligned (16, BUFFER_SIZE + 4); mpeg2dec->picture = xmalloc_aligned (16, sizeof (picture_t)); - mpeg2dec->shift = 0; + mpeg2dec->shift = 0xffffff00; mpeg2dec->is_sequence_needed = 1; mpeg2dec->frames_to_drop = 0; - mpeg2dec->skip_slices = 0; + mpeg2dec->drop_frame = 0; mpeg2dec->in_slice = 0; - mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; - mpeg2dec->code = 0xff; mpeg2dec->output = output; + mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; + mpeg2dec->code = 0xb4; memset (mpeg2dec->picture, 0, sizeof (picture_t)); /* initialize supstructures */ header_state_init (mpeg2dec->picture); - - output->open (output); -} - -void decode_free_image_buffers (mpeg2dec_t * mpeg2dec) { - - picture_t *picture = mpeg2dec->picture; - - if (picture->forward_reference_frame) { - picture->forward_reference_frame->free (picture->forward_reference_frame); - picture->forward_reference_frame = NULL; - } - - if (picture->backward_reference_frame) { - picture->backward_reference_frame->free (picture->backward_reference_frame); - picture->backward_reference_frame = NULL; - } - - if (picture->throwaway_frame) { - picture->throwaway_frame->free (picture->throwaway_frame); - picture->throwaway_frame = NULL; - } } -static void decode_reorder_frames (mpeg2dec_t * mpeg2dec) -{ - picture_t *picture = mpeg2dec->picture; - - if (picture->picture_coding_type != B_TYPE) { - - if (picture->forward_reference_frame) - picture->forward_reference_frame->free (picture->forward_reference_frame); - - /* - * make the backward reference frame the new forward reference frame - */ - - picture->forward_reference_frame = picture->backward_reference_frame; - - /* - * allocate new backward reference frame - */ - - - picture->backward_reference_frame = mpeg2dec->output->get_frame (mpeg2dec->output, - picture->coded_picture_width, - picture->coded_picture_height, - picture->aspect_ratio_information, - IMGFMT_YV12, - picture->frame_duration);; - picture->backward_reference_frame->PTS = 0; - /*picture->backward_reference_frame->bFrameBad = 1; */ - - - if (!picture->forward_reference_frame) { - - picture->forward_reference_frame = mpeg2dec->output->get_frame (mpeg2dec->output, - picture->coded_picture_width, - picture->coded_picture_height, - picture->aspect_ratio_information, - IMGFMT_YV12, - picture->frame_duration);; - picture->forward_reference_frame->PTS = 0; - /*picture->forward_reference_frame->bFrameBad = 1; */ - } - - - /* - * make it the current frame - */ - - picture->current_frame = picture->backward_reference_frame; - - } else { - - /* - * allocate new throwaway frame - */ - - picture->throwaway_frame = mpeg2dec->output->get_frame (mpeg2dec->output, - picture->coded_picture_width, - picture->coded_picture_height, - picture->aspect_ratio_information, - IMGFMT_YV12, - picture->frame_duration);; - picture->throwaway_frame->PTS = 0; - /*picture->throwaway_frame->bFrameBad = 1; */ - - /* - * make it the current frame - */ - - picture->current_frame = picture->throwaway_frame; - } -} - - - -static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint32_t pts) +static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, + uint8_t * buffer) { picture_t * picture; int is_frame_done; - int bFlipPage; /* wait for sequence_header_code */ if (mpeg2dec->is_sequence_needed && (code != 0xb3)) @@ -176,22 +85,30 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 is_frame_done = mpeg2dec->in_slice && ((!code) || (code >= 0xb0)); if (is_frame_done) { - mpeg2dec->in_slice = 0; - if ((picture->picture_structure == FRAME_PICTURE) || - (picture->second_field)) { - if (picture->picture_coding_type == B_TYPE) { - picture->throwaway_frame->bFrameBad = !mpeg2dec->drop_frame; - picture->throwaway_frame->draw (picture->throwaway_frame); - picture->throwaway_frame->free (picture->throwaway_frame); - } else { - picture->forward_reference_frame->bFrameBad = !mpeg2dec->drop_frame; - picture->forward_reference_frame->draw (picture->forward_reference_frame); - } - bFlipPage = 1; - } else - bFlipPage = 0; + if (((picture->picture_structure == FRAME_PICTURE) || + (picture->second_field)) ) { + + if (picture->picture_coding_type == B_TYPE) { + picture->current_frame->bFrameBad = mpeg2dec->drop_frame; + picture->current_frame->PTS = mpeg2dec->pts; + mpeg2dec->pts = 0; + mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); + picture->current_frame->free (picture->current_frame); + picture->current_frame = NULL; + } else { + picture->forward_reference_frame->bFrameBad = mpeg2dec->drop_frame; + picture->forward_reference_frame->PTS = mpeg2dec->pts; + mpeg2dec->pts = 0; + mpeg2dec->frames_to_drop = picture->forward_reference_frame->draw (picture->forward_reference_frame); + } + +#ifdef ARCH_X86 + if (config.flags & MM_ACCEL_X86_MMX) + emms (); +#endif + } } switch (code) { @@ -200,58 +117,8 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 fprintf (stderr, "bad picture header\n"); exit (1); } - - if (bFlipPage) - decode_reorder_frames (mpeg2dec); - - if (mpeg2dec->pts) { - picture->current_frame->PTS = mpeg2dec->pts; - mpeg2dec->pts = 0; - } - - - /* - * find out if we want to skip this frame - */ - - mpeg2dec->drop_frame = 0; - switch (picture->picture_coding_type) { - case B_TYPE: - - if (mpeg2dec->frames_to_drop>0) { - mpeg2dec->drop_frame = 1; - mpeg2dec->frames_to_drop--; - } else if (!picture->forward_reference_frame - || !picture->backward_reference_frame - || picture->forward_reference_frame->bFrameBad - || picture->backward_reference_frame->bFrameBad) { - mpeg2dec->drop_frame = 1; - mpeg2dec->frames_to_drop--; - } - - break; - case P_TYPE: - - if (mpeg2dec->frames_to_drop>2) { - mpeg2dec->drop_frame = 1; - mpeg2dec->frames_to_drop--; - } else if (!picture->forward_reference_frame - || picture->forward_reference_frame->bFrameBad) { - mpeg2dec->drop_frame = 1; - mpeg2dec->frames_to_drop--; - } - - break; - case I_TYPE: - - if (mpeg2dec->frames_to_drop>4) { - mpeg2dec->drop_frame = 1; - mpeg2dec->frames_to_drop--; - } - - break; - } - + mpeg2dec->drop_frame = /* FIXME : skip P and I frames too if necc. */ + (mpeg2dec->frames_to_drop>0) && (picture->picture_coding_type == B_TYPE); break; case 0xb3: /* sequence_header_code */ @@ -259,9 +126,26 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 fprintf (stderr, "bad sequence header\n"); exit (1); } - if (mpeg2dec->is_sequence_needed) + if (mpeg2dec->is_sequence_needed) { mpeg2dec->is_sequence_needed = 0; - + picture->forward_reference_frame = + mpeg2dec->output->get_frame (mpeg2dec->output, + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration); + picture->forward_reference_frame->PTS = 0; + picture->backward_reference_frame = + mpeg2dec->output->get_frame (mpeg2dec->output, + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration); + picture->backward_reference_frame->PTS = 0; + + } break; case 0xb5: /* extension_start_code */ @@ -282,93 +166,117 @@ static int parse_chunk (mpeg2dec_t * mpeg2dec, int code, uint8_t * buffer, uint3 mpeg2dec->in_slice = 1; if (picture->second_field) - picture->current_frame->field (picture->current_frame, - picture->picture_structure); + picture->current_frame->field(picture->current_frame, + picture->picture_structure); + else { + if (picture->picture_coding_type == B_TYPE) + picture->current_frame = + mpeg2dec->output->get_frame (mpeg2dec->output, + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration); + else { + picture->current_frame = + mpeg2dec->output->get_frame (mpeg2dec->output, + picture->coded_picture_width, + picture->coded_picture_height, + picture->aspect_ratio_information, + IMGFMT_YV12, + picture->frame_duration); + picture->forward_reference_frame->free (picture->forward_reference_frame); + + picture->forward_reference_frame = + picture->backward_reference_frame; + picture->backward_reference_frame = picture->current_frame; + } + } } - if (!mpeg2dec->drop_frame) { + if (!(mpeg2dec->drop_frame)) { slice_process (picture, code, buffer); + +#ifdef ARCH_X86 + if (config.flags & MM_ACCEL_X86_MMX) + emms (); +#endif } } return is_frame_done; } -int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, - uint32_t pts) +static inline uint8_t * copy_chunk (mpeg2dec_t * mpeg2dec, + uint8_t * current, uint8_t * end) { uint32_t shift; uint8_t * chunk_ptr; + uint8_t * limit; uint8_t byte; - int ret = 0; shift = mpeg2dec->shift; chunk_ptr = mpeg2dec->chunk_ptr; - mpeg2dec->pts = pts; - - printf ("mpeg2dec: decode_data...\n"); - - while (current != end) { - while (1) { - byte = *current++; - if (shift != 0x00000100) { - *chunk_ptr++ = byte; - shift = (shift | byte) << 8; - if (current != end) - continue; + limit = current + (mpeg2dec->chunk_buffer + BUFFER_SIZE - chunk_ptr); + if (limit > end) + limit = end; + + while (1) { + byte = *current++; + if (shift != 0x00000100) { + shift = (shift | byte) << 8; + *chunk_ptr++ = byte; + if (current < limit) + continue; + if (current == end) { mpeg2dec->chunk_ptr = chunk_ptr; mpeg2dec->shift = shift; -#ifdef ARCH_X86 - if (config.flags & MM_ACCEL_X86_MMX) - emms(); -#endif - - return ret; + return NULL; + } else { + /* we filled the chunk buffer without finding a start code */ + mpeg2dec->code = 0xb4; /* sequence_error_code */ + mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; + return current; } - break; } - - /* found start_code following chunk */ - - ret += parse_chunk (mpeg2dec, mpeg2dec->code, mpeg2dec->chunk_buffer, pts); - - /* done with header or slice, prepare for next one */ - mpeg2dec->code = byte; - chunk_ptr = mpeg2dec->chunk_buffer; - shift = 0xffffff00; + mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer; + mpeg2dec->shift = 0xffffff00; + return current; } +} - printf ("mpeg2dec: decode_data finished\n"); +int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, + uint32_t pts) +{ + int ret; + uint8_t code; - mpeg2dec->chunk_ptr = chunk_ptr; - mpeg2dec->shift = shift; -#ifdef ARCH_X86 - if (config.flags & MM_ACCEL_X86_MMX) - emms(); -#endif + ret = 0; + mpeg2dec->pts = pts; + + while (current != end) { + code = mpeg2dec->code; + current = copy_chunk (mpeg2dec, current, end); + if (current == NULL) + return ret; + ret += parse_chunk (mpeg2dec, code, mpeg2dec->chunk_buffer); + } return ret; } void mpeg2_close (mpeg2dec_t * mpeg2dec) { - static uint8_t finalizer[] = {0,0,1,0}; + static uint8_t finalizer[] = {0,0,1,0xb4}; mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4, 0); + /* FIXME if (! (mpeg2dec->is_sequence_needed)) - mpeg2dec->picture->backward_reference_frame->draw (mpeg2dec->picture->backward_reference_frame); - - mpeg2dec->output->close (mpeg2dec->output); + vo_draw (mpeg2dec->picture->backward_reference_frame); + */ free (mpeg2dec->chunk_buffer); free (mpeg2dec->picture); - } -void mpeg2_skip_frames (mpeg2dec_t * mpeg2dec, int num_frames) -{ - mpeg2dec->frames_to_drop = num_frames; -} - - diff --git a/src/libmpeg2/header.c b/src/libmpeg2/header.c index 013393da4..9c4a8c694 100644 --- a/src/libmpeg2/header.c +++ b/src/libmpeg2/header.c @@ -22,7 +22,6 @@ #include "config.h" #include <inttypes.h> -#include <stdio.h> #include "mpeg2_internal.h" #include "attributes.h" @@ -122,11 +121,10 @@ int header_process_sequence_header (picture_t * picture, uint8_t * buffer) picture->frame_duration = 1509; break; default: - printf ("invalid/unknown frame rate code : %d \n", - picture->frame_rate_code); + /* printf ("invalid/unknown frame rate code : %d \n", + picture->frame_rate_code); */ picture->frame_duration = 3000; } - picture->bitrate = (buffer[4]<<10)|(buffer[5]<<2)|(buffer[6]>>6); diff --git a/src/libmpeg2/idct.c b/src/libmpeg2/idct.c index 937feb8e8..757d2c5e3 100644 --- a/src/libmpeg2/idct.c +++ b/src/libmpeg2/idct.c @@ -43,8 +43,6 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xine_internal.h" -#include "xine_internal.h" #include "cpu_accel.h" #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index 3b51fba22..bca8f61b0 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -31,7 +31,6 @@ typedef struct mpeg2dec_s { int is_display_initialized; int is_sequence_needed; int frames_to_drop, drop_frame; - int skip_slices; int in_slice; /* the maximum chunk size is determined by vbv_buffer_size */ diff --git a/src/libmpeg2/mpeg2_internal.h b/src/libmpeg2/mpeg2_internal.h index a5d76dc7c..97c611d1c 100644 --- a/src/libmpeg2/mpeg2_internal.h +++ b/src/libmpeg2/mpeg2_internal.h @@ -190,7 +190,7 @@ extern mc_functions_t mc_functions_3dnow; extern mc_functions_t mc_functions_mlib; /* slice.c */ -int slice_process (picture_t *picture, uint8_t code, uint8_t * buffer); +void slice_process (picture_t *picture, uint8_t code, uint8_t * buffer); /* stats.c */ void stats_header (uint8_t code, uint8_t * buffer); diff --git a/src/libmpeg2/slice.c b/src/libmpeg2/slice.c index 727adb3d9..819ff0f65 100644 --- a/src/libmpeg2/slice.c +++ b/src/libmpeg2/slice.c @@ -946,43 +946,34 @@ static void get_mpeg1_non_intra_block (picture_t * picture) picture->bitstream_ptr = bit_ptr; } -static inline int get_macroblock_address_increment (picture_t * picture) -{ -#define bit_buf (picture->bitstream_buf) -#define bits (picture->bitstream_bits) -#define bit_ptr (picture->bitstream_ptr) - - MBAtab * tab; - int mba; - - mba = 0; - - while (1) { - if (bit_buf >= 0x10000000) { - tab = MBA_5 - 2 + UBITS (bit_buf, 5); - DUMPBITS (bit_buf, bits, tab->len); - return mba + tab->mba; - } else if (bit_buf >= 0x03000000) { - tab = MBA_11 - 24 + UBITS (bit_buf, 11); - DUMPBITS (bit_buf, bits, tab->len); - return mba + tab->mba; - } else switch (UBITS (bit_buf, 11)) { - case 8: /* macroblock_escape */ - mba += 33; - /* no break here on purpose */ - case 15: /* macroblock_stuffing (MPEG1 only) */ - DUMPBITS (bit_buf, bits, 11); - NEEDBITS (bit_buf, bits, bit_ptr); - break; - default: /* end of slice, or error */ - return 0; - } - } - -#undef bit_buf -#undef bits -#undef bit_ptr -} +#define GET_MACROBLOCK_ADDRESS_INCREMENT(increment) \ +do { \ + MBAtab * tab; \ + \ + increment = 0; \ + \ + while (1) { \ + if (bit_buf >= 0x10000000) { \ + tab = MBA_5 - 2 + UBITS (bit_buf, 5); \ + break; \ + } else if (bit_buf >= 0x03000000) { \ + tab = MBA_11 - 24 + UBITS (bit_buf, 11); \ + break; \ + } else switch (UBITS (bit_buf, 11)) { \ + case 8: /* macroblock_escape */ \ + increment += 33; \ + /* pass through */ \ + case 15: /* macroblock_stuffing (MPEG1 only) */ \ + DUMPBITS (bit_buf, bits, 11); \ + NEEDBITS (bit_buf, bits, bit_ptr); \ + continue; \ + default: /* end of slice, or error */ \ + return; \ + } \ + } \ + DUMPBITS (bit_buf, bits, tab->len); \ + increment += tab->mba; \ +} while (0) static inline void slice_intra_DCT (picture_t * picture, int cc, uint8_t * dest, int stride) @@ -1504,15 +1495,15 @@ do { \ dest[2] += 4 * stride; \ } while (0); \ if (! (picture->mpeg1)) \ - return 0; \ + return; \ picture->v_offset += 16; \ if (picture->v_offset >= picture->coded_picture_height) \ - return 0; \ + return; \ offset = 0; \ } \ } while (0) -int slice_process (picture_t * picture, uint8_t code, uint8_t * buffer) +void slice_process (picture_t * picture, uint8_t code, uint8_t * buffer) { #define bit_buf (picture->bitstream_buf) #define bits (picture->bitstream_bits) @@ -1596,9 +1587,12 @@ int slice_process (picture_t * picture, uint8_t code, uint8_t * buffer) DUMPBITS (bit_buf, bits, 1); NEEDBITS (bit_buf, bits, bit_ptr); - offset = get_macroblock_address_increment (picture) << 4; + GET_MACROBLOCK_ADDRESS_INCREMENT (offset); + offset <<= 4; while (1) { + int mba_inc; + NEEDBITS (bit_buf, bits, bit_ptr); macroblock_modes = get_macroblock_modes (picture); @@ -1750,16 +1744,9 @@ int slice_process (picture_t * picture, uint8_t code, uint8_t * buffer) CHECK_DISPLAY; NEEDBITS (bit_buf, bits, bit_ptr); + GET_MACROBLOCK_ADDRESS_INCREMENT (mba_inc); - if (bit_buf & 0x80000000) { - DUMPBITS (bit_buf, bits, 1); - } else { - int mba_inc; - - mba_inc = get_macroblock_address_increment (picture); - if (!mba_inc) - break; - + if (mba_inc) { picture->dc_dct_pred[0] = picture->dc_dct_pred[1] = picture->dc_dct_pred[2] = 1 << (picture->intra_dc_precision+7); @@ -1791,8 +1778,6 @@ int slice_process (picture_t * picture, uint8_t code, uint8_t * buffer) } } } - - return 0; #undef bit_buf #undef bits #undef bit_ptr diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 932e59ee3..132c1f81a 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.4 2001/04/30 23:07:00 guenter Exp $ + * $Id: xine_decoder.c,v 1.5 2001/05/24 21:41:27 guenter Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -35,6 +35,7 @@ typedef struct mpeg2dec_decoder_s { video_decoder_t video_decoder; mpeg2dec_t mpeg2; + vo_instance_t *video_out; } mpeg2dec_decoder_t; int mpeg2dec_can_handle (video_decoder_t *this_gen, int buf_type) { @@ -46,32 +47,24 @@ void mpeg2dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; - printf ("libmpeg: initializing mpeg2dec\n"); - mpeg2_init (&this->mpeg2, video_out); + video_out->open(video_out); + this->video_out = video_out; } void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; - printf ("libmpeg: decoding data (pts = %d)\n", buf->PTS); - mpeg2_decode_data (&this->mpeg2, buf->content, buf->content + buf->size, buf->PTS); } -void mpeg2dec_release_img_buffers (video_decoder_t *this_gen) { - - mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; - - decode_free_image_buffers (&this->mpeg2); -} - void mpeg2dec_close (video_decoder_t *this_gen) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; mpeg2_close (&this->mpeg2); + this->video_out->close(this->video_out); } static char *mpeg2dec_get_id(void) { @@ -91,7 +84,6 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t * this->video_decoder.can_handle = mpeg2dec_can_handle; this->video_decoder.init = mpeg2dec_init; this->video_decoder.decode_data = mpeg2dec_decode_data; - this->video_decoder.release_img_buffers = mpeg2dec_release_img_buffers; this->video_decoder.close = mpeg2dec_close; this->video_decoder.get_identifier = mpeg2dec_get_id; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 94d662eca..3cebddcd6 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.18 2001/05/22 23:07:49 guenter Exp $ + * $Id: video_out_xv.c,v 1.19 2001/05/24 21:41:28 guenter Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -237,8 +237,6 @@ static void xv_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen XUnlockDisplay (this->display); } - printf ("video_out_xv: update format done\n"); - frame->ratio_code = ratio_code; } diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index dbe4cccee..bcb4b80fd 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.4 2001/05/06 15:44:25 guenter Exp $ + * $Id: metronom.c,v 1.5 2001/05/24 21:41:28 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -27,6 +27,7 @@ #include <sys/time.h> #include <inttypes.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <math.h> @@ -44,6 +45,8 @@ static void metronom_reset (metronom_t *this) { pthread_mutex_lock (&this->lock); + this->pts_per_frame = 3000; + this->video_vpts = 0; this->audio_vpts = 0; diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 1b272b3eb..36b0f604d 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.6 2001/05/24 15:31:31 guenter Exp $ + * $Id: video_out.c,v 1.7 2001/05/24 21:41:28 guenter Exp $ * */ @@ -129,8 +129,8 @@ static void vo_set_timer (uint32_t video_step) { tval.it_value.tv_sec = 0; tval.it_value.tv_usec = video_step*100000/90000; - /* printf ("video_out: tval.it_interval.tv_usec = %d\n", tval.it_interval.tv_usec); */ - + /* printf ("video_out: tval.it_interval.tv_usec = %d\n", tval.it_interval.tv_usec); */ + if (setitimer(ITIMER_REAL, &tval, NULL)) { printf ("vo_set_timer: setitimer failed :"); } @@ -144,7 +144,7 @@ static void *video_out_loop (void *this_gen) { uint32_t video_step, video_step_new; vo_instance_t *this = (vo_instance_t *) this_gen; - /* printf ("%d video_out start\n", getpid()); */ + /* printf ("%d video_out start\n", getpid()); */ signal (SIGALRM, video_timer_handler); @@ -262,7 +262,7 @@ static vo_frame_t *vo_get_frame (vo_instance_t *this, vo_frame_t *img; - /* printf ("video_out: vo_get_frame\n"); */ + /* printf ("video_out: vo_get_frame\n"); */ if (this->pts_per_frame != duration) { this->pts_per_frame = duration; @@ -283,7 +283,7 @@ static vo_frame_t *vo_get_frame (vo_instance_t *this, pthread_mutex_unlock (&img->mutex); - /* printf ("video_out: vo_get_frame done\n"); */ + /* printf ("video_out: vo_get_frame done\n"); */ return img; } @@ -339,11 +339,11 @@ static void vo_frame_free (vo_frame_t *img) { pthread_mutex_lock (&img->mutex); img->bDecoderLock = 0; - if (!img->bDisplayLock && !img->bDriverLock ) + if (!img->bDisplayLock && !img->bDriverLock ) { vo_append_to_img_buf_queue (img->instance->free_img_buf_queue, img); + } pthread_mutex_unlock (&img->mutex); - } static int vo_frame_draw (vo_frame_t *img) { diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 571614b8b..e38cfc70b 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_internal.h,v 1.18 2001/05/03 00:02:42 f1rmb Exp $ + * $Id: xine_internal.h,v 1.19 2001/05/24 21:41:28 guenter Exp $ * */ @@ -58,8 +58,6 @@ struct video_decoder_s { void (*decode_data) (video_decoder_t *this, buf_element_t *buf); - void (*release_img_buffers) (video_decoder_t *this); - void (*close) (video_decoder_t *this); char* (*get_identifier) (void); |