OMX_VIDEO_PORTDEFINITIONTYPE *videoformat = &(ipPorts[PortIndex]->PortParam.format.video);
if (videoformat->eCompressionFormat == OMX_VIDEO_CodingUnused)
{
- // check if stride needs to be adjusted - stride should be at least the 16 byte aligned width
- // WMV is special case that requires 4 bytes alignment
-
- OMX_U32 min_stride = ((videoformat->nFrameWidth + 15) & (~15));
- OMX_U32 min_sliceheight = ((videoformat->nFrameHeight + 15) & (~15));
-
- if (oscl_strcmp("video/wmv", videoformat->cMIMEType) == 0)
- {
- min_stride = ((videoformat->nFrameWidth + 3) & (~3));
- min_sliceheight = ((videoformat->nFrameHeight + 1) & (~1));
- }
-
-
- videoformat->nStride = min_stride;
- videoformat->nSliceHeight = min_sliceheight;
-
-
- // finally, compute the new minimum buffer size.
-
- // Encoder components can have different formats - (rely on the client to provide the correct size)
- if (OMX_PORT_OUTPUTPORT_INDEX == PortIndex)
- {
- // Decoder components always output YUV420 format
- ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
-
- }
-
- if (OMX_PORT_INPUTPORT_INDEX == PortIndex)
- {
- // Encoder components may have different formats
- if (videoformat->eColorFormat == OMX_COLOR_Format24bitRGB888)
- {
- ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 3;
- }
- else if (videoformat->eColorFormat == OMX_COLOR_Format12bitRGB444)
- {
- ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 2;
-
- }
- else if (videoformat->eColorFormat == OMX_COLOR_FormatYUV420Planar)
- {
- ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
-
- }
-
- }
-
+ // call components to calculate nStride, nSliceHeight and nBufferSize of videoformat.
+ CalculateBufferParameters(PortIndex);
}
}
return ErrorType;
}
+
+// This virtual function can be overwritten by component according to the buffer requirement.
+
+OSCL_EXPORT_REF void OmxComponentVideo::CalculateBufferParameters(OMX_U32 PortIndex)
+{
+ OMX_VIDEO_PORTDEFINITIONTYPE *videoformat = &(ipPorts[PortIndex]->PortParam.format.video);
+
+ // check if stride needs to be adjusted - stride should be at least the 16 byte aligned width
+ OMX_U32 min_stride = ((videoformat->nFrameWidth + 15) & (~15));
+ OMX_U32 min_sliceheight = ((videoformat->nFrameHeight + 15) & (~15));
+
+
+ videoformat->nStride = min_stride;
+ videoformat->nSliceHeight = min_sliceheight;
+
+
+ // finally, compute the new minimum buffer size.
+
+ // Encoder components can have different formats - (rely on the client to provide the correct size)
+ if (OMX_PORT_OUTPUTPORT_INDEX == PortIndex)
+ {
+ // Decoder components always output YUV420 format
+ ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
+
+ }
+
+ if (OMX_PORT_INPUTPORT_INDEX == PortIndex)
+ {
+ // Encoder components may have different formats
+ if (videoformat->eColorFormat == OMX_COLOR_Format24bitRGB888)
+ {
+ ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 3;
+ }
+ else if (videoformat->eColorFormat == OMX_COLOR_Format12bitRGB444)
+ {
+ ipPorts[PortIndex]->PortParam.nBufferSize = videoformat->nSliceHeight * videoformat->nStride * 2;
+
+ }
+ else if (videoformat->eColorFormat == OMX_COLOR_FormatYUV420Planar)
+ {
+ ipPorts[PortIndex]->PortParam.nBufferSize = (videoformat->nSliceHeight * videoformat->nStride * 3) >> 1;
+
+ }
+
+ }
+
+ return ;
+}
+
#if PROXY_INTERFACE
/** Component entry points declarations with proxy interface*/
#define SC_SEQ 0x0F
#define SC_ENTRY 0x0E
-//For Real Video Decoder
-#define GetUnalignedWordRv( pb, w ) \
- (w) = ((uint16) *(pb) << 8) + *(pb+1);
-
-#define GetUnalignedDwordRv( pb, dw ) \
- (dw) = ((uint32) *(pb + 3)) + \
- ((uint32) *(pb + 2) << 8) + \
- ((uint32) *(pb + 1) << 16) + ((uint32) (*pb) << 24);
-
-#define GetUnalignedWordExRv( pb, w ) GetUnalignedWordRv( pb, w ); (pb) += sizeof(uint16);
-#define GetUnalignedDwordExRv( pb, dw ) GetUnalignedDwordRv( pb, dw ); (pb) += sizeof(uint32);
-
-#define LoadWORDRv( w, p ) GetUnalignedWordExRv( p, w )
-#define LoadDWORDRv( dw, p ) GetUnalignedDwordExRv( p, dw )
OSCL_DLL_ENTRY_POINT_DEFAULT()
}
else if (aInputs->iMimeType == PVMF_MIME_REAL_VIDEO) //rv
{
- uint32 dwdat;
- uint16 wdat;
-
- uint8 *pData = aInputs->inPtr;
-
- // Init frame contains: HX_FORMAT_VIDEO + extra_data= 26 bytes + 4(SPO) + 4(stream_version) + RPRsizeinfo (variable)
-
- // HX_FORMAT_VIDEO
- LoadDWORDRv(dwdat, pData);
- LoadDWORDRv(dwdat, pData);
- LoadDWORDRv(dwdat, pData);
- LoadWORDRv(wdat, pData);
- aOutputs->width = (int32) wdat; // size of data below
-
- LoadWORDRv(wdat, pData);
- aOutputs->height = (int32) wdat;
-
+ // use this as default value, let decoder discover the actual size and perform port reconfig
+ aOutputs->width = 128;
+ aOutputs->height = 96;
aOutputs->profile = 0;
aOutputs->level = 0;
}