From: Rob C. <ro...@ti...> - 2010-03-07 23:20:12
|
The helper functions consolidate error handling. --- omx/gstomx_aacdec.c | 2 +- omx/gstomx_aacenc.c | 14 ++++---- omx/gstomx_adpcmdec.c | 4 +- omx/gstomx_adpcmenc.c | 6 ++-- omx/gstomx_amrnbdec.c | 2 +- omx/gstomx_amrnbenc.c | 6 ++-- omx/gstomx_amrwbdec.c | 2 +- omx/gstomx_amrwbenc.c | 6 ++-- omx/gstomx_audiosink.c | 4 +- omx/gstomx_base_filter.c | 4 +- omx/gstomx_base_sink.c | 2 +- omx/gstomx_base_src.c | 2 +- omx/gstomx_base_videodec.c | 10 +++--- omx/gstomx_base_videoenc.c | 8 ++-- omx/gstomx_filereadersrc.c | 2 +- omx/gstomx_g711dec.c | 4 +- omx/gstomx_g711enc.c | 4 +- omx/gstomx_g729enc.c | 4 +- omx/gstomx_h263enc.c | 2 +- omx/gstomx_h264enc.c | 2 +- omx/gstomx_jpegenc.c | 12 ++++---- omx/gstomx_mp2dec.c | 2 +- omx/gstomx_mp3dec.c | 2 +- omx/gstomx_mpeg4enc.c | 2 +- omx/gstomx_util.c | 66 ++++++++++++++++++++++++++++++++++++++++++++ omx/gstomx_util.h | 4 ++ omx/gstomx_videosink.c | 12 ++++---- omx/gstomx_volume.c | 2 +- omx/gstomx_vorbisdec.c | 2 +- 29 files changed, 132 insertions(+), 62 deletions(-) diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c index b8f0fb2..782ec2f 100644 --- a/omx/gstomx_aacdec.c +++ b/omx/gstomx_aacdec.c @@ -144,7 +144,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c index 2eb0e96..fdcd7fc 100644 --- a/omx/gstomx_aacenc.c +++ b/omx/gstomx_aacenc.c @@ -304,12 +304,12 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nSamplingRate = rate; param.nChannels = channels; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } { @@ -349,7 +349,7 @@ omx_setup (GstOmxBaseFilter *omx_base) /* Output port configuration. */ { param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioAac, ¶m); GST_DEBUG_OBJECT (omx_base, "setting bitrate: %i", self->bitrate); param.nBitRate = self->bitrate; @@ -361,7 +361,7 @@ omx_setup (GstOmxBaseFilter *omx_base) self->output_format); param.eAACStreamFormat = self->output_format; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioAac, ¶m); } } @@ -373,7 +373,7 @@ omx_setup (GstOmxBaseFilter *omx_base) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; @@ -385,12 +385,12 @@ omx_setup (GstOmxBaseFilter *omx_base) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAac, ¶m); param.nSampleRate = rate; param.nChannels = channels; - OMX_SetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m); + g_omx_core_set_param (omx_base->gomx, OMX_IndexParamAudioAac, ¶m); } #endif diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c index 63151d9..8826387 100644 --- a/omx/gstomx_adpcmdec.c +++ b/omx/gstomx_adpcmdec.c @@ -126,11 +126,11 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nSamplingRate = rate; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } /* set caps on the srcpad */ diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c index fabb4bd..cf97200 100644 --- a/omx/gstomx_adpcmenc.c +++ b/omx/gstomx_adpcmenc.c @@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAdpcm, ¶m); rate = param.nSampleRate; } @@ -178,11 +178,11 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nSamplingRate = rate; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } /* set caps on the srcpad */ diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c index 6d0cbaf..600a513 100644 --- a/omx/gstomx_amrnbdec.c +++ b/omx/gstomx_amrnbdec.c @@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c index 5e1ccff..f6401d5 100644 --- a/omx/gstomx_amrnbenc.c +++ b/omx/gstomx_amrnbenc.c @@ -182,7 +182,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAmr, ¶m); channels = param.nChannels; } @@ -229,12 +229,12 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nSamplingRate = rate; param.nChannels = channels; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } return gst_pad_set_caps (pad, caps); diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c index cb41789..2e77188 100644 --- a/omx/gstomx_amrwbdec.c +++ b/omx/gstomx_amrwbdec.c @@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c index 352b93f..a4b93d8 100644 --- a/omx/gstomx_amrwbenc.c +++ b/omx/gstomx_amrwbenc.c @@ -182,7 +182,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAmr, ¶m); channels = param.nChannels; } @@ -229,12 +229,12 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nSamplingRate = rate; param.nChannels = channels; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } return gst_pad_set_caps (pad, caps); diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c index 5f63d4c..5a3e753 100644 --- a/omx/gstomx_audiosink.c +++ b/omx/gstomx_audiosink.c @@ -110,7 +110,7 @@ setcaps (GstBaseSink *gst_sink, G_OMX_INIT_PARAM (param); param.nPortIndex = self->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); param.nChannels = channels; param.eNumData = is_signed ? OMX_NumericalDataSigned : OMX_NumericalDataUnsigned; @@ -118,7 +118,7 @@ setcaps (GstBaseSink *gst_sink, param.nBitPerSample = width; param.nSamplingRate = rate; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } } diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c index 487e4ee..16730fa 100644 --- a/omx/gstomx_base_filter.c +++ b/omx/gstomx_base_filter.c @@ -60,14 +60,14 @@ setup_ports (GstOmxBaseFilter *self) /* Input port configuration. */ param.nPortIndex = self->in_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); g_omx_port_setup (self->in_port, ¶m); gst_pad_set_element_private (self->sinkpad, self->in_port); /* Output port configuration. */ param.nPortIndex = self->out_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); g_omx_port_setup (self->out_port, ¶m); gst_pad_set_element_private (self->srcpad, self->out_port); diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c index bc7e26b..f990bba 100644 --- a/omx/gstomx_base_sink.c +++ b/omx/gstomx_base_sink.c @@ -48,7 +48,7 @@ setup_ports (GstOmxBaseSink *self) /* Input port configuration. */ param.nPortIndex = self->in_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); g_omx_port_setup (self->in_port, ¶m); gst_pad_set_element_private (self->sinkpad, self->in_port); } diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c index ba6ad8e..f651644 100644 --- a/omx/gstomx_base_src.c +++ b/omx/gstomx_base_src.c @@ -39,7 +39,7 @@ setup_ports (GstOmxBaseSrc *self) /* Input port configuration. */ param.nPortIndex = self->out_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); g_omx_port_setup (self->out_port, ¶m); if (self->setup_ports) diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c index 56b79d1..74114ef 100644 --- a/omx/gstomx_base_videodec.c +++ b/omx/gstomx_base_videodec.c @@ -111,7 +111,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamPortDefinition, ¶m); width = param.format.video.nFrameWidth; height = param.format.video.nFrameHeight; @@ -209,12 +209,12 @@ sink_setcaps (GstPad *pad, /* Input port configuration. */ { param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.video.nFrameWidth = width; param.format.video.nFrameHeight = height; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } return gst_pad_set_caps (pad, caps); @@ -239,11 +239,11 @@ omx_setup (GstOmxBaseFilter *omx_base) /* Input port configuration. */ { param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.video.eCompressionFormat = self->compression_format; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } } diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c index f469494..dbb006d 100644 --- a/omx/gstomx_base_videoenc.c +++ b/omx/gstomx_base_videoenc.c @@ -221,7 +221,7 @@ sink_setcaps (GstPad *pad, /* Input port configuration. */ { param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.video.nFrameWidth = width; param.format.video.nFrameHeight = height; @@ -234,7 +234,7 @@ sink_setcaps (GstPad *pad, gst_value_get_fraction_denominator (framerate); } - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } } @@ -260,14 +260,14 @@ omx_setup (GstOmxBaseFilter *omx_base) /* Output port configuration. */ { param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.video.eCompressionFormat = self->compression_format; if (self->bitrate != 0) param.format.video.nBitrate = self->bitrate; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } } diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c index f6c8dd1..298b7c3 100644 --- a/omx/gstomx_filereadersrc.c +++ b/omx/gstomx_filereadersrc.c @@ -110,7 +110,7 @@ setup_ports (GstOmxBaseSrc *base_src) { OMX_INDEXTYPE index; OMX_GetExtensionIndex (gomx->omx_handle, "OMX.ST.index.param.filereader.inputfilename", &index); - OMX_SetParameter (gomx->omx_handle, index, self->file_name); + g_omx_core_set_param (gomx, index, self->file_name); } } diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c index 623101e..cd11e4a 100644 --- a/omx/gstomx_g711dec.c +++ b/omx/gstomx_g711dec.c @@ -140,14 +140,14 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); if (strcmp (mode, "audio/x-alaw") == 0) param.ePCMMode = OMX_AUDIO_PCMModeALaw; else if (strcmp (mode, "audio/x-mulaw") == 0) param.ePCMMode = OMX_AUDIO_PCMModeMULaw; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } /* set caps on the srcpad */ diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c index 003058e..915301a 100644 --- a/omx/gstomx_g711enc.c +++ b/omx/gstomx_g711enc.c @@ -150,14 +150,14 @@ sink_setcaps (GstPad *pad, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m); if (strcmp (mode, "audio/x-alaw") == 0) param.ePCMMode = OMX_AUDIO_PCMModeALaw; else if (strcmp (mode, "audio/x-mulaw") == 0) param.ePCMMode = OMX_AUDIO_PCMModeMULaw; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m); } leave: diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c index 89d58db..3a388f1 100644 --- a/omx/gstomx_g729enc.c +++ b/omx/gstomx_g729enc.c @@ -226,11 +226,11 @@ omx_setup (GstOmxBaseFilter *omx_base) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamAudioG729, ¶m); param.bDTX = self->dtx; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamAudioG729, ¶m); } GST_INFO_OBJECT (omx_base, "end"); diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c index 9caaff7..f7b2999 100644 --- a/omx/gstomx_h263enc.c +++ b/omx/gstomx_h263enc.c @@ -93,7 +93,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base_filter->out_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); width = param.format.video.nFrameWidth; height = param.format.video.nFrameHeight; diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c index efc4092..95f3894 100644 --- a/omx/gstomx_h264enc.c +++ b/omx/gstomx_h264enc.c @@ -92,7 +92,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base_filter->out_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); width = param.format.video.nFrameWidth; height = param.format.video.nFrameHeight; diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c index e34c3fc..9d45ce6 100644 --- a/omx/gstomx_jpegenc.c +++ b/omx/gstomx_jpegenc.c @@ -209,7 +209,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamPortDefinition, ¶m); width = param.format.image.nFrameWidth; height = param.format.image.nFrameHeight; @@ -289,13 +289,13 @@ sink_setcaps (GstPad *pad, /* Input port configuration. */ { param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.image.nFrameWidth = width; param.format.image.nFrameHeight = height; param.format.image.eColorFormat = color_format; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } } @@ -321,11 +321,11 @@ omx_setup (GstOmxBaseFilter *omx_base) /* Output port configuration. */ { param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } } @@ -337,7 +337,7 @@ omx_setup (GstOmxBaseFilter *omx_base) param.nQFactor = self->quality; param.nPortIndex = omx_base->out_port->port_index; - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamQFactor, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamQFactor, ¶m); } GST_INFO_OBJECT (omx_base, "end"); diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c index 564e14c..7f7c312 100644 --- a/omx/gstomx_mp2dec.c +++ b/omx/gstomx_mp2dec.c @@ -120,7 +120,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c index a766689..e7bf6ec 100644 --- a/omx/gstomx_mp3dec.c +++ b/omx/gstomx_mp3dec.c @@ -120,7 +120,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c index 3f97fb0..bc524d0 100644 --- a/omx/gstomx_mpeg4enc.c +++ b/omx/gstomx_mpeg4enc.c @@ -94,7 +94,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base_filter->out_port->port_index; - OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m); width = param.format.video.nFrameWidth; height = param.format.video.nFrameHeight; diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c index b6633e4..128f06a 100644 --- a/omx/gstomx_util.c +++ b/omx/gstomx_util.c @@ -480,9 +480,75 @@ g_omx_core_get_handle (GOmxCore *core) { if (!core->omx_handle) g_omx_core_init (core); + if (!core->omx_handle) + GST_WARNING_OBJECT (core->object, "could not get handle"); return core->omx_handle; } +void +g_omx_core_get_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param) +{ + OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core); + OMX_ERRORTYPE err; + + if (!omx_handle) + return; + + err = OMX_GetParameter (omx_handle, idx, param); + + if (OMX_ErrorNone != err) + GST_WARNING_OBJECT (core->object, "OMX_GetParameter(%d) failed: %s", + idx, omx_error_to_str (err)); +} + +void +g_omx_core_set_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param) +{ + OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core); + OMX_ERRORTYPE err; + + if (!omx_handle) + return; + + err = OMX_SetParameter (omx_handle, idx, param); + + if (OMX_ErrorNone != err) + GST_WARNING_OBJECT (core->object, "OMX_SetParameter(%d) failed: %s", + idx, omx_error_to_str (err)); +} + +void +g_omx_core_get_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param) +{ + OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core); + OMX_ERRORTYPE err; + + if (!omx_handle) + return; + + err = OMX_GetConfig (omx_handle, idx, param); + + if (OMX_ErrorNone != err) + GST_WARNING_OBJECT (core->object, "OMX_GetConfig(%d) failed: %s", + idx, omx_error_to_str (err)); +} + +void +g_omx_core_set_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param) +{ + OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core); + OMX_ERRORTYPE err; + + if (!omx_handle) + return; + + err = OMX_SetConfig (omx_handle, idx, param); + + if (OMX_ErrorNone != err) + GST_WARNING_OBJECT (core->object, "OMX_SetConfig(%d) failed: %s", + idx, omx_error_to_str (err)); +} + /* * Port diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h index 87a1f3f..c647998 100644 --- a/omx/gstomx_util.h +++ b/omx/gstomx_util.h @@ -131,6 +131,10 @@ void g_omx_core_wait_for_done (GOmxCore *core); void g_omx_core_flush_start (GOmxCore *core); void g_omx_core_flush_stop (GOmxCore *core); OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core); +void g_omx_core_get_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param); +void g_omx_core_set_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param); +void g_omx_core_get_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param); +void g_omx_core_set_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param); GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index); GOmxPort *g_omx_port_new (GOmxCore *core, guint index); diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c index 4cfc300..30ae6a5 100644 --- a/omx/gstomx_videosink.c +++ b/omx/gstomx_videosink.c @@ -164,7 +164,7 @@ setcaps (GstBaseSink *gst_sink, G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->in_port->port_index; - OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m); switch (color_format) { @@ -191,7 +191,7 @@ setcaps (GstBaseSink *gst_sink, gst_value_get_fraction_denominator (framerate); } - OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); + g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m); } { @@ -200,11 +200,11 @@ setcaps (GstBaseSink *gst_sink, G_OMX_INIT_PARAM (config); config.nPortIndex = omx_base->in_port->port_index; - OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config); + g_omx_core_get_config (gomx, OMX_IndexConfigCommonScale, &config); config.nRotation = self->rotation; - OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonRotate, &config); + g_omx_core_set_config (gomx, OMX_IndexConfigCommonRotate, &config); } { @@ -213,12 +213,12 @@ setcaps (GstBaseSink *gst_sink, G_OMX_INIT_PARAM (config); config.nPortIndex = omx_base->in_port->port_index; - OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config); + g_omx_core_get_config (gomx, OMX_IndexConfigCommonScale, &config); config.xWidth = self->x_scale; config.xHeight = self->y_scale; - OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config); + g_omx_core_set_config (gomx, OMX_IndexConfigCommonScale, &config); } } diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c index 61c7f79..a9724c3 100644 --- a/omx/gstomx_volume.c +++ b/omx/gstomx_volume.c @@ -122,7 +122,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c index fa532df..d405dfa 100644 --- a/omx/gstomx_vorbisdec.c +++ b/omx/gstomx_vorbisdec.c @@ -115,7 +115,7 @@ settings_changed_cb (GOmxCore *core) G_OMX_INIT_PARAM (param); param.nPortIndex = omx_base->out_port->port_index; - OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m); rate = param.nSamplingRate; channels = param.nChannels; -- 1.6.3.2 |