diff options
Diffstat (limited to 'src/libmpeg2')
-rw-r--r-- | src/libmpeg2/decode.c | 17 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 1 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 14 |
3 files changed, 29 insertions, 3 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 6fc38d98a..f0674512f 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -557,6 +557,21 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, return ret; } +void mpeg2_discontinuity (mpeg2dec_t * mpeg2dec) { + picture_t *picture = mpeg2dec->picture; + + if( !picture ) + return; + + mpeg2dec->pts = 0; + if ( picture->current_frame ) + picture->current_frame->pts = 0; + if ( picture->forward_reference_frame ) + picture->forward_reference_frame->pts = 0; + if ( picture->backward_reference_frame ) + picture->backward_reference_frame->pts = 0; +} + void mpeg2_reset (mpeg2dec_t * mpeg2dec) { picture_t *picture = mpeg2dec->picture; @@ -564,7 +579,7 @@ void mpeg2_reset (mpeg2dec_t * mpeg2dec) { if( !picture ) return; - mpeg2dec->pts = 0; + mpeg2_discontinuity(mpeg2dec); if( !picture->mpeg1 ) mpeg2dec->is_sequence_needed = 1; diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index 2c3bd4799..38e868919 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -66,6 +66,7 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec, void mpeg2_flush (mpeg2dec_t * mpeg2dec); void mpeg2_reset (mpeg2dec_t * mpeg2dec); +void mpeg2_discontinuity (mpeg2dec_t * mpeg2dec); /* Not needed, it is defined as static in decode.c, and no-one else called it * currently diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 9aa5cf7ab..07034af72 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.42 2002/10/29 01:29:46 guenter Exp $ + * $Id: xine_decoder.c,v 1.43 2002/11/12 18:40:52 miguelfreitas Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -113,6 +113,15 @@ static void mpeg2dec_reset (video_decoder_t *this_gen) { pthread_mutex_unlock (&this->lock); } +static void mpeg2dec_discontinuity (video_decoder_t *this_gen) { + mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; + + pthread_mutex_lock (&this->lock); + + mpeg2_discontinuity (&this->mpeg2); + + pthread_mutex_unlock (&this->lock); +} static void mpeg2dec_dispose (video_decoder_t *this_gen) { @@ -143,6 +152,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre this->video_decoder.decode_data = mpeg2dec_decode_data; this->video_decoder.flush = mpeg2dec_flush; this->video_decoder.reset = mpeg2dec_reset; + this->video_decoder.discontinuity = mpeg2dec_discontinuity; this->video_decoder.dispose = mpeg2dec_dispose; this->stream = stream; this->class = (mpeg2_class_t *) class_gen; @@ -203,6 +213,6 @@ static decoder_info_t dec_info_mpeg2 = { plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_DECODER, 11, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, + { PLUGIN_VIDEO_DECODER, 12, "mpeg2", XINE_VERSION_CODE, &dec_info_mpeg2, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |