} G_STMT_END
#endif
+/* If set on an element property means "use the OMX default value".
+ * If set on a default_* variable means that the default values hasn't been
+ * retrieved from OMX yet. */
+#define GST_OMX_PROP_OMX_DEFAULT G_MAXUINT32
+
/* OMX_StateInvalid does not exist in 1.2.0 spec. The initial state is now
* StateLoaded. Problem is that gst-omx still needs an initial state different
* than StateLoaded. Otherwise gst_omx_component_set_state(StateLoaded) will
self->default_roi_quality = GST_OMX_VIDEO_ENC_DEFAULT_ROI_QUALITY;
#endif
+ self->default_target_bitrate = GST_OMX_PROP_OMX_DEFAULT;
+
g_mutex_init (&self->drain_lock);
g_cond_init (&self->drain_cond);
gboolean result = TRUE;
GST_OBJECT_LOCK (self);
- if (self->control_rate == 0xffffffff && self->target_bitrate == 0xffffffff)
- /* Keep defaults, nothing to do */
- goto out;
GST_OMX_INIT_STRUCT (&bitrate_param);
bitrate_param.nPortIndex = self->enc_out_port->index;
bitrate_param.nPortIndex = self->enc_out_port->index;
}
#endif
+ if (self->default_target_bitrate == GST_OMX_PROP_OMX_DEFAULT)
+ /* Save the actual OMX default so we can restore it if needed */
+ self->default_target_bitrate = bitrate_param.nTargetBitrate;
+
if (self->control_rate != 0xffffffff)
bitrate_param.eControlRate = self->control_rate;
if (self->target_bitrate != 0xffffffff)
bitrate_param.nTargetBitrate = self->target_bitrate;
+ else
+ bitrate_param.nTargetBitrate = self->default_target_bitrate;
err =
gst_omx_component_set_parameter (self->enc,
gst_omx_error_to_string (err), err);
}
-out:
GST_OBJECT_UNLOCK (self);
return result;
}
g_cond_broadcast (&self->drain_cond);
g_mutex_unlock (&self->drain_lock);
+ self->default_target_bitrate = GST_OMX_PROP_OMX_DEFAULT;
+
gst_omx_component_get_state (self->enc, 5 * GST_SECOND);
return TRUE;