return NULL;
}
-static void
-gst_msdkav1enc_set_timestamp (GstMsdkEnc * encoder, mfxU64 timestamp)
-{
- GstMsdkAV1Enc *thiz = GST_MSDKAV1ENC (encoder);
-
- g_queue_push_tail (thiz->timestamp, (gpointer) timestamp);
-}
-
-static mfxU64
-gst_msdkav1enc_get_timestamp (GstMsdkEnc * encoder)
-{
- GstMsdkAV1Enc *thiz = GST_MSDKAV1ENC (encoder);
- mfxU64 pts;
-
- pts = (mfxU64) g_queue_pop_head (thiz->timestamp);
- return pts;
-}
-
static gint
gst_msdkav1enc_find_show_frame (GstMsdkAV1Enc * thiz, guint8 * data, gsize size,
gsize * offset)
{
GstVideoCodecFrame *frame;
GstBuffer *out_buf = NULL;
- mfxU64 pts;
while (1) {
if (!gst_msdkav1enc_pre_finish (encoder, &out_buf, NULL, 0))
break;
frame = gst_video_encoder_get_oldest_frame (GST_VIDEO_ENCODER (encoder));
frame->output_buffer = out_buf;
- pts = gst_msdkav1enc_get_timestamp (encoder);
- frame->pts = gst_util_uint64_scale (pts, GST_SECOND, 90000);
gst_video_codec_frame_unref (frame);
gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (encoder), frame);
}
encoder_class->qp_min = 0;
encoder_class->pre_finish = gst_msdkav1enc_pre_finish;
encoder_class->flush_frames = gst_msdkav1enc_flush_frames;
- encoder_class->set_timestamp = gst_msdkav1enc_set_timestamp;
- encoder_class->get_timestamp = gst_msdkav1enc_get_timestamp;
gst_msdkenc_install_common_properties (encoder_class);
thiz->p_pyramid = PROP_P_PYRAMID_DEFAULT;
thiz->adapter = gst_adapter_new ();
thiz->parser = gst_av1_parser_new ();
- thiz->timestamp = g_queue_new ();
}
GstMsdkEncClass *klass = GST_MSDKENC_GET_CLASS (thiz);
GstVideoCodecFrame *frame;
GList *list;
- mfxU64 pts;
if (!task->sync_point)
return GST_FLOW_OK;
}
frame->output_buffer = out_buf;
- /* This is a workaround for output pts, because oneVPL cannot return the
- * correct pts for each display frame. We just use the input frame's pts
- * as output ones as oneVPL return each coded frames as display.
- */
- if (klass->get_timestamp) {
- pts = klass->get_timestamp (thiz);
- frame->pts = gst_util_uint64_scale (pts, GST_SECOND, 90000);
- } else {
- frame->pts =
- gst_util_uint64_scale (task->output_bitstream.TimeStamp, GST_SECOND,
- 90000);
- }
+ frame->pts =
+ gst_util_uint64_scale (task->output_bitstream.TimeStamp, GST_SECOND,
+ 90000);
frame->dts =
gst_util_uint64_scale (task->output_bitstream.DecodeTimeStamp,
GST_SECOND, 90000);
if (frame->pts != GST_CLOCK_TIME_NONE) {
surface->surface->Data.TimeStamp =
gst_util_uint64_scale (frame->pts, 90000, GST_SECOND);
-
- if (klass->set_timestamp)
- klass->set_timestamp (thiz, surface->surface->Data.TimeStamp);
} else {
surface->surface->Data.TimeStamp = MFX_TIMESTAMP_UNKNOWN;
}