本文整理汇总了C++中OMX_FreeBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ OMX_FreeBuffer函数的具体用法?C++ OMX_FreeBuffer怎么用?C++ OMX_FreeBuffer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OMX_FreeBuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResourceExhaustionTest_DeInitBuffer
OMX_ERRORTYPE ResourceExhaustionTest_DeInitBuffer(ResourceExhaustionTestContext *pCtxt)
{
BufferList *pBufferListObject;
BufferList *pTemp;
OMX_ERRORTYPE eError = OMX_ErrorNone;
pTemp = pCtxt->pBufferList[pCtxt->nInst];
while (pTemp)
{
pBufferListObject = (BufferList *)pTemp;
if (pTemp->pBufHdr->nInputPortIndex != OMX_NOPORT)
eError = OMX_FreeBuffer(pCtxt->hWComp[pCtxt->nInst],
pTemp->pBufHdr->nInputPortIndex, pTemp->pBufHdr);
else
eError = OMX_FreeBuffer(pCtxt->hWComp[pCtxt->nInst],
pTemp->pBufHdr->nOutputPortIndex, pTemp->pBufHdr);
if (eError == OMX_ErrorInvalidState || eError == OMX_ErrorIncorrectStateOperation)
eError = OMX_ErrorNone;
OMX_CONF_BAIL_IF_ERROR(eError);
pTemp = pTemp->pNextBuf;
if (pBufferListObject)
OMX_OSAL_Free(pBufferListObject);
}
pCtxt->pBufferList[pCtxt->nInst] = NULL;
OMX_CONF_TEST_BAIL:
return eError;
}
示例2: mm_jpegdec_session_free_buffers
/** mm_jpeg_session_free_buffers:
*
* Arguments:
* @data: job session
*
* Return:
* OMX error values
*
* Description:
* Free the buffers from OMX layer
*
**/
OMX_ERRORTYPE mm_jpegdec_session_free_buffers(void *data)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
uint32_t i = 0;
mm_jpeg_job_session_t* p_session = (mm_jpeg_job_session_t *)data;
mm_jpeg_decode_params_t *p_params = &p_session->dec_params;
for (i = 0; i < p_params->num_src_bufs; i++) {
CDBG("%s:%d] Source buffer %d", __func__, __LINE__, i);
ret = OMX_FreeBuffer(p_session->omx_handle, 0, p_session->p_in_omx_buf[i]);
if (ret) {
CDBG_ERROR("%s:%d] Error %d", __func__, __LINE__, ret);
return ret;
}
}
for (i = 0; i < p_params->num_dst_bufs; i++) {
CDBG("%s:%d] Dest buffer %d", __func__, __LINE__, i);
ret = OMX_FreeBuffer(p_session->omx_handle, 1, p_session->p_out_omx_buf[i]);
if (ret) {
CDBG_ERROR("%s:%d] Error", __func__, __LINE__);
return ret;
}
}
CDBG("%s:%d]", __func__, __LINE__);
return ret;
}
示例3: PortCommTest_DeInitBuffer
OMX_ERRORTYPE PortCommTest_DeInitBuffer(PortCommTestCtxt* pContext)
{
OMX_U8 *pBuffer;
BufferList *pBufferListObject;
BufferList *pTemp;
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Free all buffers\n");
pTemp = pContext->pInBufferList;
while (pTemp)
{
pBufferListObject = (BufferList *)pTemp;
pBuffer = (OMX_U8 *)pTemp->pOrigBufHdr->pBuffer;
if (pContext->bClientAllocBuf)
{
OMX_OSAL_Free(pBuffer);
pTemp->pOrigBufHdr->pBuffer = NULL;
}
eError = OMX_FreeBuffer(pContext->hWComp, pTemp->pOrigBufHdr->nInputPortIndex, pTemp->pOrigBufHdr);
if (eError == OMX_ErrorInvalidState)
eError = OMX_ErrorNone;
OMX_CONF_BAIL_IF_ERROR(eError);
pTemp = pTemp->pNextBuf;
if (pBufferListObject)
OMX_OSAL_Free(pBufferListObject);
pContext->nInBuf--;
}
pContext->pInBufferList = NULL;
pTemp = pContext->pOutBufferList;
while (pTemp)
{
pBufferListObject = (BufferList *)pTemp;
pBuffer = (OMX_U8 *)pTemp->pOrigBufHdr->pBuffer;
if (pContext->bClientAllocBuf)
{
OMX_OSAL_Free(pBuffer);
pTemp->pOrigBufHdr->pBuffer = NULL;
}
eError = OMX_FreeBuffer(pContext->hWComp, pTemp->pOrigBufHdr->nOutputPortIndex, pTemp->pOrigBufHdr);
if (eError == OMX_ErrorInvalidState)
eError = OMX_ErrorNone;
OMX_CONF_BAIL_IF_ERROR(eError);
pTemp = pTemp->pNextBuf;
if (pBufferListObject)
OMX_OSAL_Free(pBufferListObject);
pContext->nOutBuf--;
}
pContext->pOutBufferList = NULL;
OMX_CONF_TEST_BAIL:
return eError;
}
示例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: OMX_SendCommand
OMX_ERRORTYPE COpenMaxVideo::FreeOMXInputBuffers(bool wait)
{
OMX_ERRORTYPE omx_err = OMX_ErrorNone;
/*
omx_err = OMX_SendCommand(m_omx_decoder, OMX_CommandFlush, m_omx_input_port, 0);
if (omx_err)
CLog::Log(LOGERROR, "%s::%s - OMX_CommandFlush failed with omx_err(0x%x)\n",
CLASSNAME, __func__, omx_err);
else if (wait)
sem_wait(m_omx_flush_input);
*/
// free omx input port buffers.
for (size_t i = 0; i < m_omx_input_buffers.size(); i++)
{
// using external buffers (OMX_UseBuffer), free our external buffers
// before calling OMX_FreeBuffer which frees the omx buffer.
delete [] m_omx_input_buffers[i]->pBuffer;
m_omx_input_buffers[i]->pBuffer = NULL;
omx_err = OMX_FreeBuffer(m_omx_decoder, m_omx_input_port, m_omx_input_buffers[i]);
}
m_omx_input_buffers.clear();
// empty input buffer queue. not decoding so don't need lock/unlock.
while (!m_omx_input_avaliable.empty())
m_omx_input_avaliable.pop();
while (!m_demux_queue.empty())
m_demux_queue.pop();
while (!m_dts_queue.empty())
m_dts_queue.pop();
return(omx_err);
}
示例6: omxbufs_deinit
void omxbufs_deinit(IOPort& iop) {
printf("%s: Port %d: Actual %u, %d\n",__FUNCTION__, iop.nPortIndex, iop.nBufferCountActual, (int)iop.size());
for (auto beg = iop.begin(); beg != iop.end(); ++beg) {
OMX_FreeBuffer(component, iop.nPortIndex, beg->buf);
}
iop.clear();
}
示例7: port_free_buffers
static void
port_free_buffers (GOmxPort *port)
{
guint i;
for (i = 0; i < port->num_buffers; i++)
{
OMX_BUFFERHEADERTYPE *omx_buffer;
omx_buffer = port->buffers[i];
if (omx_buffer)
{
#if 0
/** @todo how shall we free that buffer? */
if (!port->omx_allocate)
{
g_free (omx_buffer->pBuffer);
omx_buffer->pBuffer = NULL;
}
#endif
OMX_FreeBuffer (port->core->omx_handle, port->port_index, omx_buffer);
port->buffers[i] = NULL;
}
}
}
示例8: free_port_buffers
OMX_ERRORTYPE free_port_buffers(HCOMPONENT *component, OMX_U32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *hComponent;
OMX_U32 i;
hComponent = component->hComponent;
for(i=0; i<component->nBufferHdr[nPortIndex]; i++)
{
OMX_U8 *ptr = component->pBufferHdr[nPortIndex][i]->pBuffer;
while(1)
{
ret = OMX_FreeBuffer(hComponent, nPortIndex, component->pBufferHdr[nPortIndex][i]);
if(ret == OMX_ErrorNotReady)
usleep(10000);
else
break;
}
component->pBufferHdr[nPortIndex][i] = 0;
if(component->bAllocater[nPortIndex] == OMX_FALSE)
FSL_FREE(ptr);
}
return OMX_ErrorNone;
}
示例9: GETEXTENSION
OMX_ERRORTYPE COpenMaxVideo::FreeOMXOutputEGLTextures(bool wait)
{
OMX_ERRORTYPE omx_err = OMX_ErrorNone;
OpenMaxVideoBuffer *egl_buffer;
if (!eglDestroyImageKHR)
{
GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
}
for (size_t i = 0; i < m_omx_output_buffers.size(); i++)
{
egl_buffer = m_omx_output_buffers[i];
// tell decoder output port to stop using the EGLImage
omx_err = OMX_FreeBuffer(m_omx_decoder, m_omx_output_port, egl_buffer->omx_buffer);
// destroy egl_image
eglDestroyImageKHR(m_egl_display, egl_buffer->egl_image);
// free texture
glDeleteTextures(1, &egl_buffer->texture_id);
delete egl_buffer;
}
m_omx_output_buffers.clear();
return omx_err;
}
示例10: OMX_FreeBuffer
static OMX_ERRORTYPE
OMXDecoder_freeBuffers
(OMXDecoder *thiz,
OMX_BUFFERHEADERTYPE **buffers, OMX_U32 count,
OMX_U32 portIndex)
{
OMX_U32 i;
OMX_HANDLETYPE component = thiz->component;
OMX_ERRORTYPE ret = OMX_ErrorNone;
for (i = 0; i < count; i++)
{
OMX_BUFFERHEADERTYPE *buffer = *(buffers + i);
if (buffer)
{
OMX_U8 *buffer_;
OMX_ERRORTYPE omxerr;
buffer_ = buffer->pBuffer;
omxerr = OMX_FreeBuffer(component, portIndex, buffer);
if (OMX_ErrorNone == omxerr)
{
free(buffer_);
*(buffers + i) = NULL;
}
else
ret = omxerr;
}
}
if (OMX_ErrorNone == ret)
free(buffers);
return ret;
}
示例11: LOGD
void AnatomyOMXClient::freeBuffers() {
LOGD("=============================================");
for (size_t i = mBufferInfo.size(); i--;) {
int port_index= mBufferInfo[i].mPortIndex;
OMX_BUFFERHEADERTYPE *header = mBufferInfo[i].mBufferHeader;
LOGD("mBufferInfo[%d] mPortIndex : %d, mBufferHeader %p",i, port_index, header);
removeOMXBufferInfo(port_index, header);
OMX_FreeBuffer(mComponentHandle, port_index, header);
}
LOGD("=============================================");
}
示例12: OMX_FreeBuffer
OMX_ERRORTYPE omxil_comp::FreeBuffer(OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
{
OMX_ERRORTYPE result;
result = OMX_FreeBuffer(comp, nPortIndex, pBuffer);
if (result != OMX_ErrorNone) {
fprintf(stderr, "OMX_FreeBuffer failed.\n");
}
return result;
}
示例13: omx_release_buffers
void
omx_release_buffers(omx_component_t *oc, int port)
{
assert(oc->oc_inflight_buffers == 0);
OMX_BUFFERHEADERTYPE *buf, *n;
for(buf = oc->oc_avail; buf; buf = n) {
n = buf->pAppPrivate;
int r = OMX_FreeBuffer(oc->oc_handle, port, buf);
printf("%s freeing buf %p : %x\n", oc->oc_name, buf, r);
}
}
示例14: omx_free_buffers
void omx_free_buffers(struct omx_component_t *component, int port)
{
OMX_BUFFERHEADERTYPE *buf, *prev;
int i=0;
buf = component->buffers;
while (buf) {
prev = buf->pAppPrivate;
OERR(OMX_FreeBuffer(component->h, port, buf)); /* This also calls free() */
buf = prev;
}
}
示例15: 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();
}