diff options
author | Christophe Thommeret <hftom@free.fr> | 2008-12-16 17:23:43 +0000 |
---|---|---|
committer | Christophe Thommeret <hftom@free.fr> | 2008-12-16 17:23:43 +0000 |
commit | a5fc948257b9b423142b836a5a2bade1171f1048 (patch) | |
tree | abe0c8512e90dc142b089c13eb167ea50db94fd0 /src | |
parent | 57bf242b5b3d978e493951246f2ba6295a4cd8f6 (diff) | |
download | xine-lib-a5fc948257b9b423142b836a5a2bade1171f1048.tar.gz xine-lib-a5fc948257b9b423142b836a5a2bade1171f1048.tar.bz2 |
MPEG1.
Diffstat (limited to 'src')
-rw-r--r-- | src/libvdpau/vdpau_h264.c | 10 | ||||
-rw-r--r-- | src/libvdpau/vdpau_mpeg12.c | 40 |
2 files changed, 37 insertions, 13 deletions
diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c index f69e07387..3b8e67f2d 100644 --- a/src/libvdpau/vdpau_h264.c +++ b/src/libvdpau/vdpau_h264.c @@ -545,10 +545,12 @@ static void vdpau_h264_dispose (video_decoder_t *this_gen) { } if (this->decoder_initialized) { + this->vdpau_accel->vdp_decoder_destroy( this->decoder ); this->decoder_initialized = 0; - this->stream->video_out->close(this->stream->video_out, this->stream); } + this->stream->video_out->close( this->stream->video_out, this->stream ); + free (this_gen); } @@ -560,12 +562,12 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre vdpau_h264_decoder_t *this ; - this = (vdpau_h264_decoder_t *) calloc(1, sizeof(vdpau_h264_decoder_t)); - /* the videoout must be vdpau-capable to support this decoder */ if ( !(stream->video_driver->get_capabilities(stream->video_driver) & VO_CAP_VDPAU_H264) ) return NULL; + this = (vdpau_h264_decoder_t *) calloc(1, sizeof(vdpau_h264_decoder_t)); + this->video_decoder.decode_data = vdpau_h264_decode_data; this->video_decoder.flush = vdpau_h264_flush; this->video_decoder.reset = vdpau_h264_reset; @@ -586,6 +588,8 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre this->last_pts = 0; this->tmp_pts = 0; + (stream->video_out->open)(stream->video_out, stream); + return &this->video_decoder; } diff --git a/src/libvdpau/vdpau_mpeg12.c b/src/libvdpau/vdpau_mpeg12.c index 08e7f30a2..1d04c851a 100644 --- a/src/libvdpau/vdpau_mpeg12.c +++ b/src/libvdpau/vdpau_mpeg12.c @@ -21,7 +21,7 @@ * */ -//#define LOG +#define LOG #define LOG_MODULE "vdpau_mpeg12" @@ -197,11 +197,13 @@ static void init_picture( picture_t *pic ) static void reset_sequence( sequence_t *sequence ) { + lprintf( "reset_sequence\n" ); sequence->have_header = 0; sequence->bufpos = 0; sequence->bufseek = 0; sequence->start = -1; sequence->seq_pts = sequence->cur_pts = 0; + sequence->profile = VDP_DECODER_PROFILE_MPEG1; //sequence->ratio = 1.0; sequence->video_step = 3600; if ( sequence->forward_ref ) @@ -274,13 +276,13 @@ static void sequence_header( vdpau_mpeg12_decoder_t *this_gen, uint8_t *buf, int lprintf( "load_intra_quantizer_matrix: %d\n", i ); if ( i ) { for ( j=0; j<64; ++j ) { - sequence->picture.vdp_infos.intra_quantizer_matrix[mpeg2_scan_norm[j]] = get_bits( buf+7+j,7,8 ); + sequence->picture.vdp_infos2.intra_quantizer_matrix[mpeg2_scan_norm[j]] = sequence->picture.vdp_infos.intra_quantizer_matrix[mpeg2_scan_norm[j]] = get_bits( buf+7+j,7,8 ); } off = 64; } else { for ( j=0; j<64; ++j ) { - sequence->picture.vdp_infos.intra_quantizer_matrix[mpeg2_scan_norm[j]] = default_intra_quantizer_matrix[j]; + sequence->picture.vdp_infos2.intra_quantizer_matrix[mpeg2_scan_norm[j]] = sequence->picture.vdp_infos.intra_quantizer_matrix[mpeg2_scan_norm[j]] = default_intra_quantizer_matrix[j]; } } @@ -288,11 +290,13 @@ static void sequence_header( vdpau_mpeg12_decoder_t *this_gen, uint8_t *buf, int lprintf( "load_non_intra_quantizer_matrix: %d\n", i ); if ( i ) { for ( j=0; j<64; ++j ) { - sequence->picture.vdp_infos.non_intra_quantizer_matrix[mpeg2_scan_norm[j]] = get_bits( buf+8+off+j,0,8 ); + sequence->picture.vdp_infos2.non_intra_quantizer_matrix[mpeg2_scan_norm[j]] = sequence->picture.vdp_infos.non_intra_quantizer_matrix[mpeg2_scan_norm[j]] = get_bits( buf+8+off+j,0,8 ); } } - else + else { memset( sequence->picture.vdp_infos.non_intra_quantizer_matrix, 16, 64 ); + memset( sequence->picture.vdp_infos2.non_intra_quantizer_matrix, 16, 64 ); + } if ( !sequence->have_header ) { sequence->have_header = 1; @@ -338,9 +342,22 @@ static void picture_header( sequence_t *sequence, uint8_t *buf, int len ) lprintf( "picture_coding_type: %d\n", get_bits( buf,10,3 ) ); infos->forward_reference = VDP_INVALID_HANDLE; infos->backward_reference = VDP_INVALID_HANDLE; - infos->full_pel_forward_vector = 0; - infos->full_pel_backward_vector = 0; - sequence->picture.state = WANT_EXT; + if ( infos->picture_coding_type>2 ) { + infos->full_pel_forward_vector = get_bits( buf+2,13,1 ); + infos->f_code[0][0] = infos->f_code[0][1] = get_bits( buf+2,14,3 ); + if ( infos->picture_coding_type==3 ) { + infos->full_pel_forward_vector = get_bits( buf+2,17,1 ); + infos->f_code[1][0] = infos->f_code[1][1] = get_bits( buf+2,18,3 ); + } + } + else { + infos->full_pel_forward_vector = 0; + infos->full_pel_backward_vector = 0; + } + if ( sequence->profile==VDP_DECODER_PROFILE_MPEG1 ) + sequence->picture.state = WANT_SLICE; + else + sequence->picture.state = WANT_EXT; } @@ -543,8 +560,8 @@ static void decode_render( vdpau_mpeg12_decoder_t *vd, vdpau_accel_t *accel ) if ( st!=VDP_STATUS_OK ) lprintf( "decoder failed : %d!! %s\n", st, accel->vdp_get_error_string( st ) ); else - lprintf( "DECODER SUCCESS : frame_type:%d, slices=%d, current=%d, forwref:%d, backref:%d, pts:%lld\n", - pic->vdp_infos.picture_coding_type, pic->vdp_infos.slice_count, accel->surface, pic->vdp_infos.forward_reference, pic->vdp_infos.backward_reference, seq->seq_pts ); + lprintf( "DECODER SUCCESS : frame_type:%d, slices=%d, slices_bytes=%d, current=%d, forwref:%d, backref:%d, pts:%lld\n", + pic->vdp_infos.picture_coding_type, pic->vdp_infos.slice_count, vbit.bitstream_bytes, accel->surface, pic->vdp_infos.forward_reference, pic->vdp_infos.backward_reference, seq->seq_pts ); if ( pic->vdp_infos.picture_structure != PICTURE_FRAME ) { if ( pic->vdp_infos2.picture_coding_type==P_FRAME ) @@ -577,6 +594,9 @@ static void decode_picture( vdpau_mpeg12_decoder_t *vd ) pic->state = WANT_HEADER; + if ( seq->profile == VDP_DECODER_PROFILE_MPEG1 ) + pic->vdp_infos.picture_structure=PICTURE_FRAME; + if ( pic->vdp_infos.picture_structure!=PICTURE_FRAME && !pic->slices_count2 ) { lprintf("********************* no slices_count2 **********************\n"); return; |