vdpaumpegdec: fix so that the first frame in a raw mpegvideo stream get timestamp 0

This commit is contained in:
Carl-Anton Ingmarsson 2009-06-04 19:30:02 +02:00 committed by Jan Schmidt
parent 27606d4e10
commit aee1937579
2 changed files with 7 additions and 6 deletions

View file

@ -274,16 +274,17 @@ gst_vdp_mpeg_decoder_push_video_buffer (GstVdpMpegDecoder * mpeg_dec,
GstVdpVideoBuffer * buffer) GstVdpVideoBuffer * buffer)
{ {
if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE) { if (GST_BUFFER_TIMESTAMP (buffer) == GST_CLOCK_TIME_NONE) {
GST_BUFFER_TIMESTAMP (buffer) = mpeg_dec->time + GST_BUFFER_TIMESTAMP (buffer) = mpeg_dec->next_timestamp;
gst_util_uint64_scale_int (GST_SECOND,
mpeg_dec->fps_d, mpeg_dec->fps_n);
} }
mpeg_dec->next_timestamp = GST_BUFFER_TIMESTAMP (buffer) +
gst_util_uint64_scale_int (GST_SECOND, mpeg_dec->fps_d, mpeg_dec->fps_n);
gst_buffer_set_caps (GST_BUFFER (buffer), GST_PAD_CAPS (mpeg_dec->src)); gst_buffer_set_caps (GST_BUFFER (buffer), GST_PAD_CAPS (mpeg_dec->src));
GST_DEBUG_OBJECT (mpeg_dec, GST_DEBUG_OBJECT (mpeg_dec,
"Pushing buffer with timestamp: %" GST_TIME_FORMAT, "Pushing buffer with timestamp: %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
mpeg_dec->time = GST_BUFFER_TIMESTAMP (buffer);
return gst_pad_push (mpeg_dec->src, GST_BUFFER (buffer)); return gst_pad_push (mpeg_dec->src, GST_BUFFER (buffer));
} }
@ -717,7 +718,7 @@ gst_vdp_mpeg_decoder_init (GstVdpMpegDecoder * mpeg_dec,
gst_vdp_mpeg_decoder_init_info (&mpeg_dec->vdp_info); gst_vdp_mpeg_decoder_init_info (&mpeg_dec->vdp_info);
mpeg_dec->broken_gop = FALSE; mpeg_dec->broken_gop = FALSE;
mpeg_dec->time = 0; mpeg_dec->next_timestamp = 0;
mpeg_dec->adapter = gst_adapter_new (); mpeg_dec->adapter = gst_adapter_new ();
} }

View file

@ -60,7 +60,7 @@ struct _GstVdpMpegDecoder
GstBuffer *b_buffer; GstBuffer *b_buffer;
gboolean broken_gop; gboolean broken_gop;
GstClockTime time; GstClockTime next_timestamp;
GstAdapter *adapter; GstAdapter *adapter;
}; };