本文整理汇总了C++中PortVideo类的典型用法代码示例。如果您正苦于以下问题:C++ PortVideo类的具体用法?C++ PortVideo怎么用?C++ PortVideo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PortVideo类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK_TYPE_HEADER
OMX_ERRORTYPE OMXVideoDecoderBase::SetNativeBufferModeSpecific(OMX_PTR pStructure) {
#if 0
OMX_ERRORTYPE ret;
EnableAndroidNativeBuffersParams *param = (EnableAndroidNativeBuffersParams*)pStructure;
CHECK_TYPE_HEADER(param);
CHECK_PORT_INDEX_RANGE(param);
CHECK_SET_PARAM_STATE();
if (!param->enable) {
mWorkingMode = RAWDATA_MODE;
return OMX_ErrorNone;
}
mWorkingMode = GRAPHICBUFFER_MODE;
PortVideo *port = NULL;
port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
OMX_PARAM_PORTDEFINITIONTYPE port_def;
memcpy(&port_def,port->GetPortDefinition(),sizeof(port_def));
port_def.nBufferCountMin = 1;
if (mEnableAdaptivePlayback) {
SetMaxOutputBufferCount(&port_def);
} else {
port_def.nBufferCountActual = mNativeBufferCount;
}
port_def.format.video.cMIMEType = (OMX_STRING)VA_VED_RAW_MIME_TYPE;
port_def.format.video.eColorFormat = OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar;
port_def.format.video.eColorFormat = GetOutputColorFormat(
port_def.format.video.nFrameWidth,
port_def.format.video.nFrameHeight);
port->SetPortDefinition(&port_def,true);
#endif
return OMX_ErrorNone;
}
示例2: CHECK_TYPE_HEADER
OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::SetNativeBufferModeSpecific(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
android::EnableAndroidNativeBuffersParams *param =
(android::EnableAndroidNativeBuffersParams*)pStructure;
CHECK_TYPE_HEADER(param);
CHECK_PORT_INDEX_RANGE(param);
CHECK_SET_PARAM_STATE();
if (!param->enable) {
mWorkingMode = RAWDATA_MODE;
LOGI("Raw data mode is used");
return OMX_ErrorNone;
}
mWorkingMode = GRAPHICBUFFER_MODE;
PortVideo *port = NULL;
port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
OMX_PARAM_PORTDEFINITIONTYPE port_def;
memcpy(&port_def,port->GetPortDefinition(),sizeof(port_def));
port_def.nBufferCountMin = mNativeBufferCount - 4;
port_def.nBufferCountActual = mNativeBufferCount;
port_def.format.video.cMIMEType = (OMX_STRING)VA_VED_RAW_MIME_TYPE;
// add borders for libvpx decode need.
port_def.format.video.nFrameWidth += VPX_DECODE_BORDER * 2;
mDecodedImageWidth = port_def.format.video.nFrameWidth;
mDecodedImageHeight = port_def.format.video.nFrameHeight;
// make heigth 32bit align
port_def.format.video.nFrameHeight = (port_def.format.video.nFrameHeight + 0x1f) & ~0x1f;
port_def.format.video.eColorFormat = GetOutputColorFormat(port_def.format.video.nFrameWidth);
port->SetPortDefinition(&port_def,true);
return OMX_ErrorNone;
}
示例3: memset
OMX_ERRORTYPE OMXVideoDecoderBase::InitOutputPort(void) {
this->ports[OUTPORT_INDEX] = new PortVideo;
if (this->ports[OUTPORT_INDEX] == NULL) {
return OMX_ErrorInsufficientResources;
}
PortVideo *port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
// OMX_PARAM_PORTDEFINITIONTYPE
OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionOutput;
memset(¶mPortDefinitionOutput, 0, sizeof(paramPortDefinitionOutput));
SetTypeHeader(¶mPortDefinitionOutput, sizeof(paramPortDefinitionOutput));
paramPortDefinitionOutput.nPortIndex = OUTPORT_INDEX;
paramPortDefinitionOutput.eDir = OMX_DirOutput;
paramPortDefinitionOutput.nBufferCountActual = OUTPORT_ACTUAL_BUFFER_COUNT;
paramPortDefinitionOutput.nBufferCountMin = OUTPORT_MIN_BUFFER_COUNT;
#if 0//fei
paramPortDefinitionOutput.nBufferSize = sizeof(VideoRenderBuffer);
#endif
paramPortDefinitionOutput.bEnabled = OMX_TRUE;
paramPortDefinitionOutput.bPopulated = OMX_FALSE;
paramPortDefinitionOutput.eDomain = OMX_PortDomainVideo;
paramPortDefinitionOutput.format.video.cMIMEType = (OMX_STRING)VA_RAW_MIME_TYPE;
paramPortDefinitionOutput.format.video.pNativeRender = NULL;
paramPortDefinitionOutput.format.video.nFrameWidth = 176;
paramPortDefinitionOutput.format.video.nFrameHeight = 144;
paramPortDefinitionOutput.format.video.nStride = 176;
paramPortDefinitionOutput.format.video.nSliceHeight = 144;
paramPortDefinitionOutput.format.video.nBitrate = 64000;
paramPortDefinitionOutput.format.video.xFramerate = 15 << 16;
paramPortDefinitionOutput.format.video.bFlagErrorConcealment = OMX_FALSE;
paramPortDefinitionOutput.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
paramPortDefinitionOutput.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
paramPortDefinitionOutput.format.video.pNativeWindow = NULL;
paramPortDefinitionOutput.bBuffersContiguous = OMX_FALSE;
paramPortDefinitionOutput.nBufferAlignment = 0;
// no format specific to initialize output port
InitOutputPortFormatSpecific(¶mPortDefinitionOutput);
port->SetPortDefinition(¶mPortDefinitionOutput, true);
// OMX_VIDEO_PARAM_PORTFORMATTYPE
OMX_VIDEO_PARAM_PORTFORMATTYPE paramPortFormat;
SetTypeHeader(¶mPortFormat, sizeof(paramPortFormat));
paramPortFormat.nPortIndex = OUTPORT_INDEX;
paramPortFormat.nIndex = 0;
paramPortFormat.eCompressionFormat = paramPortDefinitionOutput.format.video.eCompressionFormat;
paramPortFormat.eColorFormat = paramPortDefinitionOutput.format.video.eColorFormat;
paramPortFormat.xFramerate = paramPortDefinitionOutput.format.video.xFramerate;
port->SetPortVideoParam(¶mPortFormat, true);
return OMX_ErrorNone;
}
示例4: mCheckBufferAvailable
bool OMXVideoDecoderVP9Hybrid::IsAllBufferAvailable(void) {
bool b = ComponentBase::IsAllBufferAvailable();
if (b == false) {
return false;
}
PortVideo *port = NULL;
port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
const OMX_PARAM_PORTDEFINITIONTYPE* port_def = port->GetPortDefinition();
// if output port is disabled, retain the input buffer
if (!port_def->bEnabled) {
return false;
}
return mCheckBufferAvailable(mHybridCtx);
}
示例5: CHECK_TYPE_HEADER
OMX_ERRORTYPE OMXVideoEncoderBase::SetParamVideoBitrate(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
OMX_VIDEO_PARAM_BITRATETYPE *p = (OMX_VIDEO_PARAM_BITRATETYPE *)pStructure;
CHECK_TYPE_HEADER(p);
CHECK_PORT_INDEX(p, OUTPORT_INDEX);
CHECK_SET_PARAM_STATE();
OMX_U32 index = p->nPortIndex;
PortVideo *port = NULL;
// This disables other type of bitrate control mechanism
// TODO: check if it is desired
// TODO: can we override mParamBitrate.nPortIndex (See SetPortBitrateParam)
mParamBitrate.eControlRate = p->eControlRate;
mParamBitrate.nTargetBitrate = p->nTargetBitrate;
port = static_cast<PortVideo *>(ports[index]);
ret = port->SetPortBitrateParam(p, false);
return OMX_ErrorNone;
}
示例6: CHECK_TYPE_HEADER
OMX_ERRORTYPE OMXVideoDecoderBase::SetNativeBufferModeSpecific(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
EnableAndroidNativeBuffersParams *param = (EnableAndroidNativeBuffersParams*)pStructure;
CHECK_TYPE_HEADER(param);
CHECK_PORT_INDEX_RANGE(param);
CHECK_SET_PARAM_STATE();
PortVideo *port = NULL;
port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
OMX_PARAM_PORTDEFINITIONTYPE port_def;
memcpy(&port_def,port->GetPortDefinition(),sizeof(port_def));
if (!param->enable) {
mWorkingMode = RAWDATA_MODE;
// If it is fallback from native mode the color format has been
// already set to INTEL format.
// We need to set back the default color format and Native stuff.
port_def.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
port_def.format.video.pNativeRender = NULL;
port_def.format.video.pNativeWindow = NULL;
port->SetPortDefinition(&port_def,true);
return OMX_ErrorNone;
}
mWorkingMode = GRAPHICBUFFER_MODE;
port_def.nBufferCountMin = mNativeBufferCount;
if (mEnableAdaptivePlayback) {
SetMaxOutputBufferCount(&port_def);
} else {
port_def.nBufferCountActual = mNativeBufferCount;
}
port_def.format.video.cMIMEType = (OMX_STRING)VA_VED_RAW_MIME_TYPE;
port_def.format.video.eColorFormat = OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar;
port_def.format.video.nFrameHeight = (port_def.format.video.nFrameHeight + 0x1f) & ~0x1f;
port_def.format.video.eColorFormat = GetOutputColorFormat(
port_def.format.video.nFrameWidth);
port->SetPortDefinition(&port_def,true);
return OMX_ErrorNone;
}
示例7: SetStoreMetaDataInBuffers
OMX_ERRORTYPE OMXVideoEncoderBase::SetStoreMetaDataInBuffers(OMX_PTR pStructure) {
OMX_ERRORTYPE ret;
StoreMetaDataInBuffersParams *p = (StoreMetaDataInBuffersParams *)pStructure;
VideoParamsStoreMetaDataInBuffers StoreMetaDataInBuffers;
PortVideo *port = static_cast<PortVideo *>(this->ports[INPORT_INDEX]);
PortVideo *output_port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
uint32_t maxSize = 0;
CHECK_TYPE_HEADER(p);
CHECK_PORT_INDEX(p, INPORT_INDEX);
LOGD("SetStoreMetaDataInBuffers (enabled = %x)", p->bStoreMetaData);
if(mStoreMetaDataInBuffers == p->bStoreMetaData)
return OMX_ErrorNone;
StoreMetaDataInBuffers.isEnabled = p->bStoreMetaData;
if (mVideoEncoder->setParameters(&StoreMetaDataInBuffers) != ENCODE_SUCCESS)
return OMX_ErrorNotReady;
mStoreMetaDataInBuffers = p->bStoreMetaData;
if(mStoreMetaDataInBuffers){
// for input port buffer
OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput;
const OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput_get;
paramPortDefinitionInput_get = port->GetPortDefinition();
paramPortDefinitionInput = (OMX_PARAM_PORTDEFINITIONTYPE *)paramPortDefinitionInput_get;
paramPortDefinitionInput->nBufferSize = IntelMetadataBuffer::GetMaxBufferSize();
}
else
{
const OMX_PARAM_PORTDEFINITIONTYPE *paramPortDefinitionInput_get;
paramPortDefinitionInput_get = port->GetPortDefinition();
port->SetPortDefinition(paramPortDefinitionInput_get, true);
}
LOGD("SetStoreMetaDataInBuffers success");
return OMX_ErrorNone;
};
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_hardware_intel,代码行数:41,代码来源:OMXVideoEncoderBase.cpp
示例8: IN0
/**
@brief Called when the processing is ready to be stopped
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::stop()
//*************************************************************************************************************
{// Call Deinstantiation of component
IN0("\n");
m_pNmfProcWrp->stop();
#if 0
//ER355733 Try to fix ens bug that doesn't reset bufferSupplier type
PortVideo* pPort;
for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index)
{
pPort = (PortVideo*)mENSComponent.getPort(Index);
if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified)
{
MSG3("wwwwwwwwwwwwwwwwwwwwwwwwwwww %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier());
pPort->setBufferSupplier(OMX_BufferSupplyUnspecified);
}
}
#endif
OUT0("\n");
return OMX_ErrorNone;
}
示例9: memset
OMX_ERRORTYPE OMXVideoEncoderBase::InitOutputPort(void) {
this->ports[OUTPORT_INDEX] = new PortVideo;
if (this->ports[OUTPORT_INDEX] == NULL) {
return OMX_ErrorInsufficientResources;
}
PortVideo *port = static_cast<PortVideo *>(this->ports[OUTPORT_INDEX]);
// OMX_VIDEO_PARAM_BITRATETYPE
memset(&mParamBitrate, 0, sizeof(mParamBitrate));
SetTypeHeader(&mParamBitrate, sizeof(mParamBitrate));
mParamBitrate.nPortIndex = OUTPORT_INDEX;
mParamBitrate.eControlRate = OMX_Video_ControlRateVariable;
mParamBitrate.nTargetBitrate = 192000; // to be overridden
// OMX_VIDEO_CONFIG_PRI_INFOTYPE
memset(&mConfigPriInfo, 0, sizeof(mConfigPriInfo));
SetTypeHeader(&mConfigPriInfo, sizeof(mConfigPriInfo));
mConfigPriInfo.nPortIndex = OUTPORT_INDEX;
mConfigPriInfo.nCapacity = 0;
mConfigPriInfo.nHolder = NULL;
// OMX_VIDEO_CONFIG_INTEL_BITRATETYPE
memset(&mConfigIntelBitrate, 0, sizeof(mConfigIntelBitrate));
SetTypeHeader(&mConfigIntelBitrate, sizeof(mConfigIntelBitrate));
mConfigIntelBitrate.nPortIndex = OUTPORT_INDEX;
mConfigIntelBitrate.nMaxEncodeBitrate = 0; // Maximum bitrate
mConfigIntelBitrate.nTargetPercentage = 95; // Target bitrate as percentage of maximum bitrate; e.g. 95 is 95%
mConfigIntelBitrate.nWindowSize = 0; // Window size in milliseconds allowed for bitrate to reach target
mConfigIntelBitrate.nInitialQP = 0; // Initial QP for I frames
mConfigIntelBitrate.nMinQP = 0;
mConfigIntelBitrate.nMaxQP = 0;
mConfigIntelBitrate.nFrameRate = 0;
mConfigIntelBitrate.nTemporalID = 0;
// OMX_VIDEO_CONFIG_BITRATETYPE
memset(&mConfigBitrate, 0, sizeof(mConfigBitrate));
SetTypeHeader(&mConfigBitrate, sizeof(mConfigBitrate));
mConfigBitrate.nPortIndex = OUTPORT_INDEX;
mConfigBitrate.nEncodeBitrate = 0; // Maximum bitrate
// OMX_VIDEO_CONFIG_INTEL_AIR
memset(&mConfigIntelAir, 0, sizeof(mConfigIntelAir));
SetTypeHeader(&mConfigIntelAir, sizeof(mConfigIntelAir));
mConfigIntelAir.nPortIndex = OUTPORT_INDEX;
mConfigIntelAir.bAirEnable = OMX_FALSE;
mConfigIntelAir.bAirAuto = OMX_FALSE;
mConfigIntelAir.nAirMBs = 0;
mConfigIntelAir.nAirThreshold = 0;
// OMX_VIDEO_CONFIG_INTEL_AIR
memset(&mParamVideoRefresh, 0, sizeof(mParamVideoRefresh));
SetTypeHeader(&mParamVideoRefresh, sizeof(mParamVideoRefresh));
mParamVideoRefresh.nPortIndex = OUTPORT_INDEX;
mParamVideoRefresh.eRefreshMode = OMX_VIDEO_IntraRefreshAdaptive;
mParamVideoRefresh.nAirMBs = 0;
mParamVideoRefresh.nAirRef = 0;
mParamVideoRefresh.nCirMBs = 0;
// OMX_CONFIG_FRAMERATETYPE
memset(&mConfigFramerate, 0, sizeof(mConfigFramerate));
SetTypeHeader(&mConfigFramerate, sizeof(mConfigFramerate));
mConfigFramerate.nPortIndex = OUTPORT_INDEX;
mConfigFramerate.xEncodeFramerate = 0; // Q16 format
// OMX_VIDEO_PARAM_INTEL_ADAPTIVE_SLICE_CONTROL
memset(&mParamIntelAdaptiveSliceControl, 0, sizeof(mParamIntelAdaptiveSliceControl));
SetTypeHeader(&mParamIntelAdaptiveSliceControl, sizeof(mParamIntelAdaptiveSliceControl));
mParamIntelAdaptiveSliceControl.nPortIndex = OUTPORT_INDEX;
mParamIntelAdaptiveSliceControl.bEnable = OMX_FALSE;
mParamIntelAdaptiveSliceControl.nMinPSliceNumber = 5;
mParamIntelAdaptiveSliceControl.nNumPFramesToSkip = 8;
mParamIntelAdaptiveSliceControl.nSliceSizeThreshold = 1200;
// OMX_VIDEO_PARAM_PROFILELEVELTYPE
memset(&mParamProfileLevel, 0, sizeof(mParamProfileLevel));
SetTypeHeader(&mParamProfileLevel, sizeof(mParamProfileLevel));
mParamProfileLevel.nPortIndex = OUTPORT_INDEX;
mParamProfileLevel.eProfile = 0; // undefined profile, to be overridden
mParamProfileLevel.eLevel = 0; // undefined level, to be overridden
// OMX_PARAM_PORTDEFINITIONTYPE
OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionOutput;
memset(¶mPortDefinitionOutput, 0, sizeof(paramPortDefinitionOutput));
SetTypeHeader(¶mPortDefinitionOutput, sizeof(paramPortDefinitionOutput));
paramPortDefinitionOutput.nPortIndex = OUTPORT_INDEX;
paramPortDefinitionOutput.eDir = OMX_DirOutput;
paramPortDefinitionOutput.nBufferCountActual = OUTPORT_ACTUAL_BUFFER_COUNT; // to be overridden
paramPortDefinitionOutput.nBufferCountMin = OUTPORT_MIN_BUFFER_COUNT;
paramPortDefinitionOutput.nBufferSize = OUTPORT_BUFFER_SIZE; // to be overridden
paramPortDefinitionOutput.bEnabled = OMX_TRUE;
paramPortDefinitionOutput.bPopulated = OMX_FALSE;
paramPortDefinitionOutput.eDomain = OMX_PortDomainVideo;
paramPortDefinitionOutput.format.video.cMIMEType = NULL; // to be overridden
paramPortDefinitionOutput.format.video.pNativeRender = NULL;
paramPortDefinitionOutput.format.video.nFrameWidth = 176;
paramPortDefinitionOutput.format.video.nFrameHeight = 144;
paramPortDefinitionOutput.format.video.nStride = 176;
paramPortDefinitionOutput.format.video.nSliceHeight = 144;
paramPortDefinitionOutput.format.video.nBitrate = 64000;
//.........这里部分代码省略.........