v4l2codecs: dec: Move copy_frames logic inside decide_allocation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9305>
This commit is contained in:
parent
de1166338c
commit
c7b0b9a816
@ -433,6 +433,28 @@ gst_v4l2_codec_av1_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->render_width,
|
||||
self->render_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -1166,28 +1188,6 @@ gst_v4l2_codec_av1_dec_new_picture (GstAV1Decoder * decoder,
|
||||
GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->render_width,
|
||||
self->render_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -479,6 +479,28 @@ gst_v4l2_codec_h264_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width,
|
||||
self->display_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -968,28 +990,6 @@ gst_v4l2_codec_h264_dec_new_sequence (GstH264Decoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width,
|
||||
self->display_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -507,6 +507,28 @@ gst_v4l2_codec_h265_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width,
|
||||
self->display_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = self->need_crop;
|
||||
}
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -993,28 +1015,6 @@ gst_v4l2_codec_h265_dec_new_sequence (GstH265Decoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->display_width,
|
||||
self->display_height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = self->need_crop;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -401,6 +401,28 @@ gst_v4l2_codec_mpeg2_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -529,28 +551,6 @@ gst_v4l2_codec_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder,
|
||||
self->need_quantiser = TRUE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -360,6 +360,30 @@ gst_v4l2_codec_vp8_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -563,28 +587,6 @@ gst_v4l2_codec_vp8_dec_new_sequence (GstVp8Decoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -630,6 +630,28 @@ gst_v4l2_codec_vp9_dec_decide_allocation (GstVideoDecoder * decoder,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||
gst_query_parse_nth_allocation_pool (query, 0, NULL, NULL, &min, NULL);
|
||||
|
||||
@ -775,28 +797,6 @@ gst_v4l2_codec_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can zero-copy buffers */
|
||||
if (!self->has_videometa) {
|
||||
GstVideoInfo ref_vinfo;
|
||||
gint i;
|
||||
|
||||
gst_video_info_set_format (&ref_vinfo,
|
||||
GST_VIDEO_INFO_FORMAT (&self->vinfo_drm.vinfo), self->width,
|
||||
self->height);
|
||||
|
||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&self->vinfo_drm.vinfo); i++) {
|
||||
if (self->vinfo_drm.vinfo.stride[i] != ref_vinfo.stride[i] ||
|
||||
self->vinfo_drm.vinfo.offset[i] != ref_vinfo.offset[i]) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"GstVideoMeta support required, copying frames.");
|
||||
self->copy_frames = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->copy_frames = FALSE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user