summaryrefslogtreecommitdiff
path: root/src/libmpeg2
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmpeg2')
-rw-r--r--src/libmpeg2/decode.c39
-rw-r--r--src/libmpeg2/mpeg2.h1
-rw-r--r--src/libmpeg2/slice.c2
-rw-r--r--src/libmpeg2/xine_decoder.c16
4 files changed, 54 insertions, 4 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 86d9cc0f4..f5bff3815 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -181,8 +181,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
if (((picture->picture_structure == FRAME_PICTURE) ||
(picture->second_field)) ) {
- if (!mpeg2dec->drop_frame)
- picture->current_frame->bad_frame = 0;
+ if (mpeg2dec->drop_frame)
+ picture->current_frame->bad_frame = 1;
if (picture->picture_coding_type == B_TYPE) {
if( picture->current_frame && !picture->current_frame->drawn ) {
@@ -481,6 +481,41 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end,
return ret;
}
+void mpeg2_reset (mpeg2dec_t * mpeg2dec) {
+
+ picture_t *picture = mpeg2dec->picture;
+
+ if( !picture )
+ return;
+
+ mpeg2dec->pts = 0;
+
+ if( !picture->mpeg1 )
+ mpeg2dec->is_sequence_needed = 1;
+
+ mpeg2dec->in_slice = 0;
+
+ /* to free reference frames one also needs to fix slice.c to
+ * abort when they are NULL. unfortunately it seems to break
+ * DVD menus.
+ */
+ /*
+ if ( picture->current_frame &&
+ picture->current_frame != picture->backward_reference_frame &&
+ picture->current_frame != picture->forward_reference_frame )
+ picture->current_frame->free (picture->current_frame);
+ picture->current_frame = NULL;
+
+ 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;
+ */
+}
+
void mpeg2_flush (mpeg2dec_t * mpeg2dec) {
picture_t *picture = mpeg2dec->picture;
diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h
index 77a96965f..a3994930e 100644
--- a/src/libmpeg2/mpeg2.h
+++ b/src/libmpeg2/mpeg2.h
@@ -64,6 +64,7 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec,
uint8_t * data_start, uint8_t * data_end);
void mpeg2_flush (mpeg2dec_t * mpeg2dec);
+void mpeg2_reset (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/slice.c b/src/libmpeg2/slice.c
index 555b10782..07f92ea10 100644
--- a/src/libmpeg2/slice.c
+++ b/src/libmpeg2/slice.c
@@ -1452,6 +1452,7 @@ static inline int slice_init (picture_t * picture, int code)
forward_reference_frame = picture->forward_reference_frame;
}
else {
+ /* return 1; */
forward_reference_frame = picture->current_frame;
}
@@ -1459,6 +1460,7 @@ static inline int slice_init (picture_t * picture, int code)
backward_reference_frame = picture->backward_reference_frame;
}
else {
+ /* return 1; */
backward_reference_frame = picture->current_frame;
}
diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c
index 56af6324b..3543ce6e2 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.26 2002/04/04 00:08:36 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.27 2002/04/09 03:38:00 miguelfreitas Exp $
*
* stuff needed to turn libmpeg2 into a xine decoder plugin
*/
@@ -109,6 +109,17 @@ static void mpeg2dec_flush (video_decoder_t *this_gen) {
pthread_mutex_unlock (&this->lock);
}
+static void mpeg2dec_reset (video_decoder_t *this_gen) {
+ mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen;
+
+ pthread_mutex_lock (&this->lock);
+
+ mpeg2_reset (&this->mpeg2);
+
+ pthread_mutex_unlock (&this->lock);
+}
+
+
static void mpeg2dec_close (video_decoder_t *this_gen) {
mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen;
@@ -134,7 +145,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) {
mpeg2dec_decoder_t *this ;
- if (iface_version != 5) {
+ if (iface_version != 6) {
printf( "libmpeg2: plugin doesn't support plugin API version %d.\n"
"libmpeg2: this means there's a version mismatch between xine and this "
"libmpeg2: decoder plugin.\nInstalling current plugins should help.\n",
@@ -150,6 +161,7 @@ video_decoder_t *init_video_decoder_plugin (int iface_version, xine_t *xine) {
this->video_decoder.init = mpeg2dec_init;
this->video_decoder.decode_data = mpeg2dec_decode_data;
this->video_decoder.flush = mpeg2dec_flush;
+ this->video_decoder.reset = mpeg2dec_reset;
this->video_decoder.close = mpeg2dec_close;
this->video_decoder.get_identifier = mpeg2dec_get_id;
this->video_decoder.priority = 5;