1 /******************************************************************************\
2 Copyright (c) 2005-2019, Intel Corporation
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 
7 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 
9 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 
11 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 
13 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 
15 This sample was distributed or derived from the Intel's Media Samples package.
16 The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
17 or https://software.intel.com/en-us/media-client-solutions-support.
18 \**********************************************************************************/
19 
20 #ifndef __MFX_MULTI_VPP_H
21 #define __MFX_MULTI_VPP_H
22 
23 // An interface for a pipeline consisting of multiple (maximum 3) VPP-like components. Base implementation - for single VPP.
24 // The application should use this interface to be able to seamlessly switch from MFXVideoVPP to MFXVideoVPPPlugin in the pipeline.
25 
26 class MFXVideoMultiVPP : public MFXVideoVPP
27 {
28 public:
29 
MFXVideoMultiVPP(mfxSession session)30     MFXVideoMultiVPP(mfxSession session) : MFXVideoVPP(session)
31     {}
~MFXVideoMultiVPP(void)32     virtual ~MFXVideoMultiVPP(void) { Close(); }
33 
34     // topology methods
QueryIOSurf(mfxVideoParam * par,mfxFrameAllocRequest * request)35     virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override { return QueryIOSurfMulti(par, request); }
36     virtual mfxStatus QueryIOSurfMulti(mfxVideoParam *par, mfxFrameAllocRequest request[2], mfxVideoParam* /*par1*/ = NULL, mfxVideoParam* /*par2*/ = NULL)
37     { return MFXVideoVPP_QueryIOSurf(m_session, par, request); }
38 
Init(mfxVideoParam * par)39     virtual mfxStatus Init(mfxVideoParam *par) override { return InitMulti(par); }
40     virtual mfxStatus InitMulti(mfxVideoParam *par, mfxVideoParam* /*par1*/ = NULL, mfxVideoParam* /*par2*/ = NULL)
41     { return MFXVideoVPP_Init(m_session, par); }
42 
Reset(mfxVideoParam * par)43     virtual mfxStatus Reset(mfxVideoParam *par) override { return ResetMulti(par); }
44     virtual mfxStatus ResetMulti(mfxVideoParam *par, mfxVideoParam* /*par1*/ = NULL, mfxVideoParam* /*par2*/ = NULL)
45     { return MFXVideoVPP_Reset(m_session, par); }
46 
RunFrameVPPAsync(mfxFrameSurface1 * in,mfxFrameSurface1 * out,mfxExtVppAuxData * aux,mfxSyncPoint * syncp)47     virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp) override
48     { return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp); }
49 
SyncOperation(mfxSyncPoint syncp,mfxU32 wait)50     virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait)
51     { return MFXVideoCORE_SyncOperation(m_session, syncp, wait);}
52 
Close(void)53     virtual mfxStatus Close(void) override { return MFXVideoVPP_Close(m_session); }
54 
55     // per-component methods
Query(mfxVideoParam * in,mfxVideoParam * out)56     virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override { return QueryMulti(in, out); }
57     virtual mfxStatus QueryMulti(mfxVideoParam *in, mfxVideoParam *out, mfxU8 /*component_idx*/ = 0)
58     { return MFXVideoVPP_Query(m_session, in, out); }
59 
GetVideoParam(mfxVideoParam * par)60     virtual mfxStatus GetVideoParam(mfxVideoParam *par) override { return GetVideoParamMulti(par); }
61     virtual mfxStatus GetVideoParamMulti(mfxVideoParam *par, mfxU8 /*component_idx*/ = 0)
62     { return MFXVideoVPP_GetVideoParam(m_session, par); }
63 
GetVPPStat(mfxVPPStat * stat)64     virtual mfxStatus GetVPPStat(mfxVPPStat *stat) override { return GetVPPStatMulti(stat); }
65     virtual mfxStatus GetVPPStatMulti(mfxVPPStat *stat, mfxU8 /*component_idx*/ = 0)
66     { return MFXVideoVPP_GetVPPStat(m_session, stat); }
67 };
68 
69 
70 #endif//__MFX_MULTI_VPP_H
71