qttrack.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:7k
- /* ***** 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 _QTTRACK_H_
- #define _QTTRACK_H_
- /****************************************************************************
- * Defines
- */
- #define QTTRK_USE_KEY_FRAMES FALSE
- #define QTTRK_USE_ANY_FRAME TRUE
- /****************************************************************************
- * Includes
- */
- #include "hxfiles.h"
- #include "hxfswch.h"
- #include "qtatmmgs.h"
- #include "hxformt.h"
- #include "qtmcache.h"
- class CQTPacketAssembler;
- class CQTFileFormat;
- class CQTPacketizerFactory;
- /****************************************************************************
- *
- * Class:
- * CQTTrack
- *
- * Purpose:
- * Implements Quick Time Track.
- */
- class CQTTrack : public IHXFileResponse,
- public IHXThreadSafeMethods
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQTTrack(CQTAtom* pTrackAtom);
- virtual ~CQTTrack();
- /*
- * Main Interafce
- */
- virtual HX_RESULT Init(CQTFileFormat* pFileFormat,
- CQTPacketAssembler* pPacketAssembler,
- CQTPacketizerFactory* pPacketizerFactory,
- const char* pProtocol = NULL);
- virtual void Close(void);
- virtual HX_RESULT Seek(ULONG32 ulTime); // Time given in miliseconds
- virtual HX_RESULT GetPacket(UINT16 uStreamNum);
- virtual HX_RESULT ComputeTrackSize(ULONG32& ulTrackSizeOut);
- ULONG32 GetID(void) { return m_ulTrackID; }
- HX_RESULT GetDataSegment(ULONG32 ulSampleNum,
- ULONG32 ulSampleOffset,
- ULONG32 ulSize);
- HX_RESULT GetCompressedDataSegment(ULONG32 ulSampleNum,
- ULONG32 ulSampleOffset,
- ULONG32 ulSize,
- UINT16 uBytesPerCBlock,
- UINT16 uSamplesPerCBlock);
- HX_RESULT GetSampleDescDataSegment(ULONG32 ulSampleDescIdx,
- ULONG32 ulSampleDescOffset,
- ULONG32 ulSize);
- HX_RESULT GetNextCompressedDataSegment(ULONG32 ulSize);
- ULONG32 GetLastSampleDescIdx(void) {return m_ulLastSampleDescIdx;}
- /*
- * IUnknown methods
- */
- STDMETHOD (QueryInterface ) (THIS_
- REFIID ID,
- void** ppInterfaceObj);
- STDMETHOD_(UINT32, AddRef ) (THIS);
- STDMETHOD_(UINT32, Release) (THIS);
- /*
- * IHXFileResponse methods
- */
- STDMETHOD(InitDone) (THIS_
- HX_RESULT status)
- {
- HX_ASSERT(HXR_NOTIMPL == HXR_OK);
- return HXR_NOTIMPL;
- }
- STDMETHOD(CloseDone) (THIS_
- HX_RESULT status)
- {
- HX_ASSERT(HXR_NOTIMPL == HXR_OK);
- return HXR_NOTIMPL;
- }
- STDMETHOD(ReadDone) (THIS_
- HX_RESULT status,
- IHXBuffer* pBuffer);
- STDMETHOD(WriteDone) (THIS_
- HX_RESULT status)
- {
- HX_ASSERT(HXR_NOTIMPL == HXR_OK);
- return HXR_NOTIMPL;
- }
- STDMETHOD(SeekDone) (THIS_
- HX_RESULT status);
-
- /*
- * IHXThreadSafeMethods
- */
- STDMETHOD_(UINT32,IsThreadSafe) (THIS);
- /*
- * Public Atom Managers
- */
- CQT_TrackInfo_Manager m_TrackInfo;
- CQT_SampleDescription_Manager m_SampleDesc;
- protected:
- /*
- * Protected functions
- */
- HX_RESULT InitPacketizer(IHXPayloadFormatObject* &pPacketizer,
- CQTPacketizerFactory* pPacketizerFactory,
- const char* pProtocol,
- CQT_TrackInfo_Manager* pTrackInfo,
- CQT_MovieInfo_Manager* pMovieInfo,
- CQTTrackManager* pTrackManager,
- CQTTrack* pTrack,
- IUnknown* pContext);
- HX_RESULT LoadData(IHXBuffer* pFileName,
- ULONG32 ulOffset,
- ULONG32 ulSize);
- HX_RESULT DataReady(HX_RESULT status,
- IHXBuffer *pBuffer);
- BOOL SequenceToTime(CQT_TrackEdit_Manager &TrackEdit,
- CQT_TimeToSample_Manager &TimeToSample,
- CQT_SampleToChunk_Manager &SampleToChunk,
- BOOL bUseNonKeyFrames);
- BOOL AdvanceSample(CQT_TrackEdit_Manager &TrackEdit,
- CQT_TimeToSample_Manager &TimeToSample,
- CQT_SampleToChunk_Manager &SampleToChunk);
- HX_RESULT ReturnPacket(HX_RESULT status,
- IHXBuffer* pBuffer);
- HX_RESULT ReturnPacket(HX_RESULT status,
- IHXBuffer* pBuffer,
- ULONG32 ulOffset,
- ULONG32 ulSize);
- /*
- * Protected Atom Managers
- */
- CQT_DataReference_Manager m_DataRef;
- CQT_SampleSize_Manager m_SampleSize;
-
- CQT_trak_Atom* m_pTrackAtom;
- CQTFileFormat* m_pFileFormat;
- CQTPacketAssembler* m_pPacketAssembler;
- IHXCommonClassFactory* m_pClassFactory;
- ULONG32 m_ulTrackID;
- ULONG32 m_ulReadSize;
- ULONG32 m_ulReadPageSize;
- ULONG32 m_ulReadPageOffset;
- IHXBuffer* m_pReadFileNameBuffer;
- char* m_pReadFileName;
- #ifdef QTCONFIG_TRACK_CACHE
- CQTMemCache m_TrackCache;
- #endif // QTCONFIG_TRACK_CACHE
- private:
- typedef enum
- {
- QTT_SampleRead,
- QTT_SegmentRead,
- QTT_Offline
- } QTTPendingState;
- QTTPendingState m_PendingState;
- BOOL m_bTrackDone;
- /*
- * Private Atom Managers
- */
- CQT_TrackEdit_Manager m_TrackEdit;
- CQT_TimeToSample_Manager m_TimeToSample;
- CQT_SampleToChunk_Manager m_SampleToChunk;
- CQT_ChunkToOffset_Manager m_ChunkToOffset;
- UINT16 m_uBytesPerCBlock;
- UINT16 m_uSamplesPerCBlock;
- UINT16 m_uStreamNumber;
- IHXPayloadFormatObject* m_pPacketizer;
- IHXFileSwitcher* m_pFileSwitcher;
-
- LONG32 m_lRefCount;
- ULONG32 m_ulLastSampleDescIdx;
- };
- #endif // _QTTRACK_H_