From 035b5f4efb4d57fccf2a5fa220c0d034f4d777a3 Mon Sep 17 00:00:00 2001 From: Carl-Anton Ingmarsson Date: Wed, 22 Apr 2009 23:35:07 +0200 Subject: vdpaumpegdec: handle broken_gop field --- sys/vdpau/gstvdpmpegdecoder.c | 10 ++++++++++ sys/vdpau/gstvdpmpegdecoder.h | 2 ++ sys/vdpau/mpegutil.c | 15 ++++++--------- sys/vdpau/mpegutil.h | 6 ++++-- 4 files changed, 22 insertions(+), 11 deletions(-) (limited to 'sys/vdpau') diff --git a/sys/vdpau/gstvdpmpegdecoder.c b/sys/vdpau/gstvdpmpegdecoder.c index 978d0497..d9b74706 100644 --- a/sys/vdpau/gstvdpmpegdecoder.c +++ b/sys/vdpau/gstvdpmpegdecoder.c @@ -158,6 +158,12 @@ gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec) if (mpeg_dec->vdp_info.picture_coding_type == B_FRAME) { GstVdpBFrame *b_frame; + if (mpeg_dec->broken_gop) { + gst_buffer_unref (buffer); + mpeg_dec->broken_gop = FALSE; + return GST_FLOW_OK; + } + b_frame = g_slice_new (GstVdpBFrame); b_frame->buffer = buffer; @@ -336,6 +342,8 @@ gst_vdp_mpeg_decoder_parse_gop (GstVdpMpegDecoder * mpeg_dec, guint8 * data, if (!mpeg_util_parse_picture_gop (&gop, data, end)) return FALSE; + mpeg_dec->broken_gop = gop.broken_gop; + return TRUE; } @@ -497,6 +505,8 @@ gst_vdp_mpeg_decoder_init (GstVdpMpegDecoder * mpeg_dec, mpeg_dec->b_frames = NULL; + mpeg_dec->broken_gop = FALSE; + mpeg_dec->adapter = gst_adapter_new (); gst_pad_set_chain_function (dec->sink, gst_vdp_mpeg_decoder_chain); diff --git a/sys/vdpau/gstvdpmpegdecoder.h b/sys/vdpau/gstvdpmpegdecoder.h index a03c17c2..aac79f31 100644 --- a/sys/vdpau/gstvdpmpegdecoder.h +++ b/sys/vdpau/gstvdpmpegdecoder.h @@ -49,6 +49,8 @@ struct _GstVdpMpegDecoder /* holds B_FRAMES */ GSList *b_frames; + + gboolean broken_gop; GstAdapter *adapter; }; diff --git a/sys/vdpau/mpegutil.c b/sys/vdpau/mpegutil.c index a1323f68..6f59b841 100644 --- a/sys/vdpau/mpegutil.c +++ b/sys/vdpau/mpegutil.c @@ -348,7 +348,6 @@ gboolean mpeg_util_parse_picture_gop (MPEGPictureGOP * gop, guint8 * data, guint8 * end) { guint32 code; - gint hour, minute, second; if (G_UNLIKELY ((end - data) < 8)) return FALSE; /* Packet too small */ @@ -363,16 +362,14 @@ mpeg_util_parse_picture_gop (MPEGPictureGOP * gop, guint8 * data, guint8 * end) gop->drop_frame_flag = read_bits (data, 0, 1); - hour = read_bits (data, 1, 5); - minute = read_bits (data, 6, 6); - second = read_bits (data + 1, 4, 6); - - gop->timestamp = hour * 3600 * GST_SECOND; - gop->timestamp += minute * 60 * GST_SECOND; - gop->timestamp += second * GST_SECOND; - + gop->hour = read_bits (data, 1, 5); + gop->minute = read_bits (data, 6, 6); + gop->second = read_bits (data + 1, 4, 6); gop->frame = read_bits (data + 2, 3, 6); + gop->closed_gop = read_bits (data + 3, 1, 1); + gop->broken_gop = read_bits (data + 3, 2, 1); + return TRUE; } diff --git a/sys/vdpau/mpegutil.h b/sys/vdpau/mpegutil.h index 24a29a35..43f34a59 100644 --- a/sys/vdpau/mpegutil.h +++ b/sys/vdpau/mpegutil.h @@ -96,9 +96,11 @@ struct MPEGPictureExt struct MPEGPictureGOP { guint8 drop_frame_flag; - guint8 frame; - GstClockTime timestamp; + guint8 hour, minute, second, frame; + + guint8 closed_gop; + guint8 broken_gop; }; struct MPEGQuantMatrix -- cgit v1.2.1