本文整理汇总了C++中OMX_SendCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ OMX_SendCommand函数的具体用法?C++ OMX_SendCommand怎么用?C++ OMX_SendCommand使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OMX_SendCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ilcore_flush_tunnel
ret_code_t ilcore_flush_tunnel(ilcore_tunnel_h h)
{
OMX_ERRORTYPE omx_err;
omx_tunnel_t *tunnel = (omx_tunnel_t *)h;
if (!tunnel || !tunnel->src_comp || !tunnel->dst_comp)
{
DBG_E("%s: Incorrect parameters\n", __FUNCTION__);
return L_FAILED;
}
omx_err = OMX_SendCommand(ilcore_get_handle(tunnel->src_comp), OMX_CommandFlush, tunnel->src_port, NULL);
if(omx_err != OMX_ErrorNone && omx_err != OMX_ErrorSameState)
{
DBG_E("%s: Error flush port %d on component %s err = 0x%08x\n", __FUNCTION__, tunnel->src_port,
ilcore_get_comp_name(tunnel->src_comp), omx_err);
}
omx_err = OMX_SendCommand(ilcore_get_handle(tunnel->dst_comp), OMX_CommandFlush, tunnel->dst_port, NULL);
if(omx_err != OMX_ErrorNone && omx_err != OMX_ErrorSameState)
{
DBG_E("%s: Error flush port %d on component %s err = 0x%08x\n", __FUNCTION__, tunnel->dst_port,
ilcore_get_comp_name(tunnel->dst_comp), omx_err);
}
omx_core_comp_wait_command(tunnel->src_comp, OMX_CommandFlush, tunnel->src_port, 2000);
omx_core_comp_wait_command(tunnel->dst_comp, OMX_CommandFlush, tunnel->dst_port, 2000);
return L_OK;
}
示例2: DBGT_PROLOG
OMX_ERRORTYPE EnableDataFlow::resetComponents()
{
DBGT_PROLOG("");
OMX_ERRORTYPE err = OMX_ErrorNone;
DBGT_PTRACE("Sending Command StateIdle to SwJpegEnc");
err = OMX_SendCommand(mSwJpegEnc, OMX_CommandStateSet, OMX_StateIdle, NULL);
if(OMX_ErrorNone != err) {
DBGT_CRITICAL("Sending OMX_StateIdle failed for SwJpegEnc err = %d", err);
DBGT_EPILOG("");
return err;
}
DBGT_PTRACE("Sending Command StateIdle to ArmIv");
err = OMX_SendCommand(mArmIvProc, OMX_CommandStateSet, OMX_StateIdle, NULL);
if(OMX_ErrorNone != err) {
DBGT_CRITICAL("Sending OMX_StateIdle failed for ArmIVProc err = %d", err);
DBGT_EPILOG("");
return err;
}
mStateArmIvSem.wait();
mStateSWJpegSem.wait();
DBGT_PTRACE("Sending Command StateLoaded to ArmIv");
err = OMX_SendCommand(mArmIvProc, OMX_CommandStateSet, OMX_StateLoaded, NULL);
if(OMX_ErrorNone != err) {
DBGT_CRITICAL("Sending OMX_StateLoaded failed for ArmIVProc err = %d", err);
DBGT_EPILOG("");
return err;
}
DBGT_PTRACE("Sending Command StateLoaded to SwJpegEnc");
err = OMX_SendCommand(mSwJpegEnc, OMX_CommandStateSet, OMX_StateLoaded, NULL);
if(OMX_ErrorNone != err) {
DBGT_CRITICAL("Sending OMX_StateLoaded failed for SwJpegEnc err = %d", err);
DBGT_EPILOG("");
return err;
}
err = freeBuffers();
if(OMX_ErrorNone != err) {
DBGT_CRITICAL("Free buffers err = %d", err);
DBGT_EPILOG("");
return err;
}
mStateSWJpegSem.wait();
mStateArmIvSem.wait();
DBGT_EPILOG("");
return err;
}
示例3: Close
static void Close(vlc_object_t *obj)
{
filter_t *filter = (filter_t*) obj;
filter_sys_t *sys = filter->p_sys;
unsigned int i, j;
if (sys->omx_handle) {
OMX_STATETYPE state;
OMX_GetState(sys->omx_handle, &state);
if (state == OMX_StateExecuting) {
OMX_SendCommand(sys->omx_handle, OMX_CommandStateSet,
OMX_StateIdle, 0);
while (1) {
OMX_U32 cmd, state;
WaitForSpecificOmxEvent(&sys->event_queue, OMX_EventCmdComplete,
&cmd, &state, 0);
if (cmd == OMX_CommandStateSet && state == OMX_StateIdle)
break;
}
}
OMX_GetState(sys->omx_handle, &state);
if (state == OMX_StateIdle) {
OMX_SendCommand(sys->omx_handle, OMX_CommandStateSet,
OMX_StateLoaded, 0);
for (i = 0; i < sys->num_ports; i++) {
OmxPort *port = &sys->ports[i];
for (j = 0; j < sys->ports[i].i_buffers; j++) {
OMX_BUFFERHEADERTYPE *buffer;
OMX_FIFO_GET(&port->fifo, buffer);
OMX_FreeBuffer(sys->omx_handle, port->i_port_index,
buffer);
}
}
WaitForSpecificOmxEvent(&sys->event_queue, OMX_EventCmdComplete,
0, 0, 0);
}
for (i = 0; i < sys->num_ports; i++)
free(sys->ports[i].pp_buffers);
pf_free_handle(sys->omx_handle);
DeinitOmxEventQueue(&sys->event_queue);
}
free(sys);
DeinitOmxCore();
}
示例4: cleanup
static av_cold void cleanup(OMXCodecContext *s)
{
int i, executing;
pthread_mutex_lock(&s->state_mutex);
executing = s->state == OMX_StateExecuting;
pthread_mutex_unlock(&s->state_mutex);
if (executing) {
OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
wait_for_state(s, OMX_StateIdle);
OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL);
for (i = 0; i < s->num_in_buffers; i++) {
OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond,
&s->num_free_in_buffers, s->free_in_buffers, 1);
if (s->input_zerocopy)
buffer->pBuffer = NULL;
OMX_FreeBuffer(s->handle, s->in_port, buffer);
}
for (i = 0; i < s->num_out_buffers; i++) {
OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond,
&s->num_done_out_buffers, s->done_out_buffers, 1);
OMX_FreeBuffer(s->handle, s->out_port, buffer);
}
wait_for_state(s, OMX_StateLoaded);
}
if (s->handle) {
s->omx_context->ptr_FreeHandle(s->handle);
s->handle = NULL;
}
omx_deinit(s->omx_context);
s->omx_context = NULL;
if (s->mutex_cond_inited) {
pthread_cond_destroy(&s->state_cond);
pthread_mutex_destroy(&s->state_mutex);
pthread_cond_destroy(&s->input_cond);
pthread_mutex_destroy(&s->input_mutex);
pthread_cond_destroy(&s->output_cond);
pthread_mutex_destroy(&s->output_mutex);
s->mutex_cond_inited = 0;
}
av_freep(&s->in_buffer_headers);
av_freep(&s->out_buffer_headers);
av_freep(&s->free_in_buffers);
av_freep(&s->done_out_buffers);
av_freep(&s->output_buf);
}
示例5: ResourceExhaustionTest_TransitionWait
OMX_ERRORTYPE ResourceExhaustionTest_TransitionWait(ResourceExhaustionTestContext* pCtxt,
OMX_STATETYPE eToState)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_BOOL bTimeout = OMX_FALSE;
OMX_STATETYPE eState;
OMX_OSAL_EventReset(pCtxt->hStateSetEvent);
pCtxt->eLastError = OMX_ErrorNone;
OMX_CONF_BAIL_IF_ERROR(OMX_GetState(pCtxt->hWComp[pCtxt->nInst], &eState));
eError = OMX_SendCommand(pCtxt->hWComp[pCtxt->nInst], OMX_CommandStateSet, eToState, 0);
OMX_CONF_BAIL_IF_ERROR(eError);
if (eToState == OMX_StateIdle && (eState == OMX_StateLoaded))
{
OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_AllocateAllBuffers(pCtxt));
}
else if (eToState == OMX_StateLoaded && eState == OMX_StateIdle)
{
OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_DeInitBuffer(pCtxt));
}
OMX_OSAL_EventWait(pCtxt->hStateSetEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout);
OMX_CONF_BAIL_IF_ERROR(pCtxt->eLastError);
if (bTimeout == OMX_TRUE)
OMX_CONF_SET_ERROR_BAIL("Timeout on state transition\n", OMX_ErrorUndefined);
OMX_CONF_BAIL_IF_ERROR(OMX_GetState(pCtxt->hWComp[pCtxt->nInst], &eState));
if (eState != eToState)
OMX_CONF_SET_ERROR_BAIL("Incorrect transition\n", OMX_ErrorUndefined);
OMX_CONF_TEST_BAIL:
if (OMX_ErrorNone != eError && eToState == OMX_StateIdle && (eState == OMX_StateLoaded))
{
/* Add some delay before cleaning up */
OMX_OSAL_EventWait(pCtxt->hStateSetEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimeout);
/* Disable all ports to free buffers*/
OMX_SendCommand(pCtxt->hWComp[pCtxt->nInst], OMX_CommandPortDisable, OMX_ALL, 0x0);
/* Cleanup last instance */
ResourceExhaustionTest_DeInitBuffer(pCtxt);
}
return eError;
}
示例6: PortCommTest_TransitionWait
OMX_ERRORTYPE PortCommTest_TransitionWait(OMX_STATETYPE eToState,
PortCommTestCtxt* pContext)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_BOOL bTimeout = OMX_FALSE;
OMX_OSAL_EventReset(pContext->hStateSetEvent);
eError = OMX_SendCommand(pContext->hWComp, OMX_CommandStateSet, eToState, 0);
OMX_CONF_BAIL_IF_ERROR(eError);
if (eToState == OMX_StateIdle && (pContext->eState == OMX_StateLoaded))
{
OMX_CONF_BAIL_IF_ERROR(PortCommTest_OperateOnPorts(pContext, AllocBuf));
}
else if (eToState == OMX_StateLoaded && pContext->eState == OMX_StateIdle)
{
OMX_CONF_BAIL_IF_ERROR(PortCommTest_DeInitBuffer(pContext));
}
OMX_OSAL_EventWait(pContext->hStateSetEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout);
if (bTimeout == OMX_TRUE)
OMX_CONF_SET_ERROR_BAIL("Transition timed out\n", OMX_ErrorUndefined);
if (pContext->eState != eToState)
OMX_CONF_SET_ERROR_BAIL("Incorrect transition\n", OMX_ErrorUndefined);
OMX_CONF_TEST_BAIL:
return eError;
}
示例7: ilctts_delete
int32_t ilctts_delete(TTSRENDER_STATE_T *st) {
int32_t ret;
OMX_ERRORTYPE omx_err;
ret = ilclient_change_component_state(st->audio_render, OMX_StateIdle);
if (ret < 0) {
ERROR("ilctts_change_component_state returned error in ilctts_delete: %d", ret);
return -1;
}
omx_err = OMX_SendCommand(ILC_GET_HANDLE(st->audio_render), OMX_CommandStateSet, OMX_StateLoaded, NULL);
if (omx_err != OMX_ErrorNone) {
ERROR("OMX_SendCommand returned error in ilctts_delete: %d", omx_err);
return -1;
}
ilclient_disable_port_buffers(st->audio_render, 100, st->user_buffer_list, NULL, NULL);
ilclient_change_component_state(st->audio_render, OMX_StateLoaded);
ilclient_cleanup_components(st->list);
ilclient_destroy(st->client);
//sem_destroy(&st->buffer_list_sema);
destroy_semaphores(st);
destroy_mutexes(st);
free(st);
return 0;
} // end ilctts_delete
示例8: _GoToState
static inline void _GoToState(int state) {
OMX_ERRORTYPE err;
err = OMX_SendCommand(decoderhandle, OMX_CommandStateSet, state, NULL);
OMXE(err);
};
示例9: portSettingsChanged
static int portSettingsChanged(JPEG_DECODER *decoder, IMAGE *jpeg){
OMX_PARAM_PORTDEFINITIONTYPE portdef;
int ret;
portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
portdef.nVersion.nVersion = OMX_VERSION;
portdef.nPortIndex = decoder->outPort;
OMX_GetParameter(decoder->handle,OMX_IndexParamPortDefinition, &portdef);
jpeg->width = portdef.format.image.nFrameWidth;
jpeg->height = portdef.format.image.nFrameHeight;
jpeg->nData = portdef.nBufferSize;
jpeg->colorSpace = COLOR_SPACE_YUV420P;
OMX_SendCommand(decoder->handle, OMX_CommandPortEnable, decoder->outPort, NULL);
jpeg->pData=malloc(jpeg->nData);
if(jpeg->pData == NULL){
jpeg->nData=0;
return OMX_IMAGE_ERROR_MEMORY;
}
ret = OMX_UseBuffer(decoder->handle, &decoder->pOutputBufferHeader,
decoder->outPort, NULL, portdef.nBufferSize, (OMX_U8 *) jpeg->pData);
if (ret != OMX_ErrorNone) {
return OMX_IMAGE_ERROR_MEMORY;
}
return OMX_IMAGE_OK;
}
示例10: disablePort
/**
* Disable unwanted ports, or we can't transition to Idle state
*/
void disablePort(OMX_INDEXTYPE paramType) {
OMX_PORT_PARAM_TYPE param;
int nPorts;
int startPortNumber;
int n;
setHeader(¶m, sizeof(OMX_PORT_PARAM_TYPE));
err = OMX_GetParameter(handle, paramType, ¶m);
if(err != OMX_ErrorNone){
fprintf(stderr, "Error in getting OMX_PORT_PARAM_TYPE parameter\n", 0);
exit(1);
}
startPortNumber = ((OMX_PORT_PARAM_TYPE)param).nStartPortNumber;
nPorts = ((OMX_PORT_PARAM_TYPE)param).nPorts;
if (nPorts > 0) {
fprintf(stderr, "Other has %d ports\n", nPorts);
/* and disable it */
for (n = 0; n < nPorts; n++) {
err = OMX_SendCommand(handle, OMX_CommandPortDisable, n + startPortNumber, NULL);
if (err != OMX_ErrorNone) {
fprintf(stderr, "Error on setting port to disabled\n");
exit(1);
}
}
}
}
示例11: MAKEME
static OMX_BUFFERHEADERTYPE *allocbufs(OMX_HANDLETYPE h, int port, int enable)
{
int i;
OMX_BUFFERHEADERTYPE *list = NULL, **end = &list;
OMX_PARAM_PORTDEFINITIONTYPE *portdef;
MAKEME(portdef, OMX_PARAM_PORTDEFINITIONTYPE);
portdef->nPortIndex = port;
OERRq(OMX_GetParameter(h, OMX_IndexParamPortDefinition, portdef));
if (enable)
OERRq(OMX_SendCommand(h, OMX_CommandPortEnable, port, NULL));
for (i = 0; i < portdef->nBufferCountActual; i++) {
OMX_U8 *buf;
buf = vcos_malloc_aligned(portdef->nBufferSize,
portdef->nBufferAlignment, "buffer");
// printf("Allocated a buffer of %d bytes\n", portdef->nBufferSize);
OERRq(OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize,
buf));
end = (OMX_BUFFERHEADERTYPE **) &((*end)->pAppPrivate);
}
free(portdef);
return list;
}
示例12: change_state
static inline void
change_state (GOmxCore *core,
OMX_STATETYPE state)
{
GST_DEBUG_OBJECT (core->object, "state=%d", state);
OMX_SendCommand (core->omx_handle, OMX_CommandStateSet, state, NULL);
}
示例13: omx_set_state
void
omx_set_state(omx_component_t *oc, OMX_STATETYPE reqstate)
{
OMX_STATETYPE state;
int attempts = 20;
omxchk(OMX_GetState(oc->oc_handle, &state));
omxdbg("Telling component '%s' to go from state %d -> to state %d\n", oc->oc_name, state, reqstate);
while(1) {
oc->oc_cmd_done = 0;
int r = OMX_SendCommand(oc->oc_handle, OMX_CommandStateSet,
reqstate, NULL);
if(r == OMX_ErrorInsufficientResources && attempts) {
usleep(10000);
attempts--;
continue;
}
if(r != 0) {
panic("OMX Setstate %s from %d to %d error 0x%x",
oc->oc_name, state, reqstate, r);
}
if(reqstate == OMX_StateExecuting)
omx_wait_command(oc);
return;
}
}
示例14: removeComponent
OMX_ERRORTYPE removeComponent(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateIdle) {
(*(pExynosComponent->pCallbacks->EventHandler))(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError,
OMX_ErrorResourcesLost,
0,
NULL);
ret = OMX_SendCommand(pOMXComponent, OMX_CommandStateSet, OMX_StateLoaded, NULL);
if (ret != OMX_ErrorNone) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
} else if ((pExynosComponent->currentState == OMX_StateExecuting) ||
(pExynosComponent->currentState == OMX_StatePause)) {
/* Todo */
}
ret = OMX_ErrorNone;
EXIT:
return ret;
}
开发者ID:Exynos-CyanogenMod,项目名称:android_hardware_samsung_slsi_openmax,代码行数:28,代码来源:Exynos_OMX_Resourcemanager.c
示例15: Exynos_OMX_Release_Resource
OMX_ERRORTYPE Exynos_OMX_Release_Resource(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentList = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentWaitList = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pComponentTemp = NULL;
OMX_COMPONENTTYPE *pOMXWaitComponent = NULL;
int numElem = 0;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pRMComponentList = getRMList(pExynosComponent, gpRMList, NULL);
if (pRMComponentList == NULL) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
ret = removeElementList(&pRMComponentList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMList, pRMComponentList);
if (ret != OMX_ErrorNone)
goto EXIT;
pRMComponentWaitList = getRMList(pExynosComponent, gpRMWaitList, NULL);
pComponentTemp = pRMComponentWaitList;
while (pComponentTemp) {
numElem++;
pComponentTemp = pComponentTemp->pNext;
}
if (numElem > 0) {
pOMXWaitComponent = pRMComponentWaitList->pOMXStandComp;
ret = removeElementList(&pRMComponentWaitList, pOMXWaitComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMWaitList, pRMComponentWaitList);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = OMX_SendCommand(pOMXWaitComponent, OMX_CommandStateSet, OMX_StateIdle, NULL);
if (ret != OMX_ErrorNone)
goto EXIT;
}
EXIT:
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
FunctionOut();
return ret;
}
开发者ID:Exynos-CyanogenMod,项目名称:android_hardware_samsung_slsi_openmax,代码行数:59,代码来源:Exynos_OMX_Resourcemanager.c