00001 00029 #include <stdlib.h> 00030 #include <string.h> 00031 #include <unistd.h> 00032 #include <omxcore.h> 00033 #include <OMX_Core.h> 00034 #include <OMX_Component.h> 00035 #include "omx_base_component.h" 00036 #include "omx_base_video_port.h" 00037 00054 OMX_ERRORTYPE base_video_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,omx_base_PortType **openmaxStandPort,OMX_U32 nPortIndex, OMX_BOOL isInput) { 00055 00056 omx_base_video_PortType *omx_base_video_Port; 00057 00058 if (!(*openmaxStandPort)) { 00059 *openmaxStandPort = calloc(1,sizeof (omx_base_video_PortType)); 00060 } 00061 00062 if (!(*openmaxStandPort)) { 00063 return OMX_ErrorInsufficientResources; 00064 } 00065 00066 base_port_Constructor(openmaxStandComp,openmaxStandPort,nPortIndex, isInput); 00067 00068 omx_base_video_Port = (omx_base_video_PortType *)*openmaxStandPort; 00069 00070 setHeader(&omx_base_video_Port->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); 00071 omx_base_video_Port->sVideoParam.nPortIndex = nPortIndex; 00072 omx_base_video_Port->sVideoParam.nIndex = 0; 00073 omx_base_video_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingUnused; 00074 omx_base_video_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatUnused; 00075 omx_base_video_Port->sVideoParam.xFramerate = 15; 00076 00077 omx_base_video_Port->sPortParam.eDomain = OMX_PortDomainVideo; 00078 omx_base_video_Port->sPortParam.format.video.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); 00079 strcpy(omx_base_video_Port->sPortParam.format.video.cMIMEType, "raw/video"); 00080 omx_base_video_Port->sPortParam.format.video.pNativeRender = 0; 00081 omx_base_video_Port->sPortParam.format.video.bFlagErrorConcealment = OMX_FALSE; 00082 omx_base_video_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; 00083 00084 omx_base_video_Port->sPortParam.format.video.nFrameWidth = 0; 00085 omx_base_video_Port->sPortParam.format.video.nFrameHeight= 0; 00086 omx_base_video_Port->sPortParam.format.video.nStride = 0; 00087 omx_base_video_Port->sPortParam.format.video.nSliceHeight = 0; 00088 omx_base_video_Port->sPortParam.format.video.nBitrate = 0; 00089 omx_base_video_Port->sPortParam.format.video.xFramerate = 15; 00090 omx_base_video_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatUnused; 00091 omx_base_video_Port->sPortParam.format.video.pNativeWindow = NULL; 00092 00093 00094 omx_base_video_Port->sPortParam.nBufferSize = (isInput == OMX_TRUE)?DEFAULT_IN_BUFFER_SIZE:MAX_VIDEO_OUTPUT_BUF_SIZE ; 00095 00096 omx_base_video_Port->PortDestructor = &base_video_port_Destructor; 00097 00098 return OMX_ErrorNone; 00099 } 00100 00113 OMX_ERRORTYPE base_video_port_Destructor(omx_base_PortType *openmaxStandPort){ 00114 00115 if(openmaxStandPort->sPortParam.format.video.cMIMEType) { 00116 free(openmaxStandPort->sPortParam.format.video.cMIMEType); 00117 openmaxStandPort->sPortParam.format.video.cMIMEType = NULL; 00118 } 00119 00120 base_port_Destructor(openmaxStandPort); 00121 00122 return OMX_ErrorNone; 00123 }