vdpaumpegdec: handle broken_gop field

This commit is contained in:
Carl-Anton Ingmarsson 2009-04-22 23:35:07 +02:00 committed by Jan Schmidt
parent 17102ad0fa
commit 035b5f4efb
4 changed files with 22 additions and 11 deletions

View file

@ -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);

View file

@ -49,6 +49,8 @@ struct _GstVdpMpegDecoder
/* holds B_FRAMES */
GSList *b_frames;
gboolean broken_gop;
GstAdapter *adapter;
};

View file

@ -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;
}

View file

@ -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