diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-02-22 02:07:29 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-02-22 02:07:29 +0100 |
commit | ca1c36a8b420b29c4726782f0514ddb92463c21d (patch) | |
tree | 5d228baec4f2ffa9018fa5107d5c86b920c2e9e6 /ext/x264/gstx264enc.c | |
parent | f9de30f9382f079c9832e7421941fdb987fa7dbe (diff) |
x264enc: handle pts and dts
Diffstat (limited to 'ext/x264/gstx264enc.c')
-rw-r--r-- | ext/x264/gstx264enc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index 5e0b73c1..688aefa9 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -1910,7 +1910,8 @@ gst_x264_enc_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) } pic_in.i_type = X264_TYPE_AUTO; - pic_in.i_pts = GST_BUFFER_TIMESTAMP (buf); + pic_in.i_dts = GST_BUFFER_DTS (buf); + pic_in.i_pts = GST_BUFFER_PTS (buf); ret = gst_x264_enc_encode_frame (encoder, &pic_in, &i_nal, TRUE); @@ -2078,12 +2079,15 @@ gst_x264_enc_encode_frame (GstX264Enc * encoder, x264_picture_t * pic_in, out_buf = gst_buffer_new_allocate (NULL, i_size, 0); gst_buffer_fill (out_buf, 0, data, i_size); - /* PTS */ - /* FIXME ??: maybe use DTS here, since: - * - it is so practiced by other encoders, - * - downstream (e.g. muxers) might not enjoy non-monotone timestamps, - * whereas a decoder can also deal with DTS */ - GST_BUFFER_TIMESTAMP (out_buf) = pic_out.i_pts; + g_print ("dts %" G_GINT64_FORMAT " pts %" G_GINT64_FORMAT, pic_out.i_dts, + pic_out.i_pts); + + if (pic_out.i_dts < 0) + GST_BUFFER_DTS (out_buf) = GST_CLOCK_TIME_NONE; + else + GST_BUFFER_DTS (out_buf) = pic_out.i_dts; + + GST_BUFFER_PTS (out_buf) = pic_out.i_pts; GST_BUFFER_DURATION (out_buf) = duration; #ifdef X264_INTRA_REFRESH |