basgroup.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:15k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #ifndef _BASICGROUP_H_
  36. #define _BASICGROUP_H_
  37. struct IHXValues;
  38. struct IHXGroup;
  39. struct IHXGroupManager;
  40. struct IHXGroupSink;
  41. struct IHXTrack;
  42. struct IHXStreamSource;
  43. class CHXSimpleList;
  44. class HXBasicGroup;
  45. class HXBasicGroupManager;
  46. class   HXPlayer;
  47. class CHXMapStringToOb;
  48. class HXBasicTrack;
  49. class   HXMasterTAC;
  50. class HXBasicTrack :  public IHXTrack
  51. {
  52. protected:
  53.     LONG32     m_lRefCount;
  54.     HXBasicGroup*           m_pHXGroup;
  55.     IHXValues*     m_pValues;
  56.     IHXValues*     m_pValuesInRequest;
  57.     BOOL     m_bActive;
  58.     virtual     ~HXBasicTrack();
  59.     PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME
  60.     friend class HXBasicGroup;
  61. public:
  62.     HXBasicTrack(HXBasicGroup* pHXGroup);
  63.     UINT16     m_uTrackIndex;
  64.     /*
  65.      *  IUnknown methods
  66.      */
  67.     STDMETHOD(QueryInterface)       (THIS_
  68.     REFIID riid,
  69.     void** ppvObj);
  70.     STDMETHOD_(ULONG32,AddRef)      (THIS);
  71.     STDMETHOD_(ULONG32,Release)     (THIS);
  72.     /*
  73.      *  IHXTrack methods
  74.      */
  75.     /************************************************************************
  76.     *  Method:
  77.     *     IHXTrack::Begin()
  78.     *  Purpose:
  79.     *     start the track
  80.     */
  81.     STDMETHOD(Begin) (THIS);
  82.     /************************************************************************
  83.     *  Method:
  84.     *     IHXTrack::Pause()
  85.     *  Purpose:
  86.     *     pause the track
  87.     */
  88.     STDMETHOD(Pause) (THIS);
  89.     /************************************************************************
  90.     *  Method:
  91.     *     IHXTrack::Seek()
  92.     *  Purpose:
  93.     *     seek the track
  94.     */
  95.     STDMETHOD(Seek) (THIS_
  96. UINT32 ulSeekTime);
  97.     /************************************************************************
  98.     *  Method:
  99.     *     IHXTrack::Stop()
  100.     *  Purpose:
  101.     *     stop the track
  102.     */
  103.     STDMETHOD(Stop) (THIS);
  104.     /************************************************************************
  105.     *  Method:
  106.     *     IHXTrack::AddRepeat()
  107.     *  Purpose:
  108.     *     add repeat tracks
  109.     */
  110.     STDMETHOD(AddRepeat)(THIS_
  111. IHXValues* pValues);
  112.     /************************************************************************
  113.     *  Method:
  114.     *     IHXTrack::GetTrackProperties()
  115.     *  Purpose:
  116.     *     get track properties
  117.     */
  118.     STDMETHOD(GetTrackProperties)(THIS_
  119.  REF(IHXValues*) pValues,
  120.  REF(IHXValues*) pValuesInRequest);
  121.     /************************************************************************
  122.      * Method:
  123.      *     IHXTrack::GetSource
  124.      * Purpose:
  125.      *     Returns the Nth source instance supported by this player.
  126.      */
  127.     STDMETHOD(GetSource) (THIS_
  128. REF(IHXStreamSource*) pStreamSource);
  129.     /************************************************************************
  130.     *  Method:
  131.     *     IHXTrack::SetSoundLevel()
  132.     *  Purpose:
  133.     *     Set Audio Level
  134.     */
  135.     STDMETHOD(SetSoundLevel)(THIS_
  136.     UINT16 uSoundLevel);
  137.     /************************************************************************
  138.     *  Method:
  139.     *     IHXTrack::GetSoundLevel()
  140.     *  Purpose:
  141.     *     Get Audio Level
  142.     */
  143.     STDMETHOD_(UINT16, GetSoundLevel)(THIS);
  144.     /************************************************************************
  145.     *  Method:
  146.     *     IHXTrack::BeginSoundLevelAnimation()
  147.     *  Purpose:
  148.     *     notify the start of soundlevel animation
  149.     */
  150.     STDMETHOD(BeginSoundLevelAnimation)(THIS_
  151. UINT16 uSoundLevelBeginWith);
  152.     /************************************************************************
  153.     *  Method:
  154.     *     IHXTrack::EndSoundLevelAnimation()
  155.     *  Purpose:
  156.     *     notify the stop of soundlevel animation
  157.     */
  158.     STDMETHOD(EndSoundLevelAnimation)(THIS_
  159.       UINT16 uSoundLevelEndWith);
  160.     virtual HX_RESULT SetTrackProperties(IHXValues* pValues,
  161.            IHXValues* pValuesInRequest);    
  162.     virtual void        Close(void);
  163. };
  164. class HXBasicGroup :  public IHXGroup
  165. {
  166. protected:
  167.     LONG32     m_lRefCount;
  168.     HXBasicGroupManager*    m_pGroupManager;
  169.     HXPlayer*     m_pPlayer;
  170.     BOOL     m_bToNotifyTrack;    
  171.     UINT16     m_uTrackCount;
  172.     CHXMapLongToObj*     m_pTrackMap;
  173.     virtual     ~HXBasicGroup();
  174.     PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME
  175.     HX_RESULT       DoGetTrack(UINT16 uTrackIndex, 
  176.                                REF(IHXValues*) pTrack, 
  177.                                REF(IHXValues*) pTrackPropInRequest);
  178.     HX_RESULT       DoAddTrack(IHXValues* pTrack,
  179.                                IHXValues* pTrackPropInRequest,
  180.                                HXBasicTrack* pHXTrack);
  181.         
  182.     void     StartTrackNotification(void);
  183.     friend class HXBasicTrack;
  184.     friend class HXBasicGroupManager;
  185.     friend class HXPlayer;
  186. #if defined(HELIX_FEATURE_ADVANCEDGROUPMGR)
  187.     friend class HXAdvancedTrack;
  188.     friend class HXAdvancedGroupManager;
  189. #endif /* HELIX_FEATURE_ADVANCEDGROUPMGR */
  190. public:
  191.     UINT16     m_uGroupIndex;
  192.     HXBasicGroup(HXBasicGroupManager* pManager);
  193.     /*
  194.      *  IUnknown methods
  195.      */
  196.     STDMETHOD(QueryInterface)       (THIS_
  197.     REFIID riid,
  198.     void** ppvObj);
  199.     STDMETHOD_(ULONG32,AddRef)      (THIS);
  200.     STDMETHOD_(ULONG32,Release)     (THIS);
  201.     /*
  202.      *  IHXGroup methods
  203.      */
  204.     /************************************************************************
  205.     *  Method:
  206.     *      IHXGroup::SetGroupProperties
  207.     *  Purpose:
  208.     * Set any group specific information like Title Author 
  209.     * Copyright etc. 
  210.     */
  211.     STDMETHOD(SetGroupProperties)   (THIS_
  212.      IHXValues*  /*IN*/ pProperties);
  213.     /************************************************************************
  214.     *  Method:
  215.     *      IHXGroup::GetGroupProperties
  216.     *  Purpose:
  217.     * Get any group specific information. May return NULL.
  218.     */
  219.     STDMETHOD_(IHXValues*, GetGroupProperties)   (THIS);
  220.     /************************************************************************
  221.     *  Method:
  222.     *      IHXGroup::GetTrackCount
  223.     *  Purpose:
  224.     * Get the number of tracks within this group.
  225.     */
  226.     STDMETHOD_(UINT16,GetTrackCount)    (THIS);
  227.     /************************************************************************
  228.     *  Method:
  229.     *      IHXGroup::GetTrack
  230.     *  Purpose:
  231.     * Call this to hook audio data after all audio streams in this
  232.     * have been mixed.
  233.     */
  234.     STDMETHOD(GetTrack) (THIS_
  235. UINT16      /*IN*/ uTrackIndex,
  236. REF(IHXValues*)  /*OUT*/ pTrack);
  237.     /************************************************************************
  238.     *  Method:
  239.     *      IHXGroup::AddTrack
  240.     *  Purpose:
  241.     * Add Tracks to the group.
  242.     */
  243.     STDMETHOD(AddTrack) (THIS_
  244. IHXValues* /*IN*/ pTrack);
  245.     /************************************************************************
  246.     *  Method:
  247.     *      IHXGroup::RemoveTrack
  248.     *  Purpose:
  249.     * Remove an already added track
  250.     */
  251.     STDMETHOD(RemoveTrack)  (THIS_
  252.     UINT16 /*IN*/ uTrackIndex);
  253.     /* Other public fuctions */
  254.     virtual HX_RESULT CurrentGroupSet(void);
  255.     virtual void Close(void);
  256. };
  257. class HXBasicGroupManager : public IHXGroupManager,
  258.     public IHXPreCacheGroupMgr
  259. {
  260. protected:
  261.     LONG32 m_lRefCount;
  262.     CHXMapLongToObj* m_pGroupMap;
  263.     CHXSimpleList* m_pSinkList;
  264.     IHXValues* m_pPresentationProperties;
  265.     
  266.     // required for precache support
  267.     UINT16     m_uGroupCount;
  268.     UINT16     m_uCurrentGroup;
  269.     UINT16      m_uNextGroup;
  270.     BOOL      m_bDefaultNextGroup;
  271.     BOOL     m_bCurrentGroupInitialized;
  272.     HXPlayer*     m_pPlayer;
  273.     virtual     ~HXBasicGroupManager();
  274.     PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME
  275.     HX_RESULT     TrackAdded (UINT16 uGroupIndex, UINT16 uTrackIndex, IHXValues* pTrack);
  276.     HX_RESULT     TrackRemoved(UINT16 uGroupIndex, UINT16 uTrackIndex, IHXValues* pTrack);
  277.     void      RemoveAllGroup(void);
  278.     friend class HXBasicGroup;
  279.     friend class HXPlayer;
  280. #if defined(HELIX_FEATURE_ADVANCEDGROUPMGR)
  281.     friend class HXAdvancedGroup;
  282. #endif /* HELIX_FEATURE_ADVANCEDGROUPMGR */
  283. public:
  284.     HXBasicGroupManager(HXPlayer* pPlayer = NULL);
  285.     /*
  286.      *  IUnknown methods
  287.      */
  288.     STDMETHOD(QueryInterface)       (THIS_
  289.     REFIID riid,
  290.     void** ppvObj);
  291.     STDMETHOD_(ULONG32,AddRef)      (THIS);
  292.     STDMETHOD_(ULONG32,Release)     (THIS);
  293.     /*
  294.      *  IHXGroupManager methods
  295.      */
  296.     /************************************************************************
  297.     *  Method:
  298.     *      IHXGroupManager::CreateGroup
  299.     *  Purpose:
  300.     * Create a group
  301.     */
  302.     STDMETHOD(CreateGroup)    (REF(IHXGroup*) pGroup);
  303.     /************************************************************************
  304.     *  Method:
  305.     *      IHXGroupManager::GetGroupCount
  306.     *  Purpose:
  307.     * Get the number of groups within the presentation.
  308.     */
  309.     STDMETHOD_(UINT16,GetGroupCount)    (THIS);
  310.     /************************************************************************
  311.     *  Method:
  312.     *      IHXGroupManager::GetGroup
  313.     *  Purpose:
  314.     * Get ith group in the presentation
  315.     */
  316.     STDMETHOD(GetGroup) (THIS_
  317. UINT16    /*IN*/  uGroupIndex,
  318. REF(IHXGroup*)  /*OUT*/ pGroup);
  319.     /************************************************************************
  320.     *  Method:
  321.     *      IHXGroupManager::SetCurrentGroup
  322.     *  Purpose:
  323.     * Play this group in the presentation.
  324.     */
  325.     STDMETHOD(SetCurrentGroup) (THIS_
  326. UINT16      /*IN*/ uGroupIndex);
  327.     /************************************************************************
  328.     *  Method:
  329.     *      IHXGroupManager::GetCurrentGroup
  330.     *  Purpose:
  331.     * Get current group index
  332.     */
  333.     STDMETHOD(GetCurrentGroup) (THIS_
  334. REF(UINT16) /*OUT*/ uGroupIndex);
  335.     /************************************************************************
  336.     *  Method:
  337.     *      IHXGroupManager::AddGroup
  338.     *  Purpose:
  339.     * Add a group to the presentation.
  340.     */
  341.     STDMETHOD(AddGroup) (THIS_
  342. IHXGroup*     /*IN*/ pGroup);
  343.     /************************************************************************
  344.     *  Method:
  345.     *      IHXGroupManager::RemoveGroup
  346.     *  Purpose:
  347.     * Remove an already added group
  348.     */
  349.     STDMETHOD(RemoveGroup)  (THIS_
  350.     UINT16  /*IN*/ uGroupIndex);
  351.     /************************************************************************
  352.     *  Method:
  353.     *      IHXGroupManager::AddSink
  354.     *  Purpose:
  355.     * Add a sink to get notifications about any tracks or groups
  356.     * being added to the presentation.
  357.     */
  358.     STDMETHOD(AddSink) (THIS_
  359. IHXGroupSink* /*IN*/ pGroupSink);
  360.     /************************************************************************
  361.     *  Method:
  362.     *      IHXGroupManager::RemoveSink
  363.     *  Purpose:
  364.     * Remove Sink
  365.     */
  366.     STDMETHOD(RemoveSink)   (THIS_
  367.     IHXGroupSink* /*IN*/ pGroupSink);
  368.     /************************************************************************
  369.     *  Method:
  370.     *      IHXGroupManager::SetPresentationProperties
  371.     *  Purpose:
  372.     * Set any presentation information like Title Author 
  373.     * Copyright etc. 
  374.     */
  375.     STDMETHOD(SetPresentationProperties)   (THIS_
  376.     IHXValues*  /*IN*/ pProperties);
  377.     /************************************************************************
  378.     *  Method:
  379.     *      IHXGroupManager::GetPresentationProperties
  380.     *  Purpose:
  381.     * Get any presentation information. May return NULL.
  382.     */
  383.     STDMETHOD_(IHXValues*, GetPresentationProperties)   (THIS);
  384.     /************************************************************************
  385.     *  Method:
  386.     *      IHXPreCacheGroupMgr::SetNextGroup
  387.     *  Purpose:
  388.     * Play this as the next group in the presentation.
  389.     */
  390.     STDMETHOD(SetNextGroup) (THIS_
  391. UINT16      /*IN*/ uGroupIndex);
  392.                 
  393.     /************************************************************************
  394.     *  Method:
  395.     *      IHXPreCacheGroupMgr::GetNextGroup
  396.     *  Purpose:
  397.     * Get the next group to be played in the presentation.
  398.     */
  399.     STDMETHOD(GetNextGroup) (THIS_ REF(UINT16) uGroupIndex);
  400.     /************************************************************************
  401.     *  Method:
  402.     *      IHXPreCacheGroupMgr::DefaultNextGroup
  403.     *  Purpose:
  404.     * Reset to default the next group to play in the presentation.
  405.     */
  406.     STDMETHOD(DefaultNextGroup) (THIS);
  407.     virtual void     SetMasterTAC(HXMasterTAC* pMasterTAC);
  408.     virtual HX_RESULT     TrackStarted(UINT16 uGroupIndex, UINT16 uTrackIndex);
  409.     virtual HX_RESULT     TrackStopped(UINT16 uGroupIndex, UINT16 uTrackIndex);
  410.     virtual void     PersistentComponentAdded(UINT16 uGroupIndex, UINT16 uTrackIndex);
  411.     virtual void     PersistentComponentRemoved(UINT16 uGroupIndex, UINT16 uTrackIndex);
  412.     virtual HX_RESULT     InsertGroupAt(UINT16 uGroupIndex, IHXGroup* pGroup);
  413.     virtual void            Close(void);
  414. };
  415. #endif /*_BASICGROUP_H_*/