rv20api.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:15k
- /* ***** BEGIN LICENSE BLOCK *****
- * Version: RCSL 1.0/RPSL 1.0
- *
- * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
- *
- * The contents of this file, and the files included with this file, are
- * subject to the current version of the RealNetworks Public Source License
- * Version 1.0 (the "RPSL") available at
- * http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the RealNetworks Community Source License Version 1.0
- * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
- * in which case the RCSL will apply. You may also obtain the license terms
- * directly from RealNetworks. You may not use this file except in
- * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
- * applicable to this file, the RCSL. Please see the applicable RPSL or
- * RCSL for the rights, obligations and limitations governing use of the
- * contents of the file.
- *
- * This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the portions
- * it created.
- *
- * This file, and the files included with this file, is distributed and made
- * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- *
- * Technology Compatibility Kit Test Suite(s) Location:
- * http://www.helixcommunity.org/content/tck
- *
- * Contributor(s):
- *
- * ***** END LICENSE BLOCK ***** */
- ///////////////////
- // include files
- #include "hxtypes.h"
- #include "hxresult.h"
- #include "hxassert.h"
- #include "hxcodec.h"
- #include "dllpath.h"
- #include "hxmtypes.h"
- #include "hxheap.h"
- #ifdef _DEBUG
- #undef HX_THIS_FILE
- static const char HX_THIS_FILE[] = __FILE__;
- #endif
- ENABLE_DLLACCESS_PATHS(RV20);
- HX_RESULT RV20CreateInstance(IHXUnknown *pUnkOuter, HX_IID riid, void **ppv);
- ///////////////////
- // local definitions
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_Open
- //
- // Purpose:
- // PNCodec_Open() attempts to load a codec whose type is specified
- // by moftFormatTag. Some currently used codec HX_MOFTAGs are:
- // RA_FORMAT_3_ID RealAudio 14.4 audio codec
- // RA_FORMAT_4_ID RealAudio 28.8 audio codec
- //
- // Parameters:
- // moftFormatTag - the 4 byte codec identifier
- // codecRef - the HXCODEC reference is returned in codecRef.
- // You will need to use this reference in all future HXCodec_XXX() functions.
- //
- // Return:
- // S_OK - loading of codec was successful.
- // HXR_OUTOFMEMORY - insufficient memory to load codec.
- // HXCODEC_LOAD_ERR - unable to load codec.
- //
- // Notes:
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_Open)(HX_MOFTAG moftFormatTag, HXCODEC *pcodecRef)
- {
- HX_TRACE("PNCodec_Open()rn");
- HX_RESULT theErr = S_OK;
- HX_ASSERT_VALID_PTR(pcodecRef);
- *pcodecRef = NULL;
- theErr = RV20CreateInstance(NULL, moftFormatTag, pcodecRef);
- return(theErr);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_Close
- //
- // Purpose:
- // PNCodec_Close() closes a codec referenced by codecRef.
- // Note: After calling PNCodec_Close(), codecRef is no longer a valid
- // codec reference.
- //
- // Parameters:
- // codecRef - the codec reference returned by PNCodec_Open().
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_Close)(HXCODEC codecRef)
- {
- HX_TRACE("PNCodec_Close()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_Close();
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_GetUIName
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_GetUIName)(HXCODEC codecRef, char *pnameBuf)
- {
- HX_TRACE("PNCodec_GetUIName()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_GetUIName(pnameBuf);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_GetVersion
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_GetVersion)(HXCODEC codecRef, ULONG32 *pVersion)
- {
- HX_TRACE("PNCodec_GetVersion()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_GetVersion(pVersion);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_QueryMediaFormat
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_QueryMediaFormat)(HXCODEC codecRef, HX_MOF * pmofIn,
- HX_MOF * pmofOut, UINT16 ioDirection)
- {
- HX_TRACE("PNCodec_QueryMediaFormat()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_QueryMediaFormat(pmofIn, pmofOut, ioDirection);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_PreferredMediaFormat
- //
- // Purpose:
- // ioDirection Either HXCODEC_INPUT or HXCODEC_OUTPUT, HXCODEC_INPUT
- // specifies the pmofOut is filled out with the desired
- // output format and we want to find out what the perferred
- // input media format is.
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_PreferredMediaFormat)(HXCODEC codecRef, HX_MOF * pmofIn,
- HX_MOF * pmofOut, UINT16 ioDirection)
- {
- HX_TRACE("HXCodec_PerferredMediaFormat()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_PreferredMediaFormat(pmofIn, pmofOut, ioDirection);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_GetMediaFormats
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_GetMediaFormats)(HXCODEC codecRef, UINT16 ioDirection,
- FP_MEDIAFORMATSCALLBACK fpCallback, void *userData)
- {
- HX_TRACE("PNCodec_GetMediaFormats()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_GetMediaFormats(ioDirection, fpCallback,
- userData);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_StreamOpen
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_StreamOpen)(HXCODEC codecRef, HXSTREAM * pStreamRef,
- HXCODEC_INIT * pParams)
- {
- HX_TRACE("PNCodec_StreamOpen()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_StreamOpen(pStreamRef, pParams);
- }
- #ifdef ADD_HXCODEC_INPUT
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNCodec_Input
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNCodec_Input)(HXCODEC codecRef, HXCODEC_DATA * pData)
- {
- HX_TRACE("HXCodec_()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_Input(pData);
- }
- #endif
- #if defined ADD_HXCODEC_GETIPNUNKNOWN
- IHXUnknown * HXEXPORT ENTRYPOINT(PNCodec_GetIPNUnknown)(HXCODEC codecRef)
- {
- HX_TRACE("PNCodec_GetIPNUnknown()rn");
- HX_ASSERT_VALID_PTR(codecRef);
- IHX20Codec* pCodecObj = (IHX20Codec *)codecRef;
- return pCodecObj->PNCodec_GetIPNUnknown();
- }
- #endif
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_OpenSettingsBox
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_OpenSettingsBox)(HXSTREAM streamRef, void * platformData)
- {
- HX_TRACE("PNStream_OpenSettingsBox()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_OpenSettingsBox(platformData);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_GetIPNUnknown
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- IHXUnknown * HXEXPORT ENTRYPOINT(PNStream_GetIPNUnknown)(HXSTREAM streamRef)
- {
- HX_TRACE("PNStream_GetIPNUnknown()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_GetIPNUnknown();
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_SetDataCallback
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_SetDataCallback)(HXSTREAM streamRef,
- HXSTREAM callbackRef, HXMEMORY memoryRef, FP_STREAM_DATA fpDataCallback)
- {
- HX_TRACE("PNStream_SetDataCallback()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_SetDataCallback(callbackRef, memoryRef,
- fpDataCallback);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_SetProperty
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_SetProperty)(HXSTREAM streamRef, ULONG32 prop,
- void *pValue)
- {
- HX_TRACE("PNStream_SetProperty()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_SetProperty(prop, pValue);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_GetProperty
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_GetProperty)(HXSTREAM streamRef, ULONG32 prop,
- void *pValue)
- {
- HX_TRACE("PNStream_GetProperty()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_GetProperty(prop, pValue);
- }
- #ifdef HW_VIDEO_MEMORY_FRONTEND
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_PostProcess
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_PostProcess)(HXSTREAM streamRef,
- HXCODEC_DATA *pncData,
- ULONG32 uCurrentTime,
- UCHAR *pDestBuffer,
- UINT32 uDestPitch,
- INT32 cidDestColorFormat)
- {
- HX_TRACE("PNStream_PostProcess()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_PostProcess(pncData,
- uCurrentTime,
- pDestBuffer,
- uDestPitch,
- cidDestColorFormat);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_ReleaseFrame
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_ReleaseFrame)(HXSTREAM streamRef,
- HXCODEC_DATA *pncData)
- {
- HX_TRACE("PNStream_ReleaseFrame()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_ReleaseFrame(pncData);
- }
- #endif
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_Close
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_Close)(HXSTREAM streamRef)
- {
- HX_TRACE("PNStream_Close()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_Close();
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_GetStreamHeaderSize
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_GetStreamHeaderSize)(HXSTREAM streamRef,
- ULONG32 * puSize)
- {
- HX_TRACE("PNStream_GetStreamHeaderSize()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_GetStreamHeaderSize(puSize);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_GetStreamHeader
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_GetStreamHeader)(HXSTREAM streamRef, HX_MOF * pHeader)
- {
- HX_TRACE("PNStream_GetStreamHeaderSize()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_GetStreamHeader(pHeader);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_Input
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_Input)(HXSTREAM streamRef, HXSTREAM fromStreamRef,
- HXCODEC_DATA * pData)
- {
- HX_TRACE("HXStream_()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_Input(fromStreamRef, pData);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_SetOutputPacketSize
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_SetOutputPacketSize)(HXSTREAM streamRef,
- ULONG32 PrefSize, ULONG32 MaxSize, ULONG32 *pActualSize)
- {
- HX_TRACE("PNStream_SetOutputPacketSize()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_SetOutputPacketSize(PrefSize, MaxSize,
- pActualSize);
- }
- /////////////////////////////////////////////////////////////////////////////
- //
- // Function:
- //
- // PNStream_GetInputBufferSize
- //
- // Purpose:
- //
- //
- // Parameters:
- //
- //
- // Return:
- //
- //
- // Notes:
- //
- //
- HX_RESULT HXEXPORT ENTRYPOINT(PNStream_GetInputBufferSize)(HXSTREAM streamRef,
- ULONG32 * puSize)
- {
- HX_TRACE("HXStream_()rn");
- HX_ASSERT_VALID_PTR(streamRef);
- IHX20Stream* pStreamObj = (IHX20Stream *)streamRef;
- return pStreamObj->PNStream_GetInputBufferSize(puSize);
- }