本文整理汇总了C++中OMX_GetParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ OMX_GetParameter函数的具体用法?C++ OMX_GetParameter怎么用?C++ OMX_GetParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OMX_GetParameter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autoLock
status_t OMXNodeInstance::getParameter(
OMX_INDEXTYPE index, void *params, size_t size) {
Mutex::Autolock autoLock(mLock);
OMX_ERRORTYPE err = OMX_GetParameter(mHandle, index, params);
return StatusFromOMXError(err);
}
示例2: prepare_port_buffers
OMX_ERRORTYPE prepare_port_buffers(HTEST *hTest, OMX_U32 nPortIndex)
{
OMX_COMPONENTTYPE *hComponent = NULL;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;
OMX_U8 *pBuffer = NULL;
OMX_U32 i;
hComponent = hTest->hComponent;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = nPortIndex;
OMX_GetParameter(hComponent, OMX_IndexParamPortDefinition, &sPortDef);
for(i=0; i<sPortDef.nBufferCountActual; i++)
{
if(hTest->bAllocater[nPortIndex] == OMX_TRUE)
{
OMX_AllocateBuffer(hComponent, &pBufferHdr, nPortIndex, NULL, sPortDef.nBufferSize);
printf("Allocate buffer done.\n");
}
else
{
pBuffer = (OMX_U8*)FSL_MALLOC(sPortDef.nBufferSize);
OMX_UseBuffer(hComponent, &pBufferHdr, nPortIndex, NULL, sPortDef.nBufferSize, pBuffer);
printf("Use buffer done.\n");
}
hTest->pBufferHdr[nPortIndex][i] = pBufferHdr;
}
hTest->nBufferHdr[nPortIndex] = sPortDef.nBufferCountActual;
return OMX_ErrorNone;
}
示例3: while
void graph::gmusicops::do_retrieve_metadata ()
{
OMX_U32 index = 0;
const int gmusic_index = 0;
// Extract metadata from the gmusic source
while (OMX_ErrorNone == dump_metadata_item (index++, gmusic_index))
{
};
// Now extract metadata from the decoder
const int decoder_index = 1;
index = 0;
const bool use_first_as_heading = false;
while (OMX_ErrorNone
== dump_metadata_item (index++, decoder_index, use_first_as_heading))
{
};
OMX_GetParameter (handles_[2], OMX_IndexParamAudioPcm, &renderer_pcmtype_);
// Now print renderer metadata
TIZ_PRINTF_MAG (
" %ld Ch, %g KHz, %lu:%s:%s \n", renderer_pcmtype_.nChannels,
((float)renderer_pcmtype_.nSamplingRate) / 1000,
renderer_pcmtype_.nBitPerSample,
renderer_pcmtype_.eNumData == OMX_NumericalDataSigned ? "s" : "u",
renderer_pcmtype_.eEndian == OMX_EndianBig ? "b" : "l");
}
示例4: omx_alloc_buffers
/* Based on allocbufs from omxtx.
Buffers are connected as a one-way linked list using pAppPrivate as the pointer to the next element */
void omx_alloc_buffers(struct omx_component_t *component, int port)
{
int i;
OMX_BUFFERHEADERTYPE *list = NULL, **end = &list;
OMX_PARAM_PORTDEFINITIONTYPE portdef;
OMX_INIT_STRUCTURE(portdef);
portdef.nPortIndex = port;
OERR(OMX_GetParameter(component->h, OMX_IndexParamPortDefinition, &portdef));
if (component == &component->pipe->audio_render) {
DEBUGF("Allocating %d buffers of %d bytes\n",(int)portdef.nBufferCountActual,(int)portdef.nBufferSize);
DEBUGF("portdef.bEnabled=%d\n",portdef.bEnabled);
}
for (i = 0; i < portdef.nBufferCountActual; i++) {
OMX_U8 *buf;
buf = vcos_malloc_aligned(portdef.nBufferSize, portdef.nBufferAlignment, "buffer");
// printf("Allocated a buffer of %u bytes\n",(unsigned int)portdef.nBufferSize);
OERR(OMX_UseBuffer(component->h, end, port, NULL, portdef.nBufferSize, buf));
end = (OMX_BUFFERHEADERTYPE **) &((*end)->pAppPrivate);
}
component->buffers = list;
}
示例5: TIZ_INIT_OMX_PORT_STRUCT
OMX_ERRORTYPE
graph::vorbisdecops::set_vorbis_settings ()
{
// Retrieve the current vorbis settings from the decoder's port #0
OMX_AUDIO_PARAM_VORBISTYPE vorbistype_orig;
TIZ_INIT_OMX_PORT_STRUCT (vorbistype_orig, 0 /* port id */);
tiz_check_omx_err (OMX_GetParameter (handles_[1], OMX_IndexParamAudioVorbis,
&vorbistype_orig));
// Set the vorbis settings on decoder's port #0
OMX_AUDIO_PARAM_VORBISTYPE vorbistype;
TIZ_INIT_OMX_PORT_STRUCT (vorbistype, 0 /* port id */);
probe_ptr_->get_vorbis_codec_info (vorbistype);
vorbistype.nPortIndex = 0;
tiz_check_omx_err (
OMX_SetParameter (handles_[1], OMX_IndexParamAudioVorbis, &vorbistype));
// Record whether we need to wait for a port settings change event or not
// (the decoder output port implements the "slaving" behaviour)
need_port_settings_changed_evt_
= ((vorbistype_orig.nSampleRate != vorbistype.nSampleRate)
|| (vorbistype_orig.nChannels != vorbistype.nChannels));
return OMX_ErrorNone;
}
示例6: omx_alloc_buffers
void
omx_alloc_buffers(omx_component_t *oc, int port)
{
OMX_PARAM_PORTDEFINITIONTYPE portdef;
memset(&portdef, 0, sizeof(portdef));
portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
portdef.nVersion.nVersion = OMX_VERSION;
portdef.nPortIndex = port;
omxchk(OMX_GetParameter(oc->oc_handle, OMX_IndexParamPortDefinition, &portdef));
if(portdef.bEnabled != OMX_FALSE || portdef.nBufferCountActual == 0 || portdef.nBufferSize == 0)
exit(2);
omxdbg("Allocating buffers for %s:%d\n", oc->oc_name, port);
omxdbg(" buffer count = %d\n", (int)portdef.nBufferCountActual);
omxdbg(" buffer size = %d\n", (int)portdef.nBufferSize);
omx_send_command(oc, OMX_CommandPortEnable, port, NULL, 0);
int i;
for(i = 0; i < portdef.nBufferCountActual; i++) {
OMX_BUFFERHEADERTYPE *buf;
omxchk(OMX_AllocateBuffer(oc->oc_handle, &buf, port, NULL, portdef.nBufferSize));
omxdbg("buf=%p\n", buf);
buf->pAppPrivate = oc->oc_avail;
oc->oc_avail = buf;
}
omx_wait_command(oc); // Waits for the OMX_CommandPortEnable command
}
示例7: SetFormat
static OMX_ERRORTYPE SetFormat(filter_t *filter, OmxPort *port)
{
OMX_PARAM_PORTDEFINITIONTYPE *definition;
filter_sys_t *sys = filter->p_sys;
OMX_ERRORTYPE omx_error;
definition = &port->definition;
definition->format.image.nFrameWidth =
filter->fmt_in.video.i_width;
definition->format.image.nFrameHeight =
filter->fmt_in.video.i_height;
definition->format.image.nStride =
ALIGN(definition->format.image.nFrameWidth, 32);
definition->format.image.nSliceHeight =
ALIGN(definition->format.image.nFrameHeight, 16);
definition->nBufferSize = definition->format.image.nStride *
definition->format.image.nSliceHeight * 3 / 2;
omx_error = OMX_SetParameter(sys->omx_handle,
OMX_IndexParamPortDefinition, definition);
if (omx_error != OMX_ErrorNone)
msg_Warn(filter, "Could not configure port format (%x: %s).",
omx_error, ErrorToString(omx_error));
OMX_GetParameter(sys->omx_handle, OMX_IndexParamPortDefinition,
&definition);
msg_Dbg(filter, "Port %u\nFormat: %ux%u (%ux%u)\nnBufferSize: %u",
(unsigned)definition->nPortIndex,
(unsigned)definition->format.image.nFrameWidth,
(unsigned)definition->format.image.nFrameHeight,
(unsigned)definition->format.image.nStride,
(unsigned)definition->format.image.nSliceHeight,
(unsigned)definition->nBufferSize);
return omx_error;
}
示例8: OMX_INIT_STRUCTURE
int NonTextureEngine::getFrameCounter()
{
if (!isOpen)
{
return 0;
}
OMX_CONFIG_BRCMPORTSTATSTYPE stats;
OMX_INIT_STRUCTURE(stats);
stats.nPortIndex = VIDEO_RENDER_INPUT_PORT;
OMX_ERRORTYPE error =OMX_GetParameter(render, OMX_IndexConfigBrcmPortStats, &stats);
if (error == OMX_ErrorNone)
{
/*OMX_U32 nImageCount;
OMX_U32 nBufferCount;
OMX_U32 nFrameCount;
OMX_U32 nFrameSkips;
OMX_U32 nDiscards;
OMX_U32 nEOS;
OMX_U32 nMaxFrameSize;
OMX_TICKS nByteCount;
OMX_TICKS nMaxTimeDelta;
OMX_U32 nCorruptMBs;*/
//ofLogVerbose(__func__) << "nFrameCount: " << stats.nFrameCount;
frameCounter = stats.nFrameCount;
}else
{
ofLog(OF_LOG_ERROR, "error OMX_CONFIG_BRCMPORTSTATSTYPE FAIL error: 0x%08x", error);
//frameCounter = 0;
}
return frameCounter;
}
示例9: TIZ_LOG
OMX_ERRORTYPE
graph::gmusicops::set_channels_and_rate_on_decoder (
const OMX_U32 channels, const OMX_U32 sampling_rate)
{
const OMX_HANDLETYPE handle = handles_[1]; // decoder's handle
const OMX_U32 port_id = 0; // decoder's input port
TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
sampling_rate);
// Retrieve the mp3 settings from the decoder component
TIZ_INIT_OMX_PORT_STRUCT (decoder_mp3type_, port_id);
tiz_check_omx (
OMX_GetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_));
TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
sampling_rate);
// Now assign the actual settings to the pcmtype structure
decoder_mp3type_.nChannels = channels;
decoder_mp3type_.nSampleRate = sampling_rate;
// Set the new mp3 settings
tiz_check_omx (
OMX_SetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_));
TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
sampling_rate);
return OMX_ErrorNone;
}
示例10: rpi_video_port_settings_changed
static void
rpi_video_port_settings_changed(omx_component_t *oc)
{
media_codec_t *mc = oc->oc_opaque;
const rpi_video_codec_t *rvc = mc->opaque;
media_pipe_t *mp = mc->mp;
frame_info_t *fi = calloc(1, sizeof(frame_info_t));
int sar_num = 1;
int sar_den = 1;
if(rvc->rvc_sar_num && rvc->rvc_sar_den) {
sar_num = rvc->rvc_sar_num;
sar_den = rvc->rvc_sar_den;
} else {
OMX_CONFIG_POINTTYPE pixel_aspect;
OMX_INIT_STRUCTURE(pixel_aspect);
pixel_aspect.nPortIndex = 131;
if(OMX_GetParameter(oc->oc_handle, OMX_IndexParamBrcmPixelAspectRatio,
&pixel_aspect) == OMX_ErrorNone) {
sar_num = pixel_aspect.nX ?: sar_num;
sar_den = pixel_aspect.nY ?: sar_den;
}
}
示例11: TIZ_INIT_OMX_STRUCT
OMX_ERRORTYPE
graph::gmusicops::set_gmusic_playlist (const OMX_HANDLETYPE handle,
const std::string &playlist)
{
// Set the Google Music playlist
OMX_TIZONIA_AUDIO_PARAM_GMUSICPLAYLISTTYPE playlisttype;
TIZ_INIT_OMX_STRUCT (playlisttype);
tiz_check_omx_err (OMX_GetParameter (
handle,
static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioGmusicPlaylist),
&playlisttype));
copy_omx_string (playlisttype.cPlaylistName, playlist);
tizgmusicconfig_ptr_t gmusic_config
= boost::dynamic_pointer_cast< gmusicconfig >(config_);
assert (gmusic_config);
playlisttype.ePlaylistType = gmusic_config->get_playlist_type ();
playlisttype.bShuffle = playlist_->shuffle ();
return OMX_SetParameter (
handle,
static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioGmusicPlaylist),
&playlisttype);
}
示例12: TIZ_LOG
OMX_ERRORTYPE
graph::gmusicops::set_channels_and_rate_on_renderer (
const OMX_U32 channels, const OMX_U32 sampling_rate,
const std::string encoding_str)
{
const OMX_HANDLETYPE handle = handles_[2]; // renderer's handle
const OMX_U32 port_id = 0; // renderer's input port
TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
sampling_rate);
// Retrieve the pcm settings from the renderer component
TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype_, port_id);
tiz_check_omx_err (
OMX_GetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype_));
// Now assign the actual settings to the pcmtype structure
renderer_pcmtype_.nChannels = channels;
renderer_pcmtype_.nSamplingRate = sampling_rate;
renderer_pcmtype_.eNumData = OMX_NumericalDataSigned;
renderer_pcmtype_.eEndian
= (encoding_ == OMX_AUDIO_CodingMP3 ? OMX_EndianBig : OMX_EndianLittle);
// Set the new pcm settings
tiz_check_omx_err (
OMX_SetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype_));
std::string coding_type_str ("gmusic");
tiz::graph::util::dump_graph_info (coding_type_str.c_str (),
"Connection established",
playlist_->get_current_uri ().c_str ());
dump_stream_metadata ();
return OMX_ErrorNone;
}
示例13: StdCompCommonImage_PortFormatSupported
static OMX_ERRORTYPE StdCompCommonImage_PortFormatSupported(
TEST_CTXTYPE *pCtx,
OMX_U32 nPortIndex,
OMX_IMAGE_CODINGTYPE eCompressionFormat,
OMX_COLOR_FORMATTYPE eColorFormat)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_IMAGE_PARAM_PORTFORMATTYPE sPortFormat;
OMX_CONF_INIT_STRUCT(sPortFormat, OMX_IMAGE_PARAM_PORTFORMATTYPE);
OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying port format support\n");
sPortFormat.nPortIndex = nPortIndex;
for (sPortFormat.nIndex = 0; ; sPortFormat.nIndex++)
{
eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamImagePortFormat, (OMX_PTR) & sPortFormat);
if (OMX_ErrorNoMore == eError)
eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding
OMX_CONF_BAIL_ON_ERROR(eError);
if ((sPortFormat.eCompressionFormat == eCompressionFormat) &&
(sPortFormat.eColorFormat == eColorFormat))
break;
}
OMX_CONF_TEST_BAIL:
return(eError);
}
示例14: get_property
static void
get_property (GObject * obj, guint prop_id, GValue * value, GParamSpec * pspec)
{
GstOmxBaseSink *self;
self = GST_OMX_BASE_SINK (obj);
if (gstomx_get_property_helper (self->gomx, prop_id, value))
return;
switch (prop_id) {
case ARG_NUM_INPUT_BUFFERS:
{
OMX_PARAM_PORTDEFINITIONTYPE param;
OMX_HANDLETYPE omx_handle = self->gomx->omx_handle;
if (G_UNLIKELY (!omx_handle)) {
GST_WARNING_OBJECT (self, "no component");
g_value_set_uint (value, 0);
break;
}
G_OMX_INIT_PARAM (param);
param.nPortIndex = self->in_port->port_index;
OMX_GetParameter (omx_handle, OMX_IndexParamPortDefinition, ¶m);
g_value_set_uint (value, param.nBufferCountActual);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
}
}
示例15: sink_setcaps
static gboolean
sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstStructure *structure;
GstOmxBaseFilter *omx_base;
OMX_AUDIO_PARAM_AACPROFILETYPE param;
gint channels = 0;
gint sample_rate = 0;
gint mpegversion = 0;
const gchar *stream_format;
G_OMX_INIT_PARAM (param);
omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);
structure = gst_caps_get_structure (caps, 0);
{
const GValue *codec_data;
GstBuffer *buffer;
codec_data = gst_structure_get_value (structure, "codec_data");
if (codec_data) {
buffer = gst_value_get_buffer (codec_data);
omx_base->codec_data = buffer;
gst_buffer_ref (buffer);
}
}
gst_structure_get_int(structure, "mpegversion", &mpegversion);
gst_structure_get_int(structure, "channels", &channels);
gst_structure_get_int(structure, "rate", &sample_rate);
stream_format = gst_structure_get_string(structure, "stream-format");
/* retrieve current in port params */
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
if(channels > 0)
param.nChannels = (OMX_U32)channels;
if(sample_rate > 0)
param.nSampleRate = (OMX_U32)sample_rate;
if(!g_strcmp0(stream_format, "adif")) {
param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatADIF;
}
else if(!g_strcmp0(stream_format, "raw")) {
param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatRAW;
}
else if(!g_strcmp0(stream_format, "adts")) {
if(mpegversion == 2)
param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP2ADTS;
else if(mpegversion == 4)
param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
}
OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
return gst_pad_set_caps (pad, caps);
}