mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vdpaumpegdec: if available use incoming buffer timestamp as output timestamp
This commit is contained in:
parent
2d996a3ff4
commit
2eb479f825
2 changed files with 13 additions and 12 deletions
|
@ -64,15 +64,11 @@ GstFlowReturn
|
||||||
gst_vdp_decoder_push_video_buffer (GstVdpDecoder * dec,
|
gst_vdp_decoder_push_video_buffer (GstVdpDecoder * dec,
|
||||||
GstVdpVideoBuffer * buffer)
|
GstVdpVideoBuffer * buffer)
|
||||||
{
|
{
|
||||||
GST_BUFFER_TIMESTAMP (buffer) =
|
if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE) {
|
||||||
gst_util_uint64_scale_int (GST_SECOND * dec->frame_nr,
|
GST_BUFFER_TIMESTAMP (buffer) =
|
||||||
dec->framerate_denominator, dec->framerate_numerator);
|
gst_util_uint64_scale_int (GST_SECOND * dec->frame_nr,
|
||||||
GST_BUFFER_DURATION (buffer) =
|
dec->framerate_denominator, dec->framerate_numerator);
|
||||||
gst_util_uint64_scale_int (GST_SECOND, dec->framerate_denominator,
|
}
|
||||||
dec->framerate_numerator);
|
|
||||||
GST_BUFFER_OFFSET (buffer) = dec->frame_nr;
|
|
||||||
dec->frame_nr++;
|
|
||||||
GST_BUFFER_OFFSET_END (buffer) = dec->frame_nr;
|
|
||||||
gst_buffer_set_caps (GST_BUFFER (buffer), GST_PAD_CAPS (dec->src));
|
gst_buffer_set_caps (GST_BUFFER (buffer), GST_PAD_CAPS (dec->src));
|
||||||
|
|
||||||
return gst_pad_push (dec->src, GST_BUFFER (buffer));
|
return gst_pad_push (dec->src, GST_BUFFER (buffer));
|
||||||
|
|
|
@ -139,7 +139,8 @@ typedef struct
|
||||||
} GstVdpBFrame;
|
} GstVdpBFrame;
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
|
gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec,
|
||||||
|
GstClockTime timestamp)
|
||||||
{
|
{
|
||||||
GstVdpDecoder *dec;
|
GstVdpDecoder *dec;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
@ -167,6 +168,7 @@ gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
|
||||||
|
|
||||||
b_frame = g_slice_new (GstVdpBFrame);
|
b_frame = g_slice_new (GstVdpBFrame);
|
||||||
|
|
||||||
|
GST_BUFFER_TIMESTAMP (buffer) = timestamp;
|
||||||
b_frame->buffer = buffer;
|
b_frame->buffer = buffer;
|
||||||
memcpy (&b_frame->vdp_info, &mpeg_dec->vdp_info,
|
memcpy (&b_frame->vdp_info, &mpeg_dec->vdp_info,
|
||||||
sizeof (VdpPictureInfoMPEG1Or2));
|
sizeof (VdpPictureInfoMPEG1Or2));
|
||||||
|
@ -180,6 +182,7 @@ gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
|
||||||
|
|
||||||
outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
|
outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
|
||||||
dec->width, dec->height);
|
dec->width, dec->height);
|
||||||
|
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
||||||
surface = outbuf->surface;
|
surface = outbuf->surface;
|
||||||
|
|
||||||
device = dec->device;
|
device = dec->device;
|
||||||
|
@ -216,6 +219,7 @@ gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
|
||||||
|
|
||||||
b_outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
|
b_outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
|
||||||
dec->width, dec->height);
|
dec->width, dec->height);
|
||||||
|
GST_BUFFER_TIMESTAMP (b_outbuf) = GST_BUFFER_TIMESTAMP (b_frame->buffer);
|
||||||
|
|
||||||
b_frame->vdp_info.backward_reference = surface;
|
b_frame->vdp_info.backward_reference = surface;
|
||||||
vbit[0].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
|
vbit[0].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
|
||||||
|
@ -428,8 +432,6 @@ gst_vdp_mpeg_decoder_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
switch (data[0]) {
|
switch (data[0]) {
|
||||||
case MPEG_PACKET_PICTURE:
|
case MPEG_PACKET_PICTURE:
|
||||||
GST_DEBUG_OBJECT (mpeg_dec, "MPEG_PACKET_PICTURE");
|
GST_DEBUG_OBJECT (mpeg_dec, "MPEG_PACKET_PICTURE");
|
||||||
if (mpeg_dec->vdp_info.slice_count > 0)
|
|
||||||
ret = gst_vdp_mpeg_decoder_decode (mpeg_dec);
|
|
||||||
|
|
||||||
gst_vdp_mpeg_decoder_parse_picture (mpeg_dec, packet_start, packet_end);
|
gst_vdp_mpeg_decoder_parse_picture (mpeg_dec, packet_start, packet_end);
|
||||||
break;
|
break;
|
||||||
|
@ -464,6 +466,9 @@ gst_vdp_mpeg_decoder_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mpeg_dec->vdp_info.slice_count > 0)
|
||||||
|
ret = gst_vdp_mpeg_decoder_decode (mpeg_dec, GST_BUFFER_TIMESTAMP (buffer));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue