mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 21:51:09 +00:00
vdpaumpegdec: handle broken_gop field
This commit is contained in:
parent
17102ad0fa
commit
035b5f4efb
4 changed files with 22 additions and 11 deletions
|
@ -158,6 +158,12 @@ gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
|
||||||
if (mpeg_dec->vdp_info.picture_coding_type == B_FRAME) {
|
if (mpeg_dec->vdp_info.picture_coding_type == B_FRAME) {
|
||||||
GstVdpBFrame *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 = g_slice_new (GstVdpBFrame);
|
||||||
|
|
||||||
b_frame->buffer = buffer;
|
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))
|
if (!mpeg_util_parse_picture_gop (&gop, data, end))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
mpeg_dec->broken_gop = gop.broken_gop;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,6 +505,8 @@ gst_vdp_mpeg_decoder_init (GstVdpMpegDecoder * mpeg_dec,
|
||||||
|
|
||||||
mpeg_dec->b_frames = NULL;
|
mpeg_dec->b_frames = NULL;
|
||||||
|
|
||||||
|
mpeg_dec->broken_gop = FALSE;
|
||||||
|
|
||||||
mpeg_dec->adapter = gst_adapter_new ();
|
mpeg_dec->adapter = gst_adapter_new ();
|
||||||
|
|
||||||
gst_pad_set_chain_function (dec->sink, gst_vdp_mpeg_decoder_chain);
|
gst_pad_set_chain_function (dec->sink, gst_vdp_mpeg_decoder_chain);
|
||||||
|
|
|
@ -50,6 +50,8 @@ struct _GstVdpMpegDecoder
|
||||||
/* holds B_FRAMES */
|
/* holds B_FRAMES */
|
||||||
GSList *b_frames;
|
GSList *b_frames;
|
||||||
|
|
||||||
|
gboolean broken_gop;
|
||||||
|
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -348,7 +348,6 @@ gboolean
|
||||||
mpeg_util_parse_picture_gop (MPEGPictureGOP * gop, guint8 * data, guint8 * end)
|
mpeg_util_parse_picture_gop (MPEGPictureGOP * gop, guint8 * data, guint8 * end)
|
||||||
{
|
{
|
||||||
guint32 code;
|
guint32 code;
|
||||||
gint hour, minute, second;
|
|
||||||
|
|
||||||
if (G_UNLIKELY ((end - data) < 8))
|
if (G_UNLIKELY ((end - data) < 8))
|
||||||
return FALSE; /* Packet too small */
|
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);
|
gop->drop_frame_flag = read_bits (data, 0, 1);
|
||||||
|
|
||||||
hour = read_bits (data, 1, 5);
|
gop->hour = read_bits (data, 1, 5);
|
||||||
minute = read_bits (data, 6, 6);
|
gop->minute = read_bits (data, 6, 6);
|
||||||
second = read_bits (data + 1, 4, 6);
|
gop->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->frame = read_bits (data + 2, 3, 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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,11 @@ struct MPEGPictureExt
|
||||||
struct MPEGPictureGOP
|
struct MPEGPictureGOP
|
||||||
{
|
{
|
||||||
guint8 drop_frame_flag;
|
guint8 drop_frame_flag;
|
||||||
guint8 frame;
|
|
||||||
|
|
||||||
GstClockTime timestamp;
|
guint8 hour, minute, second, frame;
|
||||||
|
|
||||||
|
guint8 closed_gop;
|
||||||
|
guint8 broken_gop;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MPEGQuantMatrix
|
struct MPEGQuantMatrix
|
||||||
|
|
Loading…
Reference in a new issue