mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
omxvideo{enc,dec}: use GST_VIDEO_INFO_FIELD_HEIGHT()
Does not change anything for now but will be needed when we'll support interlace-mode=alternate as the fields will have half the frame height.
This commit is contained in:
parent
27c1aa544e
commit
f14f5d9f70
2 changed files with 17 additions and 14 deletions
|
@ -539,11 +539,12 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
|
||||||
GstVideoFrame frame;
|
GstVideoFrame frame;
|
||||||
|
|
||||||
if (vinfo->width != port_def->format.video.nFrameWidth ||
|
if (vinfo->width != port_def->format.video.nFrameWidth ||
|
||||||
vinfo->height != port_def->format.video.nFrameHeight) {
|
GST_VIDEO_INFO_FIELD_HEIGHT (vinfo) !=
|
||||||
|
port_def->format.video.nFrameHeight) {
|
||||||
GST_ERROR_OBJECT (self, "Resolution do not match: port=%ux%u vinfo=%dx%d",
|
GST_ERROR_OBJECT (self, "Resolution do not match: port=%ux%u vinfo=%dx%d",
|
||||||
(guint) port_def->format.video.nFrameWidth,
|
(guint) port_def->format.video.nFrameWidth,
|
||||||
(guint) port_def->format.video.nFrameHeight,
|
(guint) port_def->format.video.nFrameHeight,
|
||||||
vinfo->width, vinfo->height);
|
vinfo->width, GST_VIDEO_INFO_FIELD_HEIGHT (vinfo));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +573,7 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
|
||||||
guint src_size[GST_VIDEO_MAX_PLANES] = { nstride * nslice, 0, };
|
guint src_size[GST_VIDEO_MAX_PLANES] = { nstride * nslice, 0, };
|
||||||
gint dst_width[GST_VIDEO_MAX_PLANES] = { 0, };
|
gint dst_width[GST_VIDEO_MAX_PLANES] = { 0, };
|
||||||
gint dst_height[GST_VIDEO_MAX_PLANES] =
|
gint dst_height[GST_VIDEO_MAX_PLANES] =
|
||||||
{ GST_VIDEO_INFO_HEIGHT (vinfo), 0, };
|
{ GST_VIDEO_INFO_FIELD_HEIGHT (vinfo), 0, };
|
||||||
const guint8 *src;
|
const guint8 *src;
|
||||||
guint p;
|
guint p;
|
||||||
|
|
||||||
|
@ -596,25 +597,25 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
|
||||||
src_stride[1] = nstride / 2;
|
src_stride[1] = nstride / 2;
|
||||||
src_size[1] = (src_stride[1] * nslice) / 2;
|
src_size[1] = (src_stride[1] * nslice) / 2;
|
||||||
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo) / 2;
|
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo) / 2;
|
||||||
dst_height[1] = GST_VIDEO_INFO_HEIGHT (vinfo) / 2;
|
dst_height[1] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo) / 2;
|
||||||
src_stride[2] = nstride / 2;
|
src_stride[2] = nstride / 2;
|
||||||
src_size[2] = (src_stride[1] * nslice) / 2;
|
src_size[2] = (src_stride[1] * nslice) / 2;
|
||||||
dst_width[2] = GST_VIDEO_INFO_WIDTH (vinfo) / 2;
|
dst_width[2] = GST_VIDEO_INFO_WIDTH (vinfo) / 2;
|
||||||
dst_height[2] = GST_VIDEO_INFO_HEIGHT (vinfo) / 2;
|
dst_height[2] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo) / 2;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_NV12:
|
case GST_VIDEO_FORMAT_NV12:
|
||||||
dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo);
|
dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo);
|
||||||
src_stride[1] = nstride;
|
src_stride[1] = nstride;
|
||||||
src_size[1] = src_stride[1] * nslice / 2;
|
src_size[1] = src_stride[1] * nslice / 2;
|
||||||
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo);
|
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo);
|
||||||
dst_height[1] = GST_VIDEO_INFO_HEIGHT (vinfo) / 2;
|
dst_height[1] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo) / 2;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_NV16:
|
case GST_VIDEO_FORMAT_NV16:
|
||||||
dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo);
|
dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo);
|
||||||
src_stride[1] = nstride;
|
src_stride[1] = nstride;
|
||||||
src_size[1] = src_stride[1] * nslice;
|
src_size[1] = src_stride[1] * nslice;
|
||||||
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo);
|
dst_width[1] = GST_VIDEO_INFO_WIDTH (vinfo);
|
||||||
dst_height[1] = GST_VIDEO_INFO_HEIGHT (vinfo);
|
dst_height[1] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo);
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_NV12_10LE32:
|
case GST_VIDEO_FORMAT_NV12_10LE32:
|
||||||
/* Need ((width + 2) / 3) 32-bits words */
|
/* Need ((width + 2) / 3) 32-bits words */
|
||||||
|
@ -622,7 +623,7 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
|
||||||
dst_width[1] = dst_width[0];
|
dst_width[1] = dst_width[0];
|
||||||
src_stride[1] = nstride;
|
src_stride[1] = nstride;
|
||||||
src_size[1] = src_stride[1] * nslice / 2;
|
src_size[1] = src_stride[1] * nslice / 2;
|
||||||
dst_height[1] = GST_VIDEO_INFO_HEIGHT (vinfo) / 2;
|
dst_height[1] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo) / 2;
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_NV16_10LE32:
|
case GST_VIDEO_FORMAT_NV16_10LE32:
|
||||||
/* Need ((width + 2) / 3) 32-bits words */
|
/* Need ((width + 2) / 3) 32-bits words */
|
||||||
|
@ -630,7 +631,7 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
|
||||||
dst_width[1] = dst_width[0];
|
dst_width[1] = dst_width[0];
|
||||||
src_stride[1] = nstride;
|
src_stride[1] = nstride;
|
||||||
src_size[1] = src_stride[1] * nslice;
|
src_size[1] = src_stride[1] * nslice;
|
||||||
dst_height[1] = GST_VIDEO_INFO_HEIGHT (vinfo);
|
dst_height[1] = GST_VIDEO_INFO_FIELD_HEIGHT (vinfo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
@ -2559,7 +2560,8 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
|
||||||
* parts of the caps have changed or nothing at all.
|
* parts of the caps have changed or nothing at all.
|
||||||
*/
|
*/
|
||||||
is_format_change |= port_def.format.video.nFrameWidth != info->width;
|
is_format_change |= port_def.format.video.nFrameWidth != info->width;
|
||||||
is_format_change |= port_def.format.video.nFrameHeight != info->height;
|
is_format_change |=
|
||||||
|
port_def.format.video.nFrameHeight != GST_VIDEO_INFO_FIELD_HEIGHT (info);
|
||||||
is_format_change |= (port_def.format.video.xFramerate == 0
|
is_format_change |= (port_def.format.video.xFramerate == 0
|
||||||
&& info->fps_n != 0)
|
&& info->fps_n != 0)
|
||||||
|| !gst_omx_video_is_equal_framerate_q16 (port_def.format.
|
|| !gst_omx_video_is_equal_framerate_q16 (port_def.format.
|
||||||
|
@ -2596,7 +2598,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
port_def.format.video.nFrameWidth = info->width;
|
port_def.format.video.nFrameWidth = info->width;
|
||||||
port_def.format.video.nFrameHeight = info->height;
|
port_def.format.video.nFrameHeight = GST_VIDEO_INFO_FIELD_HEIGHT (info);
|
||||||
port_def.format.video.xFramerate = framerate_q16;
|
port_def.format.video.xFramerate = framerate_q16;
|
||||||
|
|
||||||
if (klass->cdata.hacks & GST_OMX_HACK_PASS_COLOR_FORMAT_TO_DECODER) {
|
if (klass->cdata.hacks & GST_OMX_HACK_PASS_COLOR_FORMAT_TO_DECODER) {
|
||||||
|
|
|
@ -1989,7 +1989,7 @@ gst_omx_video_enc_configure_input_buffer (GstOMXVideoEnc * self,
|
||||||
"input buffer doesn't provide video meta, can't adjust stride and slice height");
|
"input buffer doesn't provide video meta, can't adjust stride and slice height");
|
||||||
|
|
||||||
stride = info->stride[0];
|
stride = info->stride[0];
|
||||||
slice_height = info->height;
|
slice_height = GST_VIDEO_INFO_FIELD_HEIGHT (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port_def.nBufferAlignment)
|
if (port_def.nBufferAlignment)
|
||||||
|
@ -2454,7 +2454,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
port_def.format.video.nFrameWidth = info->width;
|
port_def.format.video.nFrameWidth = info->width;
|
||||||
port_def.format.video.nFrameHeight = info->height;
|
port_def.format.video.nFrameHeight = GST_VIDEO_INFO_FIELD_HEIGHT (info);
|
||||||
|
|
||||||
if (G_UNLIKELY (klass->cdata.hacks & GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER))
|
if (G_UNLIKELY (klass->cdata.hacks & GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER))
|
||||||
port_def.format.video.xFramerate =
|
port_def.format.video.xFramerate =
|
||||||
|
@ -2660,7 +2660,8 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
|
||||||
gint stride = meta ? meta->stride[0] : info->stride[0];
|
gint stride = meta ? meta->stride[0] : info->stride[0];
|
||||||
|
|
||||||
if (info->width != port_def->format.video.nFrameWidth ||
|
if (info->width != port_def->format.video.nFrameWidth ||
|
||||||
info->height != port_def->format.video.nFrameHeight) {
|
GST_VIDEO_INFO_FIELD_HEIGHT (info) !=
|
||||||
|
port_def->format.video.nFrameHeight) {
|
||||||
GST_ERROR_OBJECT (self, "Width or height do not match");
|
GST_ERROR_OBJECT (self, "Width or height do not match");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue