/** The Constructor */ OMX_ERRORTYPE omx_videosrc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) { OMX_ERRORTYPE err = OMX_ErrorNone; omx_base_video_PortType *pPort; omx_videosrc_component_PrivateType* omx_videosrc_component_Private; OMX_U32 i; DEBUG(DEB_LEV_FUNCTION_NAME,"In %s \n",__func__); if (!openmaxStandComp->pComponentPrivate) { openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_videosrc_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } omx_videosrc_component_Private = openmaxStandComp->pComponentPrivate; omx_videosrc_component_Private->ports = NULL; omx_videosrc_component_Private->deviceHandle = -1; err = omx_base_source_Constructor(openmaxStandComp, cComponentName); omx_videosrc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_videosrc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 1; /** Allocate Ports and call port constructor. */ if (omx_videosrc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts && !omx_videosrc_component_Private->ports) { omx_videosrc_component_Private->ports = calloc(omx_videosrc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts, sizeof(omx_base_PortType *)); if (!omx_videosrc_component_Private->ports) { return OMX_ErrorInsufficientResources; } for (i=0; i < omx_videosrc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) { omx_videosrc_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType)); if (!omx_videosrc_component_Private->ports[i]) { return OMX_ErrorInsufficientResources; } } } base_video_port_Constructor(openmaxStandComp, &omx_videosrc_component_Private->ports[0], 0, OMX_FALSE); omx_videosrc_component_Private->ports[0]->Port_AllocateBuffer = videosrc_port_AllocateBuffer; omx_videosrc_component_Private->ports[0]->Port_FreeBuffer = videosrc_port_FreeBuffer; omx_videosrc_component_Private->ports[0]->Port_AllocateTunnelBuffer = videosrc_port_AllocateTunnelBuffer; omx_videosrc_component_Private->ports[0]->Port_FreeTunnelBuffer = videosrc_port_FreeTunnelBuffer; pPort = (omx_base_video_PortType *) omx_videosrc_component_Private->ports[OMX_BASE_SOURCE_OUTPUTPORT_INDEX]; pPort->sPortParam.format.video.nFrameWidth = 320; pPort->sPortParam.format.video.nFrameHeight= 240; pPort->sPortParam.format.video.eColorFormat= OMX_COLOR_FormatYUV420Planar; pPort->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420Planar; pPort->sPortParam.nBufferSize = pPort->sPortParam.format.video.nFrameWidth* pPort->sPortParam.format.video.nFrameHeight*3; // RGB888 omx_videosrc_component_Private->iFrameSize = pPort->sPortParam.nBufferSize; omx_videosrc_component_Private->BufferMgmtCallback = omx_videosrc_component_BufferMgmtCallback; omx_videosrc_component_Private->destructor = omx_videosrc_component_Destructor; omx_videosrc_component_Private->messageHandler = omx_videosrc_component_MessageHandler; noViderSrcInstance++; if(noViderSrcInstance > MAX_COMPONENT_VIDEOSRC) { return OMX_ErrorInsufficientResources; } openmaxStandComp->SetParameter = omx_videosrc_component_SetParameter; openmaxStandComp->GetParameter = omx_videosrc_component_GetParameter; /* Write in the default paramenters */ omx_videosrc_component_Private->videoReady = OMX_FALSE; if(!omx_videosrc_component_Private->videoSyncSem) { omx_videosrc_component_Private->videoSyncSem = calloc(1,sizeof(tsem_t)); if(omx_videosrc_component_Private->videoSyncSem == NULL) return OMX_ErrorInsufficientResources; tsem_init(omx_videosrc_component_Private->videoSyncSem, 0); } omx_videosrc_component_Private->bOutBufferMemoryMapped = OMX_FALSE; /* Test if Camera Attached */ omx_videosrc_component_Private->deviceHandle = open(VIDEO_DEV_NAME, O_RDWR /* required */ | O_NONBLOCK, 0); if (omx_videosrc_component_Private->deviceHandle < 0) { DEBUG(DEB_LEV_ERR, "In %s Unable to open video capture device %s! errno=%d ENODEV : %d \n", __func__,VIDEO_DEV_NAME,errno,ENODEV); return OMX_ErrorHardware; } omx_videosrc_component_Private->pixel_format = V4L2_PIX_FMT_YUV420; err = init_device(omx_videosrc_component_Private); err = init_mmap(omx_videosrc_component_Private); return err; }
static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING name) { vid_dec_PrivateType *priv; omx_base_video_PortType *port; struct pipe_screen *screen; OMX_ERRORTYPE r; int i; assert(!comp->pComponentPrivate); priv = comp->pComponentPrivate = CALLOC(1, sizeof(vid_dec_PrivateType)); if (!priv) return OMX_ErrorInsufficientResources; r = omx_base_filter_Constructor(comp, name); if (r) return r; priv->profile = PIPE_VIDEO_PROFILE_UNKNOWN; if (!strcmp(name, OMX_VID_DEC_MPEG2_NAME)) priv->profile = PIPE_VIDEO_PROFILE_MPEG2_MAIN; if (!strcmp(name, OMX_VID_DEC_AVC_NAME)) priv->profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH; if (!strcmp(name, OMX_VID_DEC_HEVC_NAME)) priv->profile = PIPE_VIDEO_PROFILE_HEVC_MAIN; priv->BufferMgmtCallback = vid_dec_FrameDecoded; priv->messageHandler = vid_dec_MessageHandler; priv->destructor = vid_dec_Destructor; comp->SetParameter = vid_dec_SetParameter; comp->GetParameter = vid_dec_GetParameter; priv->screen = omx_get_screen(); if (!priv->screen) return OMX_ErrorInsufficientResources; screen = priv->screen->pscreen; priv->pipe = screen->context_create(screen, NULL, 0); if (!priv->pipe) return OMX_ErrorInsufficientResources; if (!vl_compositor_init(&priv->compositor, priv->pipe)) { priv->pipe->destroy(priv->pipe); priv->pipe = NULL; return OMX_ErrorInsufficientResources; } if (!vl_compositor_init_state(&priv->cstate, priv->pipe)) { vl_compositor_cleanup(&priv->compositor); priv->pipe->destroy(priv->pipe); priv->pipe = NULL; return OMX_ErrorInsufficientResources; } priv->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; priv->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2; priv->ports = CALLOC(2, sizeof(omx_base_PortType *)); if (!priv->ports) return OMX_ErrorInsufficientResources; for (i = 0; i < 2; ++i) { priv->ports[i] = CALLOC(1, sizeof(omx_base_video_PortType)); if (!priv->ports[i]) return OMX_ErrorInsufficientResources; base_video_port_Constructor(comp, &priv->ports[i], i, i == 0); } port = (omx_base_video_PortType *)priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]; strcpy(port->sPortParam.format.video.cMIMEType,"video/MPEG2"); port->sPortParam.nBufferCountMin = 8; port->sPortParam.nBufferCountActual = 8; port->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE; port->sPortParam.format.video.nFrameWidth = 176; port->sPortParam.format.video.nFrameHeight = 144; port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG2; port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingMPEG2; port->Port_SendBufferFunction = vid_dec_DecodeBuffer; port->Port_FreeBuffer = vid_dec_FreeDecBuffer; port = (omx_base_video_PortType *)priv->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]; port->sPortParam.nBufferCountActual = 8; port->sPortParam.nBufferCountMin = 4; port->sPortParam.format.video.nFrameWidth = 176; port->sPortParam.format.video.nFrameHeight = 144; port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; port->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; return OMX_ErrorNone; }
/** The Constructor of the video decoder component * @param openmaxStandComp the component handle to be constructed * @param cComponentName is the name of the constructed component */ OMX_ERRORTYPE omx_shvpudec_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; omx_shvpudec_component_PrivateType* omx_shvpudec_component_Private; omx_base_video_PortType *inPort,*outPort; OMX_U32 i; if (!openmaxStandComp->pComponentPrivate) { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__); openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_shvpudec_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } else { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate); } omx_shvpudec_component_Private = openmaxStandComp->pComponentPrivate; omx_shvpudec_component_Private->ports = NULL; eError = omx_base_filter_Constructor(openmaxStandComp, cComponentName); omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2; /** Allocate Ports and call port constructor. */ if (omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts && !omx_shvpudec_component_Private->ports) { omx_shvpudec_component_Private->ports = calloc(omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts, sizeof(omx_base_PortType *)); if (!omx_shvpudec_component_Private->ports) { return OMX_ErrorInsufficientResources; } for (i=0; i < omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) { omx_shvpudec_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType)); if (!omx_shvpudec_component_Private->ports[i]) { return OMX_ErrorInsufficientResources; } } } base_video_port_Constructor(openmaxStandComp, &omx_shvpudec_component_Private->ports[0], 0, OMX_TRUE); base_video_port_Constructor(openmaxStandComp, &omx_shvpudec_component_Private->ports[1], 1, OMX_FALSE); /** here we can override whatever defaults the base_component constructor set * e.g. we can override the function pointers in the private struct */ /** Domain specific section for the ports. * first we set the parameter common to both formats */ //common parameters related to input port inPort = (omx_base_video_PortType *)omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]; inPort->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE; inPort->sPortParam.format.video.xFramerate = 25; //common parameters related to output port outPort = (omx_base_video_PortType *)omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]; outPort->sPortParam.format.video.eColorFormat = OUTPUT_DECODED_COLOR_FMT; outPort->sPortParam.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUF_SIZE; outPort->sPortParam.format.video.xFramerate = 25; /** settings of output port parameter definition */ outPort->sVideoParam.eColorFormat = OUTPUT_DECODED_COLOR_FMT; outPort->sVideoParam.xFramerate = 25; /** now it's time to know the video coding type of the component */ if(!strcmp(cComponentName, VIDEO_DEC_MPEG4_NAME)) { omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingMPEG4; } else if(!strcmp(cComponentName, VIDEO_DEC_H264_NAME)) { omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingAVC; } else if (!strcmp(cComponentName, VIDEO_DEC_BASE_NAME)) { omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingUnused; } else { // IL client specified an invalid component name return OMX_ErrorInvalidComponentName; } if(!omx_shvpudec_component_Private->avCodecSyncSem) { omx_shvpudec_component_Private->avCodecSyncSem = calloc(1,sizeof(tsem_t)); if(omx_shvpudec_component_Private->avCodecSyncSem == NULL) { return OMX_ErrorInsufficientResources; } tsem_init(omx_shvpudec_component_Private->avCodecSyncSem, 0); } SetInternalVideoParameters(openmaxStandComp); //omx_shvpudec_component_Private->eOutFramePixFmt = PIX_FMT_YUV420P; if(omx_shvpudec_component_Private->video_coding_type == OMX_VIDEO_CodingMPEG4) { omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4; } else { omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC; } /** general configuration irrespective of any video formats * setting other parameters of omx_shvpudec_component_private */ omx_shvpudec_component_Private->decoder = NULL; omx_shvpudec_component_Private->avcodecReady = OMX_FALSE; //omx_shvpudec_component_Private->extradata = NULL; //omx_shvpudec_component_Private->extradata_size = 0; omx_shvpudec_component_Private->BufferMgmtCallback = omx_shvpudec_component_BufferMgmtCallback; /** initializing the codec context etc that was done earlier by ffmpeglibinit function */ omx_shvpudec_component_Private->messageHandler = omx_shvpudec_component_MessageHandler; omx_shvpudec_component_Private->destructor = omx_shvpudec_component_Destructor; openmaxStandComp->SetParameter = omx_shvpudec_component_SetParameter; openmaxStandComp->GetParameter = omx_shvpudec_component_GetParameter; openmaxStandComp->SetConfig = omx_shvpudec_component_SetConfig; openmaxStandComp->ComponentRoleEnum = omx_shvpudec_component_ComponentRoleEnum; openmaxStandComp->GetExtensionIndex = omx_shvpudec_component_GetExtensionIndex; noVideoDecInstance++; if(noVideoDecInstance > MAX_COMPONENT_VIDEODEC) { return OMX_ErrorInsufficientResources; } return eError; }
/** The Constructor * * @param openmaxStandComp is the handle to be constructed * @param cComponentName is the name of the constructed component * */ OMX_ERRORTYPE omx_xvideo_sink_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) { OMX_ERRORTYPE err = OMX_ErrorNone; omx_xvideo_sink_component_PortType *pPort; omx_xvideo_sink_component_PrivateType* omx_xvideo_sink_component_Private; if (!openmaxStandComp->pComponentPrivate) { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__); openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_xvideo_sink_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } else { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate); } omx_xvideo_sink_component_Private = openmaxStandComp->pComponentPrivate; omx_xvideo_sink_component_Private->ports = NULL; /** we could create our own port structures here * fixme maybe the base class could use a "port factory" function pointer? */ err = omx_base_sink_Constructor(openmaxStandComp, cComponentName); omx_xvideo_sink_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_xvideo_sink_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 1; /** Allocate Ports and call port constructor. */ if ((omx_xvideo_sink_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts ) && !omx_xvideo_sink_component_Private->ports) { omx_xvideo_sink_component_Private->ports = calloc((omx_xvideo_sink_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts ), sizeof(omx_base_PortType *)); if (!omx_xvideo_sink_component_Private->ports) { return OMX_ErrorInsufficientResources; } omx_xvideo_sink_component_Private->ports[0] = calloc(1, sizeof(omx_xvideo_sink_component_PortType)); if (!omx_xvideo_sink_component_Private->ports[0]) { return OMX_ErrorInsufficientResources; } base_video_port_Constructor(openmaxStandComp, &omx_xvideo_sink_component_Private->ports[0], 0, OMX_TRUE); } pPort = (omx_xvideo_sink_component_PortType *) omx_xvideo_sink_component_Private->ports[OMX_BASE_SINK_INPUTPORT_INDEX]; /** Domain specific section for the allocated port. */ pPort->sPortParam.format.video.nFrameWidth = 352; pPort->sPortParam.format.video.nFrameHeight = 288; pPort->sPortParam.format.video.nBitrate = 0; pPort->sPortParam.format.video.xFramerate = 25; pPort->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; // Figure out stride, slice height, min buffer size pPort->sPortParam.format.video.nStride = calcStride(pPort->sPortParam.format.video.nFrameWidth, pPort->sPortParam.format.video.eColorFormat); pPort->sPortParam.format.video.nSliceHeight = pPort->sPortParam.format.video.nFrameHeight; // No support for slices yet pPort->sPortParam.nBufferSize = (OMX_U32) abs(pPort->sPortParam.format.video.nStride) * pPort->sPortParam.format.video.nSliceHeight; pPort->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420Planar; pPort->sVideoParam.xFramerate = 25; DEBUG(DEB_LEV_PARAMS, "In %s, bSize=%d stride=%d\n", __func__,(int)pPort->sPortParam.nBufferSize,(int)pPort->sPortParam.format.video.nStride); /** Set configs */ setHeader(&pPort->omxConfigCrop, sizeof(OMX_CONFIG_RECTTYPE)); pPort->omxConfigCrop.nPortIndex = OMX_BASE_SINK_INPUTPORT_INDEX; pPort->omxConfigCrop.nLeft = pPort->omxConfigCrop.nTop = 0; pPort->omxConfigCrop.nWidth = pPort->omxConfigCrop.nHeight = 0; setHeader(&pPort->omxConfigRotate, sizeof(OMX_CONFIG_ROTATIONTYPE)); pPort->omxConfigRotate.nPortIndex = OMX_BASE_SINK_INPUTPORT_INDEX; pPort->omxConfigRotate.nRotation = 0; //Default: No rotation (0 degrees) setHeader(&pPort->omxConfigMirror, sizeof(OMX_CONFIG_MIRRORTYPE)); pPort->omxConfigMirror.nPortIndex = OMX_BASE_SINK_INPUTPORT_INDEX; pPort->omxConfigMirror.eMirror = OMX_MirrorNone; //Default: No mirroring setHeader(&pPort->omxConfigScale, sizeof(OMX_CONFIG_SCALEFACTORTYPE)); pPort->omxConfigScale.nPortIndex = OMX_BASE_SINK_INPUTPORT_INDEX; pPort->omxConfigScale.xWidth = pPort->omxConfigScale.xHeight = 0x10000; //Default: No scaling (scale factor = 1) setHeader(&pPort->omxConfigOutputPosition, sizeof(OMX_CONFIG_POINTTYPE)); pPort->omxConfigOutputPosition.nPortIndex = OMX_BASE_SINK_INPUTPORT_INDEX; pPort->omxConfigOutputPosition.nX = pPort->omxConfigOutputPosition.nY = 0; //Default: No shift in output position (0,0) /** set the function pointers */ omx_xvideo_sink_component_Private->destructor = omx_xvideo_sink_component_Destructor; omx_xvideo_sink_component_Private->BufferMgmtCallback = omx_xvideo_sink_component_BufferMgmtCallback; openmaxStandComp->SetParameter = omx_xvideo_sink_component_SetParameter; openmaxStandComp->GetParameter = omx_xvideo_sink_component_GetParameter; omx_xvideo_sink_component_Private->messageHandler = omx_xvideo_sink_component_MessageHandler; omx_xvideo_sink_component_Private->bIsXVideoInit = OMX_FALSE; if(!omx_xvideo_sink_component_Private->xvideoSyncSem) { omx_xvideo_sink_component_Private->xvideoSyncSem = calloc(1,sizeof(tsem_t)); if(omx_xvideo_sink_component_Private->xvideoSyncSem == NULL) { return OMX_ErrorInsufficientResources; } tsem_init(omx_xvideo_sink_component_Private->xvideoSyncSem, 0); } noxvideo_sinkInstance++; if(noxvideo_sinkInstance > MAX_COMPONENT_XVIDEOSINK) { DEBUG(DEB_LEV_ERR, "Reached Max Instances %d\n",(int)noxvideo_sinkInstance); return OMX_ErrorInsufficientResources; } return err; }
/** The Constructor */ OMX_ERRORTYPE omx_parser3gp_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) { OMX_ERRORTYPE err = OMX_ErrorNone; omx_base_video_PortType *pPortV; omx_base_audio_PortType *pPortA; omx_parser3gp_component_PrivateType* omx_parser3gp_component_Private; DEBUG(DEB_LEV_FUNCTION_NAME,"In %s \n",__func__); if (!openmaxStandComp->pComponentPrivate) { openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_parser3gp_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } /*Assign size of the derived port class,so that proper memory for port class can be allocated*/ omx_parser3gp_component_Private = openmaxStandComp->pComponentPrivate; omx_parser3gp_component_Private->ports = NULL; err = omx_base_source_Constructor(openmaxStandComp, cComponentName); omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 1; omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 1; omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 1; omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nStartPortNumber = 2; omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts = 1; /** Allocate Ports and call port constructor. */ if ((omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts + omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts + omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts ) && !omx_parser3gp_component_Private->ports) { omx_parser3gp_component_Private->ports = calloc((omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts + omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts + omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts ), sizeof(omx_base_PortType *)); if (!omx_parser3gp_component_Private->ports) { return OMX_ErrorInsufficientResources; } /* allocate video port*/ omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX] = calloc(1, sizeof(omx_base_video_PortType)); if (!omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX]) return OMX_ErrorInsufficientResources; /* allocate audio port*/ omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX] = calloc(1, sizeof(omx_base_audio_PortType)); if (!omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX]) return OMX_ErrorInsufficientResources; /* allocate clock port*/ omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX] = calloc(1, sizeof(omx_base_clock_PortType)); if (!omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX]) return OMX_ErrorInsufficientResources; } base_video_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX], VIDEO_PORT_INDEX, OMX_FALSE); base_audio_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX], AUDIO_PORT_INDEX, OMX_FALSE); base_clock_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX], CLOCK_PORT_INDEX, OMX_TRUE); omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX]->sPortParam.bEnabled = OMX_FALSE; pPortV = (omx_base_video_PortType *) omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX]; pPortA = (omx_base_audio_PortType *) omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX]; /*Input pPort buffer size is equal to the size of the output buffer of the previous component*/ pPortV->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE; pPortA->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE; omx_parser3gp_component_Private->BufferMgmtCallback = omx_parser3gp_component_BufferMgmtCallback; omx_parser3gp_component_Private->BufferMgmtFunction = omx_base_source_twoport_BufferMgmtFunction; setHeader(&omx_parser3gp_component_Private->sTimeStamp, sizeof(OMX_TIME_CONFIG_TIMESTAMPTYPE)); omx_parser3gp_component_Private->sTimeStamp.nPortIndex=0; omx_parser3gp_component_Private->sTimeStamp.nTimestamp=0x0; omx_parser3gp_component_Private->destructor = omx_parser3gp_component_Destructor; omx_parser3gp_component_Private->messageHandler = omx_parser3gp_component_MessageHandler; noParser3gpInstance++; if(noParser3gpInstance > MAX_COMPONENT_PARSER_3GP) { return OMX_ErrorInsufficientResources; } openmaxStandComp->SetParameter = omx_parser3gp_component_SetParameter; openmaxStandComp->GetParameter = omx_parser3gp_component_GetParameter; openmaxStandComp->SetConfig = omx_parser3gp_component_SetConfig; openmaxStandComp->GetExtensionIndex = omx_parser3gp_component_GetExtensionIndex; /* Write in the default paramenters */ omx_parser3gp_component_Private->pTmpOutputBuffer = calloc(1,sizeof(OMX_BUFFERHEADERTYPE)); omx_parser3gp_component_Private->pTmpOutputBuffer->pBuffer = calloc(1,DEFAULT_OUT_BUFFER_SIZE); omx_parser3gp_component_Private->pTmpOutputBuffer->nFilledLen=0; omx_parser3gp_component_Private->pTmpOutputBuffer->nAllocLen=DEFAULT_OUT_BUFFER_SIZE; omx_parser3gp_component_Private->pTmpOutputBuffer->nOffset=0; omx_parser3gp_component_Private->avformatReady = OMX_FALSE; omx_parser3gp_component_Private->isFirstBufferAudio = OMX_TRUE; omx_parser3gp_component_Private->isFirstBufferVideo = OMX_TRUE; if(!omx_parser3gp_component_Private->avformatSyncSem) { omx_parser3gp_component_Private->avformatSyncSem = calloc(1,sizeof(tsem_t)); if(omx_parser3gp_component_Private->avformatSyncSem == NULL) return OMX_ErrorInsufficientResources; tsem_init(omx_parser3gp_component_Private->avformatSyncSem, 0); } omx_parser3gp_component_Private->sInputFileName = malloc(DEFAULT_FILENAME_LENGTH); /*Default Coding type*/ omx_parser3gp_component_Private->video_coding_type = OMX_VIDEO_CodingAVC; omx_parser3gp_component_Private->audio_coding_type = OMX_AUDIO_CodingMP3; av_register_all(); /* without this file opening gives an error */ return err; }
/** The Constructor of the video encoder component * @param openmaxStandComp the component handle to be constructed * @param cComponentName is the name of the constructed component */ OMX_ERRORTYPE omx_videoenc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; omx_videoenc_component_PrivateType* omx_videoenc_component_Private; omx_base_video_PortType *inPort,*outPort; OMX_U32 i; if (!openmaxStandComp->pComponentPrivate) { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__); openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_videoenc_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } else { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate); } omx_videoenc_component_Private = openmaxStandComp->pComponentPrivate; omx_videoenc_component_Private->ports = NULL; /** we could create our own port structures here * fixme maybe the base class could use a "port factory" function pointer? */ eError = omx_base_filter_Constructor(openmaxStandComp, cComponentName); omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2; /** Allocate Ports and call port constructor. */ if (omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts && !omx_videoenc_component_Private->ports) { omx_videoenc_component_Private->ports = calloc(omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts, sizeof(omx_base_PortType *)); if (!omx_videoenc_component_Private->ports) { return OMX_ErrorInsufficientResources; } for (i=0; i < omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) { omx_videoenc_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType)); if (!omx_videoenc_component_Private->ports[i]) { return OMX_ErrorInsufficientResources; } } } base_video_port_Constructor(openmaxStandComp, &omx_videoenc_component_Private->ports[0], 0, OMX_TRUE); base_video_port_Constructor(openmaxStandComp, &omx_videoenc_component_Private->ports[1], 1, OMX_FALSE); /** Domain specific section for the ports. * first we set the parameter common to both formats */ //common parameters related to input port inPort = (omx_base_video_PortType *)omx_videoenc_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]; inPort->sPortParam.format.video.nFrameWidth = 176; inPort->sPortParam.format.video.nFrameHeight = 144; inPort->sPortParam.nBufferSize = inPort->sPortParam.format.video.nFrameWidth* inPort->sPortParam.format.video.nFrameHeight*3/2; //YUV 420 inPort->sPortParam.format.video.xFramerate = 25; inPort->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; inPort->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420Planar; //common parameters related to output port outPort = (omx_base_video_PortType *)omx_videoenc_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]; outPort->sPortParam.nBufferSize = FF_MIN_BUFFER_SIZE; outPort->sPortParam.format.video.xFramerate = 25; outPort->sPortParam.format.video.nFrameWidth = 176; outPort->sPortParam.format.video.nFrameHeight = 144; /** now it's time to know the video coding type of the component */ if(!strcmp(cComponentName, VIDEO_ENC_MPEG4_NAME)) { omx_videoenc_component_Private->video_encoding_type = OMX_VIDEO_CodingMPEG4; } else if (!strcmp(cComponentName, VIDEO_ENC_BASE_NAME)) { omx_videoenc_component_Private->video_encoding_type = OMX_VIDEO_CodingUnused; } else { // IL client specified an invalid component name DEBUG(DEB_LEV_ERR, "In valid component name\n"); return OMX_ErrorInvalidComponentName; } if(!omx_videoenc_component_Private->avCodecSyncSem) { omx_videoenc_component_Private->avCodecSyncSem = calloc(1,sizeof(tsem_t)); if(omx_videoenc_component_Private->avCodecSyncSem == NULL) { return OMX_ErrorInsufficientResources; } tsem_init(omx_videoenc_component_Private->avCodecSyncSem, 0); } SetInternalVideoEncParameters(openmaxStandComp); omx_videoenc_component_Private->eOutFramePixFmt = PIX_FMT_YUV420P; if(omx_videoenc_component_Private->video_encoding_type == OMX_VIDEO_CodingMPEG4) { omx_videoenc_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4; } /** general configuration irrespective of any video formats * setting other parameters of omx_videoenc_component_private */ omx_videoenc_component_Private->avCodec = NULL; omx_videoenc_component_Private->avCodecContext= NULL; omx_videoenc_component_Private->avcodecReady = OMX_FALSE; omx_videoenc_component_Private->BufferMgmtCallback = omx_videoenc_component_BufferMgmtCallback; /** initializing the coenc context etc that was done earlier by ffmpeglibinit function */ omx_videoenc_component_Private->messageHandler = omx_videoenc_component_MessageHandler; omx_videoenc_component_Private->destructor = omx_videoenc_component_Destructor; openmaxStandComp->SetParameter = omx_videoenc_component_SetParameter; openmaxStandComp->GetParameter = omx_videoenc_component_GetParameter; openmaxStandComp->ComponentRoleEnum = omx_videoenc_component_ComponentRoleEnum; noVideoEncInstance++; if(noVideoEncInstance > MAX_COMPONENT_VIDEOENC) { return OMX_ErrorInsufficientResources; } return eError; }
/** The Constructor * @param openmaxStandComp the component handle to be constructed * @param cComponentName is the name of the constructed component */ OMX_ERRORTYPE omx_video_scheduler_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName) { OMX_ERRORTYPE err = OMX_ErrorNone; omx_video_scheduler_component_PrivateType* omx_video_scheduler_component_Private; omx_base_video_PortType *inPort,*outPort; OMX_U32 i; if (!openmaxStandComp->pComponentPrivate) { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__); openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_video_scheduler_component_PrivateType)); if(openmaxStandComp->pComponentPrivate == NULL) { return OMX_ErrorInsufficientResources; } } else { DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate); } omx_video_scheduler_component_Private = openmaxStandComp->pComponentPrivate; omx_video_scheduler_component_Private->ports = NULL; /** we could create our own port structures here * fixme maybe the base class could use a "port factory" function pointer? */ err = omx_base_filter_Constructor(openmaxStandComp, cComponentName); omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0; omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2; omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nStartPortNumber = CLOCKPORT_INDEX; omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts = 1; /** Allocate Ports and call port constructor. */ if ((omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts + omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && !omx_video_scheduler_component_Private->ports) { omx_video_scheduler_component_Private->ports = calloc((omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts + omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts), sizeof(omx_base_PortType *)); if (!omx_video_scheduler_component_Private->ports) { return OMX_ErrorInsufficientResources; } for (i=0; i < omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) { omx_video_scheduler_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType)); if (!omx_video_scheduler_component_Private->ports[i]) { return OMX_ErrorInsufficientResources; } } base_video_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX], 0, OMX_TRUE); base_video_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX], 1, OMX_FALSE); omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX] = calloc(1, sizeof(omx_base_clock_PortType)); if (!omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX]) { return OMX_ErrorInsufficientResources; } base_clock_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX], 2, OMX_TRUE); omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX]->sPortParam.bEnabled = OMX_TRUE; } inPort = (omx_base_video_PortType *) omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]; outPort= (omx_base_video_PortType *) omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]; /** Domain specific section for the ports. */ //input port parameter settings inPort->sVideoParam.eColorFormat = OMX_COLOR_Format24bitRGB888; inPort->sPortParam.format.video.nFrameWidth = DEFAULT_WIDTH; inPort->sPortParam.format.video.nFrameHeight = DEFAULT_HEIGHT; inPort->sPortParam.nBufferSize = DEFAULT_VIDEO_INPUT_BUF_SIZE * 2 ; inPort->sPortParam.format.video.eColorFormat = OMX_COLOR_Format24bitRGB888; outPort->sVideoParam.eColorFormat = OMX_COLOR_Format24bitRGB888; outPort->sPortParam.format.video.nFrameWidth = DEFAULT_WIDTH; outPort->sPortParam.format.video.nFrameHeight = DEFAULT_HEIGHT; outPort->sPortParam.nBufferSize = DEFAULT_VIDEO_INPUT_BUF_SIZE * 2; outPort->sPortParam.format.video.eColorFormat = OMX_COLOR_Format24bitRGB888; omx_video_scheduler_component_Private->destructor = omx_video_scheduler_component_Destructor; omx_video_scheduler_component_Private->BufferMgmtCallback = omx_video_scheduler_component_BufferMgmtCallback; inPort->FlushProcessingBuffers = omx_video_scheduler_component_port_FlushProcessingBuffers; openmaxStandComp->SetParameter = omx_video_scheduler_component_SetParameter; openmaxStandComp->GetParameter = omx_video_scheduler_component_GetParameter; /* resource management special section */ omx_video_scheduler_component_Private->nqualitylevels = VIDEOSCHED_QUALITY_LEVELS; omx_video_scheduler_component_Private->currentQualityLevel = 1; omx_video_scheduler_component_Private->multiResourceLevel = malloc(sizeof(multiResourceDescriptor *) * VIDEOSCHED_QUALITY_LEVELS); for (i = 0; i<VIDEOSCHED_QUALITY_LEVELS; i++) { omx_video_scheduler_component_Private->multiResourceLevel[i] = malloc(sizeof(multiResourceDescriptor)); omx_video_scheduler_component_Private->multiResourceLevel[i]->CPUResourceRequested = videoSchedQualityLevels[i * 2]; omx_video_scheduler_component_Private->multiResourceLevel[i]->MemoryResourceRequested = videoSchedQualityLevels[i * 2 + 1]; } return err; }
OMX_ERRORTYPE base_camera_video_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput) { omx_base_camera_video_PortType *omx_base_video_Port; if(!(*openmaxStandPort)) { OMXDBUG(OMXDBUG_ERR, "Input openmaxStandPort is NULL!\n"); *openmaxStandPort = calloc(1, sizeof(omx_base_camera_video_PortType)); } if(!(*openmaxStandPort)) { return OMX_ErrorInsufficientResources; } base_video_port_Constructor(openmaxStandComp, openmaxStandPort, nPortIndex, isInput); omx_base_video_Port = (omx_base_camera_video_PortType *)*openmaxStandPort; omx_base_video_Port->nSensorSelect = -1; omx_base_video_Port->isCapture = OMX_FALSE; omx_base_video_Port->bCapturePause = OMX_FALSE; omx_base_video_Port->pCapMode = calloc(1, sizeof(OMX_CONFIG_CAPTUREMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapMode, OMX_CONFIG_CAPTUREMODETYPE); omx_base_video_Port->pCapMode->nPortIndex = nPortIndex; omx_base_video_Port->pCapMode->bContinuous = OMX_FALSE; omx_base_video_Port->pCapMode->bFrameLimited = OMX_FALSE; omx_base_video_Port->pCapMode->nFrameLimit = 0; omx_base_video_Port->pCapExtMode = calloc(1, sizeof(OMX_CONFIG_EXTCAPTUREMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapExtMode, OMX_CONFIG_EXTCAPTUREMODETYPE); omx_base_video_Port->pCapExtMode->nPortIndex = nPortIndex; omx_base_video_Port->pCapExtMode->nFrameBefore = 0; omx_base_video_Port->pCapExtMode->bPrepareCapture = OMX_FALSE; /* Banding Config, default Auto */ omx_base_video_Port->pFlicktype = calloc(1, sizeof(OMX_CONFIG_FLICKERREJECTIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFlicktype, OMX_CONFIG_FLICKERREJECTIONTYPE); omx_base_video_Port->pFlicktype->nPortIndex = nPortIndex; omx_base_video_Port->pFlicktype->eFlickerRejection = OMX_FlickerRejectionAuto; /* Noise reduce, default as closed */ omx_base_video_Port->pNs_level = calloc(1, sizeof(OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pNs_level, OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE); omx_base_video_Port->pNs_level->nPortIndex = nPortIndex; omx_base_video_Port->pNs_level->bAuto = OMX_FALSE; omx_base_video_Port->pNs_level->nLevel = 0; /* Sharpness enhance,only supoort one level */ omx_base_video_Port->pSharp_level = calloc(1, sizeof(OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSharp_level, OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE); omx_base_video_Port->pSharp_level->nPortIndex = nPortIndex; omx_base_video_Port->pNs_level->bAuto = OMX_FALSE; omx_base_video_Port->pNs_level->nLevel = 0; omx_base_video_Port->pAF_Dis = calloc(1, sizeof(OMX_ACT_CONFIG_FOCUSDISTANCETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAF_Dis, OMX_ACT_CONFIG_FOCUSDISTANCETYPE); omx_base_video_Port->pAF_Dis->nPortIndex = nPortIndex; //Gamma Table,Default is 2.2 omx_base_video_Port->pGamma = calloc(1, sizeof(OMX_CONFIG_GAMMATYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pGamma, OMX_CONFIG_GAMMATYPE); omx_base_video_Port->pGamma->nPortIndex = nPortIndex; omx_base_video_Port->pGamma->nGamma = (22 * (1 << 16)) / 10; omx_base_video_Port->pBlitComp = calloc(1, sizeof(OMX_ACT_CONFIG_BLITCOMPENSATIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pBlitComp, OMX_ACT_CONFIG_BLITCOMPENSATIONTYPE); omx_base_video_Port->pBlitComp->nPortIndex = nPortIndex; omx_base_video_Port->pBlitComp->eControl = OMX_ACT_BceModeOff; //omx_base_video_Port->pCapMode = calloc(1,sizeof(OMX_CONFIG_CAPTUREMODETYPE)); //OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapMode,OMX_CONFIG_CAPTUREMODETYPE); //omx_base_video_Port->pCapMode->nPortIndex = nPortIndex; //omx_base_video_Port->pCapMode->bContinuous = OMX_FALSE; //omx_base_video_Port->pCapMode->bFrameLimited = OMX_FALSE; omx_base_video_Port->pFlashType = calloc(1, sizeof(OMX_IMAGE_PARAM_FLASHCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFlashType, OMX_IMAGE_PARAM_FLASHCONTROLTYPE); omx_base_video_Port->pFlashType->nPortIndex = nPortIndex; omx_base_video_Port->pFlashType->eFlashControl = OMX_IMAGE_FlashControlOff; omx_base_video_Port->pFocusType = calloc(1, sizeof(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFocusType, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE); omx_base_video_Port->pFocusType->nPortIndex = nPortIndex; omx_base_video_Port->pFocusType->eFocusControl = OMX_IMAGE_FocusControlOff;//Control by user only when nFocusSteps > 0 omx_base_video_Port->pSensorMode = calloc(1, sizeof(OMX_PARAM_SENSORMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSensorMode, OMX_PARAM_SENSORMODETYPE); omx_base_video_Port->pSensorMode->nPortIndex = nPortIndex; omx_base_video_Port->pSensorMode->nFrameRate = DEFAULT_FPS; omx_base_video_Port->pSensorMode->bOneShot = OMX_FALSE;//Default is Video Mode omx_base_video_Port->pSensorMode->sFrameSize.nSize = sizeof(OMX_FRAMESIZETYPE); omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nVersionMajor = 1; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nVersionMinor = 1; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nRevision = 0; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nStep = 0; omx_base_video_Port->pSensorMode->sFrameSize.nPortIndex = nPortIndex; omx_base_video_Port->pSensorMode->sFrameSize.nWidth = DEFAULT_WIDTH; omx_base_video_Port->pSensorMode->sFrameSize.nHeight = DEFAULT_HEIGHT; omx_base_video_Port->pColorFix = calloc(1, sizeof(OMX_CONFIG_COLORCONVERSIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pColorFix, OMX_CONFIG_COLORCONVERSIONTYPE); omx_base_video_Port->pColorFix->nPortIndex = nPortIndex; omx_base_video_Port->pColorFix->xColorMatrix[0][0] = 257 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[0][1] = 504 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[0][2] = 98 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][0] = -148 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][1] = -291 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][2] = 439 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][0] = 439 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][1] = -368 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][2] = -71 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorOffset[0] = 16 * (1 << 16); omx_base_video_Port->pColorFix->xColorOffset[1] = 128 * (1 << 16); omx_base_video_Port->pColorFix->xColorOffset[2] = 128 * (1 << 16); omx_base_video_Port->pColorEft = calloc(1, sizeof(OMX_CONFIG_COLORENHANCEMENTTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pColorEft, OMX_CONFIG_COLORENHANCEMENTTYPE); omx_base_video_Port->pColorEft->bColorEnhancement = OMX_FALSE; omx_base_video_Port->pImageFilter = calloc(1, sizeof(OMX_CONFIG_IMAGEFILTERTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pImageFilter, OMX_CONFIG_IMAGEFILTERTYPE); omx_base_video_Port->pImageFilter->nPortIndex = nPortIndex; omx_base_video_Port->pImageFilter->eImageFilter = OMX_ImageFilterNone; omx_base_video_Port->pImageMirror = calloc(1, sizeof(OMX_CONFIG_MIRRORTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pImageMirror, OMX_CONFIG_MIRRORTYPE); omx_base_video_Port->pImageMirror->nPortIndex = nPortIndex; omx_base_video_Port->pImageMirror->eMirror = OMX_MirrorNone; omx_base_video_Port->pOpticZoomType = calloc(1, sizeof(OMX_CONFIG_SCALEFACTORTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pOpticZoomType, OMX_CONFIG_SCALEFACTORTYPE); omx_base_video_Port->pOpticZoomType->nPortIndex = nPortIndex; omx_base_video_Port->pOpticZoomType->xWidth = 0;//Not Used omx_base_video_Port->pOpticZoomType->xHeight = 0; omx_base_video_Port->pWBType = calloc(1, sizeof(OMX_CONFIG_WHITEBALCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pWBType, OMX_CONFIG_WHITEBALCONTROLTYPE); omx_base_video_Port->pWBType->nPortIndex = nPortIndex; omx_base_video_Port->pWBType->eWhiteBalControl = OMX_WhiteBalControlAuto; omx_base_video_Port->pExpType = calloc(1, sizeof(OMX_CONFIG_EXPOSURECONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pExpType, OMX_CONFIG_EXPOSURECONTROLTYPE); omx_base_video_Port->pExpType->nPortIndex = nPortIndex; omx_base_video_Port->pExpType->eExposureControl = OMX_ExposureControlAuto; omx_base_video_Port->pContrast = calloc(1, sizeof(OMX_CONFIG_CONTRASTTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pContrast, OMX_CONFIG_CONTRASTTYPE); omx_base_video_Port->pContrast->nPortIndex = nPortIndex; omx_base_video_Port->pContrast->nContrast = 0; omx_base_video_Port->pBright = calloc(1, sizeof(OMX_CONFIG_BRIGHTNESSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pBright, OMX_CONFIG_BRIGHTNESSTYPE); omx_base_video_Port->pBright->nPortIndex = nPortIndex; omx_base_video_Port->pBright->nBrightness = 0; omx_base_video_Port->pSat = calloc(1, sizeof(OMX_CONFIG_SATURATIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSat, OMX_CONFIG_SATURATIONTYPE); omx_base_video_Port->pSat->nPortIndex = nPortIndex; omx_base_video_Port->pSat->nSaturation = 0; omx_base_video_Port->pExpVal = calloc(1, sizeof(OMX_CONFIG_EXPOSUREVALUETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pExpVal, OMX_CONFIG_EXPOSUREVALUETYPE); omx_base_video_Port->pExpVal->nPortIndex = nPortIndex; omx_base_video_Port->pExpVal->eMetering = OMX_MeteringModeAverage; omx_base_video_Port->pHdrParam = calloc(1, sizeof(OMX_ACT_CONFIG_HDR_EVParams)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pHdrParam, OMX_ACT_CONFIG_HDR_EVParams); omx_base_video_Port->pExpVal->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegionL = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFRegionL, OMX_CONFIG_FOCUSREGIONTYPE); omx_base_video_Port->pAFRegionL->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegionL->bCenter = OMX_FALSE; omx_base_video_Port->pAFRegionL->bLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bRight = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTop = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottom = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTopLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTopRight = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottomLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottomRight = OMX_FALSE; omx_base_video_Port->pAFStatusL = calloc(1, sizeof(OMX_PARAM_FOCUSSTATUSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFStatusL, OMX_PARAM_FOCUSSTATUSTYPE); omx_base_video_Port->pAFStatusL->eFocusStatus = OMX_FocusStatusOff; omx_base_video_Port->pAFStatusL->bCenterStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bRightStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopRightStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomRightStatus = OMX_FALSE; omx_base_video_Port->pAFRegion = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFRegion, OMX_CONFIG_FOCUSREGIONCONTROLTYPE); //omx_base_video_Port->pAFRegion->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegion->nFAreas = 1; omx_base_video_Port->pAFRegion->eFocusRegionsControl = OMX_FocusRegionControlAuto; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectX = DEFAULT_WIDTH / 2 - 32; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectY = DEFAULT_HEIGHT / 2 - 32; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectWidth = 64; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectHeight = 64; omx_base_video_Port->pAFStatus = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONSTATUSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFStatus, OMX_CONFIG_FOCUSREGIONSTATUSTYPE); omx_base_video_Port->pAFStatus->bFocused = OMX_FALSE; omx_base_video_Port->pAFStatus->nMaxFAreas = 1; omx_base_video_Port->pAFStatus->nFAreas = 1; omx_base_video_Port->pAFStatus->sFROIs[0].nRectX = DEFAULT_WIDTH / 2 - 32; omx_base_video_Port->pAFStatus->sFROIs[0].nRectY = DEFAULT_HEIGHT / 2 - 32; omx_base_video_Port->pAFStatus->sFROIs[0].nRectWidth = 64; omx_base_video_Port->pAFStatus->sFROIs[0].nRectHeight = 64; omx_base_video_Port->pAFStatus->sFROIs[0].xFocusDistance = 0; omx_base_video_Port->pAFStatus->sFROIs[0].eFocusStatus = OMX_FocusStatusOff; omx_base_video_Port->act_agc = calloc(1, sizeof(OMX_ACT_CONFIG_AGCVALUE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->act_agc, OMX_ACT_CONFIG_AGCVALUE); omx_base_video_Port->act_agc->nPortIndex = 0; omx_base_video_Port->act_flashstrobe = calloc(1, sizeof(OMX_ACT_CONFIG_FlashStrobeParams)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->act_flashstrobe, OMX_ACT_CONFIG_FlashStrobeParams); omx_base_video_Port->act_flashstrobe->nPortIndex = 0; omx_base_video_Port->queue_dq = calloc(1, sizeof(queue_t)); queue_init(omx_base_video_Port->queue_dq); if(isInput == OMX_FALSE && nPortIndex == 0) { //OUTPUT setHeader(&omx_base_video_Port->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); omx_base_video_Port->sVideoParam.nPortIndex = nPortIndex; omx_base_video_Port->sVideoParam.nIndex = 0; omx_base_video_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sVideoParam.xFramerate = (25 << 16); omx_base_video_Port->sPortParam.eDomain = OMX_PortDomainVideo; #ifndef _OPENMAX_V1_2_ omx_base_video_Port->sPortParam.format.video.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); strcpy(omx_base_video_Port->sPortParam.format.video.cMIMEType, "video/camera"); #endif omx_base_video_Port->sPortParam.format.video.pNativeRender = 0; omx_base_video_Port->sPortParam.format.video.bFlagErrorConcealment = OMX_FALSE; omx_base_video_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sPortParam.format.video.nFrameWidth = 0; omx_base_video_Port->sPortParam.format.video.nFrameHeight = 0; omx_base_video_Port->sPortParam.format.video.nStride = 0; omx_base_video_Port->sPortParam.format.video.nSliceHeight = 0; omx_base_video_Port->sPortParam.format.video.nBitrate = 0; omx_base_video_Port->sPortParam.format.video.xFramerate = (25 << 16); omx_base_video_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.format.video.pNativeWindow = NULL; //Video Capture omx_base_video_Port->sPortParam.nBufferCountMin = 6; omx_base_video_Port->sPortParam.nBufferCountActual = 6; } else if(isInput == OMX_FALSE && nPortIndex == 1) { //OUTPUT omx_base_video_Port->pSensorMode->bOneShot = OMX_TRUE;//Default is Video Mode setHeader(&omx_base_video_Port->sImageParam, sizeof(OMX_IMAGE_PARAM_PORTFORMATTYPE)); omx_base_video_Port->sImageParam.nPortIndex = nPortIndex; omx_base_video_Port->sImageParam.nIndex = 0; omx_base_video_Port->sImageParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sImageParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.eDomain = OMX_PortDomainImage; #ifndef _OPENMAX_V1_2_ if(omx_base_video_Port->sPortParam.format.video.cMIMEType) { free(omx_base_video_Port->sPortParam.format.video.cMIMEType); omx_base_video_Port->sPortParam.format.video.cMIMEType = NULL; } omx_base_video_Port->sPortParam.format.image.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); strcpy(omx_base_video_Port->sPortParam.format.image.cMIMEType, "video/camera"); #endif omx_base_video_Port->sPortParam.format.image.pNativeRender = 0; omx_base_video_Port->sPortParam.format.image.bFlagErrorConcealment = OMX_FALSE; omx_base_video_Port->sPortParam.format.image.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sPortParam.format.image.nFrameWidth = 0; omx_base_video_Port->sPortParam.format.image.nFrameHeight = 0; omx_base_video_Port->sPortParam.format.image.nStride = 0; omx_base_video_Port->sPortParam.format.image.nSliceHeight = 0; omx_base_video_Port->sPortParam.format.image.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.format.image.pNativeWindow = NULL; //Image Capture omx_base_video_Port->sPortParam.nBufferCountMin = 2; omx_base_video_Port->sPortParam.nBufferCountActual = 2; } omx_base_video_Port->pBufferHeadAct = NULL; //Module_Cap_Init(omx_base_video_Port,nPortIndex); omx_base_video_Port->omx_camera = calloc(1, sizeof(OMX_CAMERATYPE)); omx_base_video_Port->omx_camera->nSize = sizeof(OMX_CAMERATYPE); omx_base_video_Port->omx_camera->pApplicationPrivate = (void *)omx_base_video_Port; omx_base_video_Port->omx_camera->pIppHnale = omx_base_video_Port->device_handle; omx_base_video_Port->sPortParam.nBufferSize = DEFAULT_WIDTH * DEFAULT_HEIGHT * 3 / 2 + 4096; omx_base_video_Port->PortDestructor = &camera_video_port_Destructor; omx_base_video_Port->Port_AllocateBuffer = &camera_video_port_AllocateBuffer; omx_base_video_Port->Port_UseBuffer = &camera_video_port_UseBuffer; omx_base_video_Port->Port_FreeBuffer = &camera_video_port_FreeBuffer; return OMX_ErrorNone; }
OSCL_EXPORT_REF OMX_ERRORTYPE videoenc_port_Constructor( OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput) { unsigned int i; OMX_ERRORTYPE err = OMX_ErrorNone; omx_videoenc_PortType *omx_videoenc_Port; if (!(*openmaxStandPort)) { *openmaxStandPort = calloc(1, sizeof(omx_videoenc_PortType)); } if (!(*openmaxStandPort)) { return OMX_ErrorInsufficientResources; } memset(*openmaxStandPort, 0, sizeof(omx_videoenc_PortType)); err = base_video_port_Constructor(openmaxStandComp, openmaxStandPort, nPortIndex, isInput); if(err != OMX_ErrorNone){ DEBUG(DEB_LEV_ERR, "err!The video port constructor failed in %s,%d\n", __func__, __LINE__); return err; } omx_videoenc_Port = (omx_videoenc_PortType *)(*openmaxStandPort); if(isInput == OMX_TRUE) { //in port omx_videoenc_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_videoenc_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_videoenc_Port->sVideoParam.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); omx_videoenc_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_videoenc_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_videoenc_Port->sPortParam.format.video.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); #ifndef _OPENMAX_V1_2_ strcpy(omx_videoenc_Port->sPortParam.format.video.cMIMEType, CMIMEType_Video_Raw); #endif } else if(isInput == OMX_FALSE && nPortIndex == 1) { //out port omx_videoenc_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingAVC; omx_videoenc_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatUnused; omx_videoenc_Port->sVideoParam.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); omx_videoenc_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC; omx_videoenc_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatUnused; omx_videoenc_Port->sPortParam.format.video.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); #ifndef _OPENMAX_V1_2_ strcpy(omx_videoenc_Port->sPortParam.format.video.cMIMEType, CMIMEType_Video_Avc); #endif } else { //sync port omx_videoenc_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_videoenc_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatUnused; omx_videoenc_Port->sVideoParam.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); omx_videoenc_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_videoenc_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatUnused; omx_videoenc_Port->sPortParam.format.video.xFramerate = (DEFAULT_FRAMERATE_AVC<<16); #ifndef _OPENMAX_V1_2_ strcpy(omx_videoenc_Port->sPortParam.format.video.cMIMEType, CMIMEType_Video_FaceDet); #endif } omx_videoenc_Port->bIsStoreMediaData = OMX_FALSE; omx_videoenc_Port->pMVC = OMX_FALSE; omx_videoenc_Port->bconfig_changed = OMX_FALSE; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pquanty,OMX_VIDEO_PARAM_QUANTIZATIONTYPE,nPortIndex); omx_videoenc_Port->pquanty.nQpI = 24; omx_videoenc_Port->pquanty.nQpP = 24; omx_videoenc_Port->pquanty.nQpB = 24; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pconfig_avcperiod, OMX_VIDEO_CONFIG_AVCINTRAPERIOD, nPortIndex); omx_videoenc_Port->pconfig_avcperiod.nPFrames = 30; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pbitrate, OMX_VIDEO_PARAM_BITRATETYPE,nPortIndex); omx_videoenc_Port->pbitrate.eControlRate = OMX_Video_ControlRateDisable; omx_videoenc_Port->pbitrate.nTargetBitrate = 0; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pprofile, OMX_VIDEO_PARAM_PROFILELEVELTYPE, nPortIndex); omx_videoenc_Port->pprofile.eLevel = OMX_VIDEO_AVCLevel31; omx_videoenc_Port->pprofile.eProfile = OMX_VIDEO_AVCProfileBaseline; #ifndef _OPENMAX_V1_2_ omx_videoenc_Port->pprofile.nProfileIndex = 0; #else omx_videoenc_Port->pprofile.nIndex = 0; #endif OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pconfig_framerate, OMX_CONFIG_FRAMERATETYPE, nPortIndex); omx_videoenc_Port->pconfig_framerate.xEncodeFramerate = (DEFAULT_FRAMERATE_AVC<<16); OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pconfig_bitrate, OMX_VIDEO_CONFIG_BITRATETYPE, nPortIndex); omx_videoenc_Port->pconfig_bitrate.nEncodeBitrate = 0; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pconfig_crop, OMX_CONFIG_RECTTYPE, nPortIndex); OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pconfig_vopfresh, OMX_CONFIG_INTRAREFRESHVOPTYPE, nPortIndex); omx_videoenc_Port->pconfig_vopfresh.IntraRefreshVOP = OMX_FALSE; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pavctype, OMX_VIDEO_PARAM_AVCTYPE, nPortIndex); omx_videoenc_Port->pavctype.nBFrames = 0; omx_videoenc_Port->pavctype.bEntropyCodingCABAC = OMX_TRUE; omx_videoenc_Port->pavctype.bUseHadamard = OMX_TRUE; omx_videoenc_Port->pavctype.nRefFrames = 1; omx_videoenc_Port->pavctype.eProfile = OMX_VIDEO_AVCProfileBaseline; omx_videoenc_Port->pavctype.eLevel = OMX_VIDEO_AVCLevel31; omx_videoenc_Port->pavctype.nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP); OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pConfigTumb, OMX_ACT_PARAM_THUMBPARAM,nPortIndex); omx_videoenc_Port->pConfigTumb.nWidth = 64; omx_videoenc_Port->pConfigTumb.nHeight = 64; omx_videoenc_Port->pConfigTumb.bThumbEnable = OMX_FALSE; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pExifInfo, OMX_ACT_PARAM_EXIFPARAM, nPortIndex); { int mgpsLATH[3] = {22,18,0}; int mgpsLATL[3] = {1,1,1}; int mgpsLONGH[3] = {113,31,0}; int mgpsLONGL[3] = {1,1,1}; int mgpsTimeH[3] = {16,45,12}; int mgpsTimeL[3] = {1,1,1}; omx_videoenc_Port->pExifInfo.bExifEnable = OMX_FALSE; omx_videoenc_Port->pExifInfo.ImageOri = 1; omx_videoenc_Port->pExifInfo.dataTime = (char *)malloc(128); strcpy(omx_videoenc_Port->pExifInfo.dataTime,"2012.9.11"); omx_videoenc_Port->pExifInfo.exifmake = (char *)malloc(128); strcpy(omx_videoenc_Port->pExifInfo.exifmake,"tsh"); omx_videoenc_Port->pExifInfo.exifmodel = (char *)malloc(128); strcpy(omx_videoenc_Port->pExifInfo.exifmodel,"act_exif_model"); omx_videoenc_Port->pExifInfo.gpsDate = (char *)malloc(128); strcpy(omx_videoenc_Port->pExifInfo.gpsDate,"2012.9.12"); omx_videoenc_Port->pExifInfo.gpsprocessMethod = (char *)malloc(128); strcpy(omx_videoenc_Port->pExifInfo.gpsprocessMethod,"act_gps_model"); omx_videoenc_Port->pExifInfo.bGPS = OMX_TRUE; omx_videoenc_Port->pExifInfo.focalLengthH = 720; omx_videoenc_Port->pExifInfo.focalLengthL = 1; for (i = 0; i < 3; i++) { omx_videoenc_Port->pExifInfo.gpsLATH[i] = mgpsLATH[i]; omx_videoenc_Port->pExifInfo.gpsLATL[i] = mgpsLATL[i]; omx_videoenc_Port->pExifInfo.gpsLONGH[i] = mgpsLONGH[i]; omx_videoenc_Port->pExifInfo.gpsLONGL[i] = mgpsLONGL[i]; omx_videoenc_Port->pExifInfo.gpsTimeH[i] = mgpsTimeH[i]; omx_videoenc_Port->pExifInfo.gpsTimeL[i] = mgpsTimeL[i]; } } OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pActTsPacket, OMX_ACT_PARAM_TsPacketType, nPortIndex); omx_videoenc_Port->pActTsPacket.TsPacketType = OMX_TsPacket_Disable; OMX_PARAMETER_INIT_STRUCT(&omx_videoenc_Port->pIquanty, OMX_IMAGE_PARAM_QFACTORTYPE, nPortIndex); omx_videoenc_Port->pIquanty.nQFactor = 80; OMX_VCE_Buffer_Info *pList = omx_videoenc_Port->BuffersMng_List.pList; omx_videoenc_Port->BuffersMng_List.Actual_Buffers = 0; for (i = 0; i < MAX_VCE_MNG_Buffers; i++) { pList[i].IsValid = OMX_FALSE; pList[i].InPutAddr = NULL; pList[i].PhyAddr = NULL; pList[i].VirAddr = NULL; pList[i].Ion_Size = 0; } omx_videoenc_Port->bufferpool = NULL; omx_videoenc_Port->ringbuffer = OMX_FALSE; omx_videoenc_Port->ringbuf_framesize = 100000; /* Byte/s */ omx_videoenc_Port->PortDestructor = &videoenc_port_Destructor; omx_videoenc_Port->FlushProcessingBuffers = &videoenc_port_FlushProcessingBuffers; omx_videoenc_Port->Port_AllocateBuffer = &videoenc_port_AllocateBuffer; omx_videoenc_Port->Port_UseBuffer = &videoenc_port_UseBuffer; omx_videoenc_Port->Port_FreeBuffer = &videoenc_port_FreeBuffer; omx_videoenc_Port->Port_SendBufferFunction = &videoenc_port_SendBufferFunction; omx_videoenc_Port->ReturnBufferFunction = &videoenc_port_ReturnBufferFunction; return OMX_ErrorNone; }