diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-02-06 09:36:20 +0530 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-02-27 04:05:48 +0000 |
commit | f14f5d9f70e97b359b52bca2d272af517268fc1b (patch) | |
tree | 152e81c0d61a621ad6e82c21be9019ed28c2c533 | |
parent | 27c1aa544e66c45ae34948638be47f9a7909e934 (diff) | |
download | gst-omx-f14f5d9f70e97b359b52bca2d272af517268fc1b.tar.gz |
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.
-rw-r--r-- | omx/gstomxvideodec.c | 24 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 7 |
2 files changed, 17 insertions, 14 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 5f7370f..d5612ab 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -539,11 +539,12 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self, GstVideoFrame frame; 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", (guint) port_def->format.video.nFrameWidth, (guint) port_def->format.video.nFrameHeight, - vinfo->width, vinfo->height); + vinfo->width, GST_VIDEO_INFO_FIELD_HEIGHT (vinfo)); goto done; } @@ -572,7 +573,7 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self, guint src_size[GST_VIDEO_MAX_PLANES] = { nstride * nslice, 0, }; gint dst_width[GST_VIDEO_MAX_PLANES] = { 0, }; gint dst_height[GST_VIDEO_MAX_PLANES] = - { GST_VIDEO_INFO_HEIGHT (vinfo), 0, }; + { GST_VIDEO_INFO_FIELD_HEIGHT (vinfo), 0, }; const guint8 *src; guint p; @@ -596,25 +597,25 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self, src_stride[1] = nstride / 2; src_size[1] = (src_stride[1] * nslice) / 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_size[2] = (src_stride[1] * nslice) / 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; case GST_VIDEO_FORMAT_NV12: dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo); src_stride[1] = nstride; src_size[1] = src_stride[1] * nslice / 2; 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; case GST_VIDEO_FORMAT_NV16: dst_width[0] = GST_VIDEO_INFO_WIDTH (vinfo); src_stride[1] = nstride; src_size[1] = src_stride[1] * nslice; 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; case GST_VIDEO_FORMAT_NV12_10LE32: /* 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]; src_stride[1] = nstride; 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; case GST_VIDEO_FORMAT_NV16_10LE32: /* 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]; src_stride[1] = nstride; 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; default: 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. */ 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 && info->fps_n != 0) || !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.nFrameHeight = info->height; + port_def.format.video.nFrameHeight = GST_VIDEO_INFO_FIELD_HEIGHT (info); port_def.format.video.xFramerate = framerate_q16; if (klass->cdata.hacks & GST_OMX_HACK_PASS_COLOR_FORMAT_TO_DECODER) { diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 7576286..99f5952 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -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"); stride = info->stride[0]; - slice_height = info->height; + slice_height = GST_VIDEO_INFO_FIELD_HEIGHT (info); } 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.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)) 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]; 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"); goto done; } |