mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
va: h264dec: set video alignment definition earlier
This patch renames need_cropping variable to need_videoalign which is clearer with its function. And now GstVideoAlignment is part of GstVaH264Dec structure, so it can be set earlier. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
This commit is contained in:
parent
8a0d1d85cf
commit
a0ba72ed50
1 changed files with 15 additions and 9 deletions
|
@ -102,8 +102,10 @@ struct _GstVaH264Dec
|
||||||
guint rt_format;
|
guint rt_format;
|
||||||
gint dpb_size;
|
gint dpb_size;
|
||||||
|
|
||||||
|
gboolean need_videoalign;
|
||||||
|
GstVideoAlignment valign;
|
||||||
|
|
||||||
gboolean need_negotiation;
|
gboolean need_negotiation;
|
||||||
gboolean need_cropping;
|
|
||||||
gboolean has_videometa;
|
gboolean has_videometa;
|
||||||
gboolean copy_frames;
|
gboolean copy_frames;
|
||||||
};
|
};
|
||||||
|
@ -734,8 +736,16 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
|
||||||
self->display_height);
|
self->display_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->need_cropping = self->display_width < self->coded_width
|
self->need_videoalign = self->display_width < self->coded_width
|
||||||
|| self->display_height < self->coded_height;
|
|| self->display_height < self->coded_height;
|
||||||
|
if (self->need_videoalign) {
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
self->valign = (GstVideoAlignment) {
|
||||||
|
.padding_bottom = self->coded_height - self->display_height,
|
||||||
|
.padding_left = self->coded_width - self->display_width,
|
||||||
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
}
|
||||||
|
|
||||||
if (negotiation_needed) {
|
if (negotiation_needed) {
|
||||||
self->need_negotiation = TRUE;
|
self->need_negotiation = TRUE;
|
||||||
|
@ -1132,7 +1142,7 @@ gst_va_h264_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
has_videoalignment = gst_buffer_pool_has_option (pool,
|
has_videoalignment = gst_buffer_pool_has_option (pool,
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
|
||||||
if (!self->has_videometa || (!has_videoalignment
|
if (!self->has_videometa || (!has_videoalignment
|
||||||
&& self->need_cropping)) {
|
&& self->need_videoalign)) {
|
||||||
GST_DEBUG_OBJECT (self,
|
GST_DEBUG_OBJECT (self,
|
||||||
"keeping other pool for copy %" GST_PTR_FORMAT, pool);
|
"keeping other pool for copy %" GST_PTR_FORMAT, pool);
|
||||||
gst_object_replace ((GstObject **) & self->other_pool,
|
gst_object_replace ((GstObject **) & self->other_pool,
|
||||||
|
@ -1185,14 +1195,10 @@ gst_va_h264_dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
gst_buffer_pool_config_add_option (config,
|
gst_buffer_pool_config_add_option (config,
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||||
|
|
||||||
if (self->need_cropping) {
|
if (self->need_videoalign) {
|
||||||
GstVideoAlignment video_align = {
|
|
||||||
.padding_bottom = self->coded_height - self->display_height,
|
|
||||||
.padding_left = self->coded_width - self->display_width,
|
|
||||||
};
|
|
||||||
gst_buffer_pool_config_add_option (config,
|
gst_buffer_pool_config_add_option (config,
|
||||||
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
|
||||||
gst_buffer_pool_config_set_video_alignment (config, &video_align);
|
gst_buffer_pool_config_set_video_alignment (config, &self->valign);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_pool_config_set_va_allocation_params (config,
|
gst_buffer_pool_config_set_va_allocation_params (config,
|
||||||
|
|
Loading…
Reference in a new issue