summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--omx/gstomxvideo.c8
-rw-r--r--omx/gstomxvideoenc.c15
2 files changed, 16 insertions, 7 deletions
diff --git a/omx/gstomxvideo.c b/omx/gstomxvideo.c
index 8bbee9e..28d7bd1 100644
--- a/omx/gstomxvideo.c
+++ b/omx/gstomxvideo.c
@@ -238,7 +238,13 @@ gst_omx_video_calculate_framerate_q16 (GstVideoInfo * info)
{
g_assert (info);
- return gst_util_uint64_scale_int (1 << 16, info->fps_n, info->fps_d);
+ if (!info->fps_d)
+ return 0;
+
+ /* OMX API expects frame rate to actually be the field rate, so twice
+ * the frame rate in interlace mode. */
+ return gst_util_uint64_scale_int (1 << 16, GST_VIDEO_INFO_FIELD_RATE_N (info),
+ info->fps_d);
}
gboolean
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 99f5952..03a006e 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -2349,10 +2349,12 @@ gst_omx_video_enc_framerate_changed (GstOMXVideoEnc * self,
GST_OMX_INIT_STRUCT (&config);
config.nPortIndex = self->enc_in_port->index;
- if (klass->cdata.hacks & GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER)
- config.xEncodeFramerate = info->fps_n ? (info->fps_n) / (info->fps_d) : 0;
- else
+ if (klass->cdata.hacks & GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER) {
+ config.xEncodeFramerate =
+ info->fps_d ? GST_VIDEO_INFO_FIELD_RATE_N (info) / (info->fps_d) : 0;
+ } else {
config.xEncodeFramerate = gst_omx_video_calculate_framerate_q16 (info);
+ }
err = gst_omx_component_set_config (self->enc,
OMX_IndexConfigVideoFramerate, &config);
@@ -2456,12 +2458,13 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
port_def.format.video.nFrameWidth = info->width;
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 =
- info->fps_n ? (info->fps_n) / (info->fps_d) : 0;
- else
+ info->fps_d ? GST_VIDEO_INFO_FIELD_RATE_N (info) / (info->fps_d) : 0;
+ } else {
port_def.format.video.xFramerate =
gst_omx_video_calculate_framerate_q16 (info);
+ }
GST_DEBUG_OBJECT (self, "Setting inport port definition");
if (gst_omx_port_update_port_definition (self->enc_in_port,