本文整理汇总了C++中PortVideo::SetMemAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ PortVideo::SetMemAlignment方法的具体用法?C++ PortVideo::SetMemAlignment怎么用?C++ PortVideo::SetMemAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PortVideo
的用法示例。
在下文中一共展示了PortVideo::SetMemAlignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInputPort
OMX_ERRORTYPE OMXVideoEncoderBase::InitInputPort(void) {
this->ports[INPORT_INDEX] = new PortVideo;
if (this->ports[INPORT_INDEX] == NULL) {
return OMX_ErrorInsufficientResources;
}
PortVideo *port = static_cast<PortVideo *>(this->ports[INPORT_INDEX]);
// OMX_PARAM_PORTDEFINITIONTYPE
OMX_PARAM_PORTDEFINITIONTYPE paramPortDefinitionInput;
memset(¶mPortDefinitionInput, 0, sizeof(paramPortDefinitionInput));
SetTypeHeader(¶mPortDefinitionInput, sizeof(paramPortDefinitionInput));
paramPortDefinitionInput.nPortIndex = INPORT_INDEX;
paramPortDefinitionInput.eDir = OMX_DirInput;
paramPortDefinitionInput.nBufferCountActual = INPORT_ACTUAL_BUFFER_COUNT;
paramPortDefinitionInput.nBufferCountMin = INPORT_MIN_BUFFER_COUNT;
paramPortDefinitionInput.nBufferSize = INPORT_BUFFER_SIZE;
paramPortDefinitionInput.bEnabled = OMX_TRUE;
paramPortDefinitionInput.bPopulated = OMX_FALSE;
paramPortDefinitionInput.eDomain = OMX_PortDomainVideo;
paramPortDefinitionInput.format.video.cMIMEType = (OMX_STRING)RAW_MIME_TYPE;
paramPortDefinitionInput.format.video.pNativeRender = NULL;
paramPortDefinitionInput.format.video.nFrameWidth = 176;
paramPortDefinitionInput.format.video.nFrameHeight = 144;
paramPortDefinitionInput.format.video.nStride = 0;
paramPortDefinitionInput.format.video.nSliceHeight = 0;
paramPortDefinitionInput.format.video.nBitrate = 64000;
paramPortDefinitionInput.format.video.xFramerate = 15 << 16;
paramPortDefinitionInput.format.video.bFlagErrorConcealment = OMX_FALSE;
paramPortDefinitionInput.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
paramPortDefinitionInput.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
paramPortDefinitionInput.format.video.pNativeWindow = NULL;
paramPortDefinitionInput.bBuffersContiguous = OMX_FALSE;
paramPortDefinitionInput.nBufferAlignment = 0;
// Nothing specific to initialize input port.
InitInputPortFormatSpecific(¶mPortDefinitionInput);
port->SetPortDefinition(¶mPortDefinitionInput, true);
// Set port buffer 4k aligned
port->SetMemAlignment(4096);
// OMX_VIDEO_PARAM_PORTFORMATTYPE
OMX_VIDEO_PARAM_PORTFORMATTYPE paramPortFormat;
memset(¶mPortFormat, 0, sizeof(paramPortFormat));
SetTypeHeader(¶mPortFormat, sizeof(paramPortFormat));
paramPortFormat.nPortIndex = INPORT_INDEX;
paramPortFormat.nIndex = 0;
paramPortFormat.eCompressionFormat = paramPortDefinitionInput.format.video.eCompressionFormat;
paramPortFormat.eColorFormat = paramPortDefinitionInput.format.video.eColorFormat;
paramPortFormat.xFramerate = paramPortDefinitionInput.format.video.xFramerate;
port->SetPortVideoParam(¶mPortFormat, true);
return OMX_ErrorNone;
}