portimage.cpp revision e4197969e018f1f455d8a99ebabd51994b150506
1/* 2 * Copyright (C) 2009 Wind River Systems 3 * Author: Ho-Eun Ryu <ho-eun.ryu@windriver.com> 4 */ 5 6#include <stdlib.h> 7#include <string.h> 8 9#include <OMX_Core.h> 10#include <OMX_Component.h> 11 12#include <componentbase.h> 13#include <portimage.h> 14 15#define LOG_TAG "portimage" 16#include <log.h> 17 18PortImage::PortImage() 19{ 20 memset(&imageparam, 0, sizeof(imageparam)); 21 ComponentBase::SetTypeHeader(&imageparam, sizeof(imageparam)); 22} 23 24OMX_ERRORTYPE PortImage::SetPortImageParam( 25 const OMX_IMAGE_PARAM_PORTFORMATTYPE *p, bool internal) 26{ 27 if (!internal) { 28 OMX_ERRORTYPE ret; 29 30 ret = ComponentBase::CheckTypeHeader((void *)p, sizeof(*p)); 31 if (ret != OMX_ErrorNone) 32 return ret; 33 if (imageparam.nPortIndex != p->nPortIndex) 34 return OMX_ErrorBadPortIndex; 35 } 36 else 37 imageparam.nPortIndex = p->nPortIndex; 38 39 imageparam.nIndex = p->nIndex; 40 imageparam.eCompressionFormat = p->eCompressionFormat; 41 imageparam.eColorFormat = p->eColorFormat; 42 43 return OMX_ErrorNone; 44} 45 46const OMX_IMAGE_PARAM_PORTFORMATTYPE *PortImage::GetPortImageParam(void) 47{ 48 return &imageparam; 49} 50 51/* end of PortImage */ 52