1 /*!
2 * \copy
3 * Copyright (c) 2013, Cisco Systems
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #include "WelsFrameWork.h"
34
35 ///////////////////////////////////////////////////////////////////////
36
37 WELSVP_NAMESPACE_BEGIN
38
Init(void * pCtx,int32_t iType,void * pCfg)39 EResult Init (void* pCtx, int32_t iType, void* pCfg) {
40 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Init (iType, pCfg) : RET_INVALIDPARAM;
41 }
Uninit(void * pCtx,int32_t iType)42 EResult Uninit (void* pCtx, int32_t iType) {
43 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Uninit (iType) : RET_INVALIDPARAM;
44 }
Flush(void * pCtx,int32_t iType)45 EResult Flush (void* pCtx, int32_t iType) {
46 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Flush (iType) : RET_INVALIDPARAM;
47 }
Process(void * pCtx,int32_t iType,SPixMap * pSrc,SPixMap * dst)48 EResult Process (void* pCtx, int32_t iType, SPixMap* pSrc, SPixMap* dst) {
49 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Process (iType, pSrc, dst) : RET_INVALIDPARAM;
50 }
Get(void * pCtx,int32_t iType,void * pParam)51 EResult Get (void* pCtx, int32_t iType, void* pParam) {
52 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Get (iType, pParam) : RET_INVALIDPARAM;
53 }
Set(void * pCtx,int32_t iType,void * pParam)54 EResult Set (void* pCtx, int32_t iType, void* pParam) {
55 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->Set (iType, pParam) : RET_INVALIDPARAM;
56 }
SpecialFeature(void * pCtx,int32_t iType,void * pIn,void * pOut)57 EResult SpecialFeature (void* pCtx, int32_t iType, void* pIn, void* pOut) {
58 return pCtx ? WelsStaticCast (IWelsVP*, pCtx)->SpecialFeature (iType, pIn, pOut) : RET_INVALIDPARAM;
59 }
60
61 ///////////////////////////////////////////////////////////////////////////////
62
CreateSpecificVpInterface(IWelsVPc ** pCtx)63 EResult CreateSpecificVpInterface (IWelsVPc** pCtx) {
64 EResult ret = RET_FAILED;
65 IWelsVP* pWelsVP = NULL;
66
67 ret = CreateSpecificVpInterface (&pWelsVP);
68 if (ret == RET_SUCCESS) {
69 IWelsVPc* pVPc = new IWelsVPc;
70 if (pVPc) {
71 pVPc->Init = Init;
72 pVPc->Uninit = Uninit;
73 pVPc->Flush = Flush;
74 pVPc->Process = Process;
75 pVPc->Get = Get;
76 pVPc->Set = Set;
77 pVPc->SpecialFeature = SpecialFeature;
78 pVPc->pCtx = WelsStaticCast (void*, pWelsVP);
79 *pCtx = pVPc;
80 } else
81 ret = RET_OUTOFMEMORY;
82 }
83
84 return ret;
85 }
86
DestroySpecificVpInterface(IWelsVPc * pCtx)87 EResult DestroySpecificVpInterface (IWelsVPc* pCtx) {
88 if (pCtx) {
89 DestroySpecificVpInterface (WelsStaticCast (IWelsVP*, pCtx->pCtx));
90 delete pCtx;
91 }
92
93 return RET_SUCCESS;
94 }
95
96 WELSVP_NAMESPACE_END
97