mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 08:42:32 +00:00
vaapipostproc: change how the metadata is copied
Instead of copying the metada in prepare_output_buffer() vmethod, it is done in append_output_buffer_metadata() thus deinterlaced buffers could also have the proper metas. GstVideoCropMeta now it is copied internally and it is decided via transform_meta() vmethod. A new internal method, copy_metadata() was added to handle VPP transformation where non-GstVideoVaapiMeta metas were lost.
This commit is contained in:
parent
fde55003ca
commit
940afd2900
1 changed files with 26 additions and 19 deletions
|
@ -402,6 +402,24 @@ create_output_dump_buffer (GstVaapiPostproc * postproc)
|
||||||
&plugin->other_allocator_params);
|
&plugin->other_allocator_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
copy_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf,
|
||||||
|
GstBuffer * inbuf)
|
||||||
|
{
|
||||||
|
GstBaseTransformClass *bclass = GST_BASE_TRANSFORM_GET_CLASS (postproc);
|
||||||
|
GstBaseTransform *trans = GST_BASE_TRANSFORM (postproc);
|
||||||
|
|
||||||
|
if (inbuf == outbuf)
|
||||||
|
return;
|
||||||
|
if (!bclass->copy_metadata)
|
||||||
|
return;
|
||||||
|
if (!bclass->copy_metadata (trans, inbuf, outbuf)) {
|
||||||
|
/* something failed, post a warning */
|
||||||
|
GST_ELEMENT_WARNING (trans, STREAM, NOT_IMPLEMENTED,
|
||||||
|
("could not copy metadata"), (NULL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
append_output_buffer_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf,
|
append_output_buffer_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf,
|
||||||
GstBuffer * inbuf, guint flags)
|
GstBuffer * inbuf, guint flags)
|
||||||
|
@ -411,16 +429,7 @@ append_output_buffer_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf,
|
||||||
|
|
||||||
gst_buffer_copy_into (outbuf, inbuf, flags | GST_BUFFER_COPY_FLAGS, 0, -1);
|
gst_buffer_copy_into (outbuf, inbuf, flags | GST_BUFFER_COPY_FLAGS, 0, -1);
|
||||||
|
|
||||||
/* GstVideoCropMeta */
|
copy_metadata (postproc, outbuf, inbuf);
|
||||||
if (!postproc->use_vpp) {
|
|
||||||
GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (inbuf);
|
|
||||||
if (crop_meta) {
|
|
||||||
GstVideoCropMeta *const out_crop_meta =
|
|
||||||
gst_buffer_add_video_crop_meta (outbuf);
|
|
||||||
if (out_crop_meta)
|
|
||||||
*out_crop_meta = *crop_meta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GstVaapiVideoMeta */
|
/* GstVaapiVideoMeta */
|
||||||
inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf);
|
inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf);
|
||||||
|
@ -755,6 +764,7 @@ gst_vaapipostproc_process_vpp (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
if (status != GST_VAAPI_FILTER_STATUS_SUCCESS)
|
if (status != GST_VAAPI_FILTER_STATUS_SUCCESS)
|
||||||
goto error_process_vpp;
|
goto error_process_vpp;
|
||||||
|
|
||||||
|
copy_metadata (postproc, fieldbuf, inbuf);
|
||||||
GST_BUFFER_TIMESTAMP (fieldbuf) = timestamp;
|
GST_BUFFER_TIMESTAMP (fieldbuf) = timestamp;
|
||||||
GST_BUFFER_DURATION (fieldbuf) = postproc->field_duration;
|
GST_BUFFER_DURATION (fieldbuf) = postproc->field_duration;
|
||||||
if (discont) {
|
if (discont) {
|
||||||
|
@ -820,6 +830,7 @@ gst_vaapipostproc_process_vpp (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
discont = FALSE;
|
discont = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
copy_metadata (postproc, outbuf, inbuf);
|
||||||
|
|
||||||
if (deint && deint_refs)
|
if (deint && deint_refs)
|
||||||
ds_add_buffer (ds, inbuf);
|
ds_add_buffer (ds, inbuf);
|
||||||
|
@ -1264,6 +1275,11 @@ static gboolean
|
||||||
gst_vaapipostproc_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf,
|
gst_vaapipostproc_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf,
|
||||||
GstMeta * meta, GstBuffer * inbuf)
|
GstMeta * meta, GstBuffer * inbuf)
|
||||||
{
|
{
|
||||||
|
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
||||||
|
|
||||||
|
/* dont' GstVideoCropMeta if use_vpp */
|
||||||
|
if (meta->info->api == GST_VIDEO_CROP_META_API_TYPE && postproc->use_vpp)
|
||||||
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1348,6 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
GstBuffer * inbuf, GstBuffer ** outbuf_ptr)
|
GstBuffer * inbuf, GstBuffer ** outbuf_ptr)
|
||||||
{
|
{
|
||||||
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans);
|
||||||
GstBaseTransformClass *bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
|
||||||
|
|
||||||
if (gst_base_transform_is_passthrough (trans)) {
|
if (gst_base_transform_is_passthrough (trans)) {
|
||||||
*outbuf_ptr = inbuf;
|
*outbuf_ptr = inbuf;
|
||||||
|
@ -1348,14 +1363,6 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
if (!*outbuf_ptr)
|
if (!*outbuf_ptr)
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
|
||||||
if (inbuf != *outbuf_ptr && bclass->copy_metadata) {
|
|
||||||
if (!bclass->copy_metadata (trans, inbuf, *outbuf_ptr)) {
|
|
||||||
/* something failed, post a warning */
|
|
||||||
GST_ELEMENT_WARNING (trans, STREAM, NOT_IMPLEMENTED,
|
|
||||||
("could not copy metadata"), (NULL));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue