gst_vdp_decoder_push_video_buffer (GstVdpDecoder * dec,
GstVdpVideoBuffer * buffer)
{
- GST_BUFFER_TIMESTAMP (buffer) =
- gst_util_uint64_scale_int (GST_SECOND * dec->frame_nr,
- dec->framerate_denominator, dec->framerate_numerator);
- GST_BUFFER_DURATION (buffer) =
- 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;
+ if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE) {
+ GST_BUFFER_TIMESTAMP (buffer) =
+ gst_util_uint64_scale_int (GST_SECOND * dec->frame_nr,
+ dec->framerate_denominator, dec->framerate_numerator);
+ }
gst_buffer_set_caps (GST_BUFFER (buffer), GST_PAD_CAPS (dec->src));
return gst_pad_push (dec->src, GST_BUFFER (buffer));
} GstVdpBFrame;
static GstFlowReturn
-gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec)
+gst_vdp_mpeg_decoder_decode (GstVdpMpegDecoder * mpeg_dec,
+ GstClockTime timestamp)
{
GstVdpDecoder *dec;
GstBuffer *buffer;
b_frame = g_slice_new (GstVdpBFrame);
+ GST_BUFFER_TIMESTAMP (buffer) = timestamp;
b_frame->buffer = buffer;
memcpy (&b_frame->vdp_info, &mpeg_dec->vdp_info,
sizeof (VdpPictureInfoMPEG1Or2));
outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
dec->width, dec->height);
+ GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
surface = outbuf->surface;
device = dec->device;
b_outbuf = gst_vdp_video_buffer_new (dec->device, VDP_CHROMA_TYPE_420,
dec->width, dec->height);
+ GST_BUFFER_TIMESTAMP (b_outbuf) = GST_BUFFER_TIMESTAMP (b_frame->buffer);
b_frame->vdp_info.backward_reference = surface;
vbit[0].struct_version = VDP_BITSTREAM_BUFFER_VERSION;
switch (data[0]) {
case 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);
break;
}
}
+ if (mpeg_dec->vdp_info.slice_count > 0)
+ ret = gst_vdp_mpeg_decoder_decode (mpeg_dec, GST_BUFFER_TIMESTAMP (buffer));
+
return ret;
}