mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
vdpaumpegdec: drop all frames before a GOP when we seek
This commit is contained in:
parent
aff91bb89a
commit
53a5272f73
2 changed files with 26 additions and 1 deletions
|
@ -499,6 +499,9 @@ gst_vdp_mpeg_dec_parse_sequence (GstVdpMpegDec * mpeg_dec, GstBuffer * buffer)
|
||||||
memcpy (&mpeg_dec->vdp_info.non_intra_quantizer_matrix,
|
memcpy (&mpeg_dec->vdp_info.non_intra_quantizer_matrix,
|
||||||
&hdr.non_intra_quantizer_matrix, 64);
|
&hdr.non_intra_quantizer_matrix, 64);
|
||||||
|
|
||||||
|
if (mpeg_dec->state == GST_VDP_MPEG_DEC_NEED_SEQUENCE)
|
||||||
|
mpeg_dec->state = GST_VDP_MPEG_DEC_NEED_DATA;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,6 +558,9 @@ gst_vdp_mpeg_dec_parse_gop (GstVdpMpegDec * mpeg_dec, GstBuffer * buffer)
|
||||||
gst_util_uint64_scale (time, mpeg_dec->fps_n,
|
gst_util_uint64_scale (time, mpeg_dec->fps_n,
|
||||||
mpeg_dec->fps_d * GST_SECOND) + gop.frame;
|
mpeg_dec->fps_d * GST_SECOND) + gop.frame;
|
||||||
|
|
||||||
|
if (mpeg_dec->state == GST_VDP_MPEG_DEC_NEED_GOP)
|
||||||
|
mpeg_dec->state = GST_VDP_MPEG_DEC_NEED_DATA;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,6 +607,8 @@ gst_vdp_mpeg_dec_reset (GstVdpMpegDec * mpeg_dec)
|
||||||
g_object_unref (mpeg_dec->device);
|
g_object_unref (mpeg_dec->device);
|
||||||
mpeg_dec->device = NULL;
|
mpeg_dec->device = NULL;
|
||||||
|
|
||||||
|
mpeg_dec->state = GST_VDP_MPEG_DEC_NEED_SEQUENCE;
|
||||||
|
|
||||||
gst_segment_init (&mpeg_dec->segment, GST_FORMAT_TIME);
|
gst_segment_init (&mpeg_dec->segment, GST_FORMAT_TIME);
|
||||||
mpeg_dec->seeking = FALSE;
|
mpeg_dec->seeking = FALSE;
|
||||||
|
|
||||||
|
@ -688,6 +696,12 @@ gst_vdp_mpeg_dec_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mpeg_dec->state == GST_VDP_MPEG_DEC_NEED_SEQUENCE ||
|
||||||
|
mpeg_dec->state == GST_VDP_MPEG_DEC_NEED_GOP) {
|
||||||
|
gst_adapter_clear (mpeg_dec->adapter);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (mpeg_dec->vdp_info.slice_count > 0)
|
if (mpeg_dec->vdp_info.slice_count > 0)
|
||||||
ret = gst_vdp_mpeg_dec_decode (mpeg_dec, GST_BUFFER_TIMESTAMP (buffer),
|
ret = gst_vdp_mpeg_dec_decode (mpeg_dec, GST_BUFFER_TIMESTAMP (buffer),
|
||||||
GST_BUFFER_SIZE (buffer));
|
GST_BUFFER_SIZE (buffer));
|
||||||
|
@ -843,8 +857,10 @@ normal_seek (GstVdpMpegDec * mpeg_dec, GstEvent * event)
|
||||||
/* do the seek */
|
/* do the seek */
|
||||||
res = gst_pad_push_event (mpeg_dec->sink, peer_event);
|
res = gst_pad_push_event (mpeg_dec->sink, peer_event);
|
||||||
|
|
||||||
if (res)
|
if (res) {
|
||||||
|
mpeg_dec->state = GST_VDP_MPEG_DEC_NEED_GOP;
|
||||||
mpeg_dec->seeking = TRUE;
|
mpeg_dec->seeking = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
g_mutex_unlock (mpeg_dec->mutex);
|
g_mutex_unlock (mpeg_dec->mutex);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,12 @@ G_BEGIN_DECLS
|
||||||
#define GST_IS_VDP_MPEG_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDP_MPEG_DEC))
|
#define GST_IS_VDP_MPEG_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDP_MPEG_DEC))
|
||||||
#define GST_IS_VDP_MPEG_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDP_MPEG_DEC))
|
#define GST_IS_VDP_MPEG_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDP_MPEG_DEC))
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GST_VDP_MPEG_DEC_NEED_SEQUENCE,
|
||||||
|
GST_VDP_MPEG_DEC_NEED_GOP,
|
||||||
|
GST_VDP_MPEG_DEC_NEED_DATA
|
||||||
|
} GstVdpMpegDecState;
|
||||||
|
|
||||||
typedef struct _GstVdpMpegDec GstVdpMpegDec;
|
typedef struct _GstVdpMpegDec GstVdpMpegDec;
|
||||||
typedef struct _GstVdpMpegDecClass GstVdpMpegDecClass;
|
typedef struct _GstVdpMpegDecClass GstVdpMpegDecClass;
|
||||||
|
|
||||||
|
@ -56,6 +62,9 @@ struct _GstVdpMpegDec
|
||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
gint version;
|
gint version;
|
||||||
|
|
||||||
|
/* decoder state */
|
||||||
|
GstVdpMpegDecState state;
|
||||||
|
|
||||||
/* currently decoded frame info */
|
/* currently decoded frame info */
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
VdpPictureInfoMPEG1Or2 vdp_info;
|
VdpPictureInfoMPEG1Or2 vdp_info;
|
||||||
|
|
Loading…
Reference in a new issue