qtffplin.h

来自「symbian 下的helix player源代码」· C头文件 代码 · 共 346 行

H
346
字号
/* ***** 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 ***** */ 

#ifndef _QTFFPLIN_H_
#define _QTFFPLIN_H_

/****************************************************************************
 *  Defines
 */
#define QTFF_RDT_FORMAT	    0
#define QTFF_RTP_FORMAT	    1

#define MAX_QTFORMAT_FLAVOR 0x07
#define MAX_QTFLAVORS	    (MAX_QTFORMAT_FLAVOR + 1)

#define QTASM_MARKER_ON_RULE	1
#define QTASM_MARKER_OFF_RULE	0


/****************************************************************************
 *  Includes
 */
#include "hxcom.h"
#include "hxplugn.h"
#include "hxformt.h"
#include "hxfiles.h"
#include "hxerror.h"
#include "hxasm.h"
#include "fswtchr.h"
#include "atomizer.h"
#include "qtatmmgs.h"
#include "qttrkmgr.h"
#include "qtpacketizerfct.h"
#ifdef QTCONFIG_BFRAG
#include "bfrag.h"
#endif	// QTCONFIG_BFRAG
#ifdef QTCONFIG_BFRAG_FACTORY
#include "bfragfct.h"
#endif	// QTCONFIG_BFRAG_FACTORY
#include "qtffrefcounter.h"


/****************************************************************************
 * 
 *  Class:
 *	CQTFileFormat
 *
 *  Purpose:
 *	Implements Quick Time File Format
 */
class CQTFileFormat :	public IHXPlugin, 
			public IHXFileFormatObject, 
			public IHXFileResponse,
			public IHXAtomizationCommander,
			public IHXAtomizerResponse,
			public IHXThreadSafeMethods,
			public IHXASMSource,
			public IHXPacketFormat
{
public:
    /*
     *	Constructor
     */
    CQTFileFormat();

    /*
     *	IUnknown methods
     */
    STDMETHOD(QueryInterface)	(THIS_
				REFIID riid,
				void** ppvObj);

    STDMETHOD_(ULONG32,AddRef)	(THIS);

    STDMETHOD_(ULONG32,Release)	(THIS);

    /*
     *	IHXPlugin methods
     */
    STDMETHOD(GetPluginInfo)	(THIS_
				REF(BOOL) bLoadMultiple,
				REF(const char*) pDescription,
				REF(const char*) pCopyright,
				REF(const char*) pMoreInfoURL,
				REF(ULONG32) ulVersionNumber
				);

    STDMETHOD(InitPlugin)   (THIS_
			    IUnknown*   /*IN*/  pContext);

    /*
     *	IHXFileFormatObject methods
     */
    STDMETHOD(GetFileFormatInfo)    
				(THIS_
				REF(const char**) pFileMimeTypes,
				REF(const char**) pFileExtensions,
				REF(const char**) pFileOpenNames);

    STDMETHOD(InitFileFormat)	
			(THIS_
		        IHXRequest* pRequest, 
			IHXFormatResponse* pFormatResponse,
			IHXFileObject* pFileObject);

    STDMETHOD(Close)		(THIS);

    STDMETHOD(GetFileHeader)	(THIS);

    STDMETHOD(GetStreamHeader)	(THIS_
				UINT16 unStreamNumber);
    
    STDMETHOD(GetPacket)	(THIS_
				UINT16 unStreamNumber);

    STDMETHOD(Seek)		(THIS_
				ULONG32 ulOffset);

    /*
     *	IHXFileResponse
     */
    STDMETHOD(InitDone)	    (THIS_
			    HX_RESULT status);

    STDMETHOD(CloseDone)    (THIS_
			    HX_RESULT status);

    STDMETHOD(ReadDone)	    (THIS_ 
		    	    HX_RESULT status,
			    IHXBuffer* pBuffer);

    STDMETHOD(WriteDone)    (THIS_ 
			    HX_RESULT status);

    STDMETHOD(SeekDone)	    (THIS_ 
			    HX_RESULT status);

    /*
     *	IHXAtomizationCommander
     */
    STDMETHOD_(QTAtomizerCmd,GetAtomCommand)	(THIS_
						QTAtomType AtomType,
						CQTAtom* pParent);


    /*
     *	IHXAtomizerResponse
     */
    STDMETHOD(AtomReady)    (THIS_
			    HX_RESULT status,
			    CQTAtom* pRootAtom);

    /*
     *	IHXThreadSafeMethods
     */
    STDMETHOD_(UINT32,IsThreadSafe)(THIS);

    /*
     *	IHXASMSource methods
     */
    STDMETHOD (Subscribe)   (THIS_
			    UINT16 uStreamNumber,
			    UINT16 uRuleNumber);

    STDMETHOD (Unsubscribe) (THIS_
			    UINT16 uStreamNumber,
			    UINT16 uRuleNumber);

    /*
     *	IHXPacketFormat methods
     */
    STDMETHOD(GetSupportedPacketFormats)    (THIS_
					    REF(const char**) pFormats);

    STDMETHOD(SetPacketFormat)		    (THIS_
					    const char* pFormat);

    /*
     *	Main Interface
     */
    HX_RESULT PacketReady(UINT16 uStreamNum, 
			  HX_RESULT status, 
			  IHXPacket* pPacket);

    IUnknown* GetContext(void)	    { return m_pContext; }

    ULONG32 GetPacketFormat(void)   { return m_ulPacketFormat; }

    HX_RESULT BuildStreamHeader(IHXValues* &pHeader,
				CQTTrack* pTrack,
				CQT_TrackInfo_Manager* pTrackInfo,
				CQT_MovieInfo_Manager* pMovieInfo,
				CQTTrackManager* pTrackManager,
				IHXCommonClassFactory* pClassFactory);

    /*
     *	Public Managers
     */
    CQT_MovieInfo_Manager m_MovieInfo;
    CQTTrackManager m_TrackManager;

#ifdef QTCONFIG_BFRAG_FACTORY
    CBufferFragmentFactory* m_pBufferFragmentFactory;
#endif	// QTCONFIG_BFRAG_FACTORY

protected:
    virtual CQTPacketizerFactory* BuildPacketizerFactory(void);

    virtual HX_RESULT GetSessionIdentity(IHXValues* pHeader,
					 CQT_MovieInfo_Manager* pMovieInfo);

    virtual HX_RESULT GetPayloadIdentity(IHXValues* pHeader,
					 CQTTrack* pTrack,
					 CQT_TrackInfo_Manager* pTrackInfo);

    virtual ~CQTFileFormat(); 

    IUnknown* m_pContext;
    IHXCommonClassFactory* m_pClassFactory;
    IHXFormatResponse* m_pFFResponse;

private:
    typedef enum
    {
	QTFF_Offline,
	QTFF_Ready,
	QTFF_Error,
	QTFF_Init,
	QTFF_Atomize,
	QTFF_GetPacket,
	QTFF_PrimeCache,
	QTFF_SeekPending
    } QTFileFormatState;

    class CPacketCache
    {
    public:
	CPacketCache(void)
	    : pPacket(NULL)
	    , bPending(FALSE)
	    , bStreamDone(FALSE)    {;}

	~CPacketCache()	{ HX_RELEASE(pPacket); }

	IHXPacket* pPacket;
	BOOL	    bPending;
	BOOL	    bStreamDone;
    };

    inline UINT16 GetNextPacketStreamNum(void);
    HX_RESULT MakeFileHeader(HX_RESULT status);
    HX_RESULT ObtainStreamHeader(UINT16 unStreamNumber,
				 IHXValues* &pHeader);
    HX_RESULT AddMetaInfo(IHXValues* pHeader);
    HX_RESULT ExtractAcceptMetaInfo(IHXBuffer* pRequestedInfoBuffer);
    HX_RESULT HandleFailure(HX_RESULT status);

    HX_RESULT CheckLicense(void);
    void      ReportError(UINT32 ulErrorID, HX_RESULT retVal);
    HX_RESULT GetResourceErrorString(UINT32 ulErrorID, CHXString& rErrorStr);

    void  WarnIfNotHinted(HX_RESULT status, BOOL bIgnoreHintTracks);
    
    IHXScheduler* m_pScheduler;

    IHXErrorMessages*	m_pErrorMessages;
    BOOL		m_bQTLicensed;
    BOOL                m_bMP4Licensed;

    BOOL		m_bViewSourceRequest;

    UINT8		m_uFormatFlavor;
    
    IHXRequest* m_pRequest;

    static const char* const zm_pDescription;
    static const char* const zm_pCopyright;
    static const char* const zm_pMoreInfoURL;
    
    static const char* const zm_pFileMimeTypes[];
    static const char* const zm_pFileExtensions[];
    static const char* const zm_pFileOpenNames[];
    static const char* const zm_pPacketFormats[];

    IHXFileSwitcher* m_pFileSwitcher;
    CAtomizer* m_pAtomizer;
    CQTPacketAssembler* m_pPacketAssembler;

    ULONG32 m_ulPendingSeekTime;

    CPacketCache* m_pPacketCache;
    UINT16 m_uNextPacketStreamNum;
    QTFileFormatState m_State;

    ULONG32 m_ulPacketFormat;

    LONG32 m_lRefCount;

    //	Values for mask
    typedef enum
    {
	META_INFO_NONE = 0,
	META_INFO_ALL = 1,
	META_INFO_WIDTH = 2,
	META_INFO_HEIGHT = 4
    } eMetaInfoRequest;

    UINT32 m_ulStreamMetaInfoMask;
};


#endif // ndef _QTFFPLIN_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?