From 4329821a0b7b162aeb7a14bdf8540edbc3613f89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 28 Jul 2011 12:58:25 +0200 Subject: [PATCH] omxvideoenc: Add support for forcing the next frame to be a keyframe --- omx/gstomxvideoenc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 8fbd65a..9466fa5 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -1160,6 +1160,21 @@ gst_omx_video_enc_handle_frame (GstBaseVideoEncoder * encoder, g_assert (acq_ret == GST_OMX_ACQUIRE_BUFFER_OK && buf != NULL); /* Now handle the frame */ + if (frame->force_keyframe) { + OMX_ERRORTYPE err; + OMX_CONFIG_INTRAREFRESHVOPTYPE config; + + GST_OMX_INIT_STRUCT (&config); + config.nPortIndex = self->out_port->index; + config.IntraRefreshVOP = OMX_TRUE; + + err = + gst_omx_component_set_config (self->component, + OMX_IndexConfigVideoIntraVOPRefresh, &config); + if (err != OMX_ErrorNone) + GST_ERROR_OBJECT (self, "Failed to force a keyframe: %s (0x%08x)", + gst_omx_error_to_string (err), err); + } /* Copy the buffer content in chunks of size as requested * by the port */ -- 2.7.4