|
OpenMAXBellagio 0.9.3
|
00001 00026 #include <string.h> 00027 #include <unistd.h> 00028 #include <omxcore.h> 00029 #include <OMX_Core.h> 00030 #include <OMX_Component.h> 00031 00032 #include "omx_base_component.h" 00033 #include "omx_base_image_port.h" 00034 00051 OMX_ERRORTYPE base_image_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,omx_base_PortType **openmaxStandPort,OMX_U32 nPortIndex, OMX_BOOL isInput) { 00052 00053 omx_base_image_PortType *omx_base_image_Port; 00054 00055 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s of component %p\n", __func__, openmaxStandComp); 00056 if (!(*openmaxStandPort)) { 00057 *openmaxStandPort = calloc(1,sizeof (omx_base_image_PortType)); 00058 } 00059 00060 if (!(*openmaxStandPort)) { 00061 return OMX_ErrorInsufficientResources; 00062 } 00063 00064 base_port_Constructor(openmaxStandComp,openmaxStandPort,nPortIndex, isInput); 00065 00066 omx_base_image_Port = (omx_base_image_PortType *)*openmaxStandPort; 00067 00068 setHeader(&omx_base_image_Port->sImageParam, sizeof(OMX_IMAGE_PARAM_PORTFORMATTYPE)); 00069 omx_base_image_Port->sImageParam.nPortIndex = nPortIndex; 00070 omx_base_image_Port->sImageParam.nIndex = 0; 00071 omx_base_image_Port->sImageParam.eCompressionFormat = OMX_IMAGE_CodingUnused; 00072 00073 omx_base_image_Port->sPortParam.eDomain = OMX_PortDomainImage; 00074 omx_base_image_Port->sPortParam.format.image.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); 00075 strcpy(omx_base_image_Port->sPortParam.format.image.cMIMEType, "raw/image"); 00076 omx_base_image_Port->sPortParam.format.image.pNativeRender = 0; 00077 omx_base_image_Port->sPortParam.format.image.bFlagErrorConcealment = OMX_FALSE; 00078 omx_base_image_Port->sPortParam.format.image.eCompressionFormat = OMX_IMAGE_CodingUnused; 00079 00080 omx_base_image_Port->sPortParam.nBufferSize = (isInput == OMX_TRUE)?DEFAULT_IN_BUFFER_SIZE:DEFAULT_OUT_BUFFER_SIZE ; 00081 00082 omx_base_image_Port->PortDestructor = &base_image_port_Destructor; 00083 00084 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s of component %p\n", __func__, openmaxStandComp); 00085 return OMX_ErrorNone; 00086 } 00087 00100 OMX_ERRORTYPE base_image_port_Destructor(omx_base_PortType *openmaxStandPort){ 00101 OMX_ERRORTYPE err; 00102 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s of port %p\n", __func__, openmaxStandPort); 00103 if(openmaxStandPort->sPortParam.format.image.cMIMEType) { 00104 free(openmaxStandPort->sPortParam.format.image.cMIMEType); 00105 openmaxStandPort->sPortParam.format.image.cMIMEType = NULL; 00106 } 00107 00108 err = base_port_Destructor(openmaxStandPort); 00109 if (err != OMX_ErrorNone) { 00110 DEBUG(DEB_LEV_ERR, "In %s base port destructor failed\n", __func__); 00111 return err; 00112 } 00113 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s of port %p\n", __func__, openmaxStandPort); 00114 return OMX_ErrorNone; 00115 }