msg_plat/smil_engine_api/inc/smilmedia.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: smilmedia  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SMILMEDIA_H
       
    21 #define SMILMEDIA_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 #include <smilmediainterface.h>
       
    27 #include <smilfocusinterface.h>
       
    28 
       
    29 #include "smiltimecontainer.h"
       
    30 #include "smilregioninterface.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class MSmilMediaRenderer;
       
    34 class CSmilTransitionFilter;
       
    35 class CSmilTransition;
       
    36 class CSmilArea;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 class CSmilMedia : public CSmilTimeContainer, public MSmilMedia, public MSmilFocus
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44 		virtual const TDesC* ClassName() const { _LIT(KN,"CSmilMedia"); return &KN; }
       
    45 
       
    46 		static CSmilMedia* NewL(CSmilPresentation* aPresentation);
       
    47         
       
    48         virtual ~CSmilMedia();
       
    49 		
       
    50     public: // New functions
       
    51 
       
    52 		/**
       
    53 		* Returns the region where this media is supposed to be rendered on. May be NULL.
       
    54 		*/ 
       
    55 		MSmilRegion* GetRegion() const;
       
    56 
       
    57 		/**
       
    58 		* Returns the rectangle (region) where the media is supposed to be rendered on.
       
    59 		*/
       
    60 		TRect GetRectangle() const;
       
    61 
       
    62 		/**
       
    63 		* Invoked by renderer to ask redrawing of area covered by the media. 
       
    64 		* This should be invoked when (visual) media appears, there are changes to it, and 
       
    65 		* when it is removed.
       
    66 		*/
       
    67 		void Redraw();
       
    68 
       
    69 		/** 
       
    70 		* Invoked by a MSmillMediaRenderer object when there is a change 
       
    71 		* in (known) state of its intrinsic values. For example, duration of 
       
    72 		* video clip is not typically known until it is at least partially 
       
    73 		* decoded. This method should be invoked by the renderer when this 
       
    74 		* information becomes available.
       
    75 		*/
       
    76 		void RendererDurationChangedL();
       
    77 
       
    78 		/**
       
    79 		* Invoked by a MSmillMediaRenderer object when the associated media 
       
    80 		* ends (end of the file or stream is reached). Renderer should also 
       
    81 		* move to frozen state at this point (that is, to keep showing the last 
       
    82 		* frame). 
       
    83 		*/
       
    84 		void RendererAtEndL();
       
    85 
       
    86 		/**
       
    87 		* Presentation
       
    88 		*/
       
    89 		CSmilPresentation* Presentation() const;
       
    90 
       
    91 		/**
       
    92 		 * Get name media parameter, or empty TPtrC if not found
       
    93 		 */
       
    94 		TPtrC GetParam(const TDesC& aName) const;
       
    95         
       
    96         /**
       
    97 		 * Returns begin time of media relative to presentation begin time.
       
    98 		 */
       
    99 		TSmilTime MediaBegin() const;
       
   100         
       
   101         /**
       
   102 		 * Returns end time of media relative to presentation begin time.
       
   103 		 */
       
   104 		TSmilTime MediaEnd() const;
       
   105 		
       
   106 		TPtrC Src() const { return iSrc.Text(); }
       
   107 		TPtrC Alt() const { return iAlt.Text(); }
       
   108 		TPtrC Type() const { return iType.Text(); }
       
   109 
       
   110 		void SetAltL( const TDesC &aPtr );
       
   111 		void SetSrcL( const TDesC& aString );	
       
   112 		void SetTypeL( const TDesC& aString );
       
   113 	
       
   114 		void ForceRepeat( TBool aBool );	        		
       
   115 		
       
   116 		void SetRegion( MSmilRegion* aRegion ) { iRegion=aRegion; }
       
   117 
       
   118 		MSmilMediaRenderer* GetRenderer() const { return iRenderer; }
       
   119 		
       
   120 		void TransitionFilterEnd(CSmilTransitionFilter* );
       
   121 
       
   122 		void SetFocus(TBool aFocus) { iFocus = aFocus;}
       
   123 		TBool HasFocus() const { return iFocus; }
       
   124 
       
   125 		TBool IsFocusable() const;
       
   126 		void SetFocusable(TBool aFocusable) { iFocusable = aFocusable;}
       
   127 
       
   128 		void Unfreeze();	
       
   129 
       
   130 		virtual void SetPaused(TBool aPaused);
       
   131 
       
   132 		TPoint Center() const { return GetRectangle().Center(); }
       
   133 
       
   134 		TSmilTime ClipBegin() { return iClipBegin; }
       
   135 		TSmilTime ClipEnd() { return iClipEnd; }
       
   136 
       
   137 		void AfterL(MSmilActive* iActive, const TSmilTime& aDelay, TBool aLazy = EFalse);
       
   138 		void CancelActive(MSmilActive* aActive);
       
   139 
       
   140 		CSmilTransitionFilter* ActiveTransitionFilter() const;
       
   141 
       
   142 		void AddParamL(const TDesC& aName, const TDesC& aValue);
       
   143 
       
   144 		TBool IsVisible() const;
       
   145 		TBool IsScrollable() const;
       
   146 
       
   147 		TSmilTime PredictedRemovalTime() const;
       
   148 
       
   149 		CSmilArea* GetArea();
       
   150 
       
   151     protected:  // Functions from base classes
       
   152 
       
   153 		CSmilMedia();
       
   154         
       
   155 		virtual void ProceedL( const TSmilTime& aTime );
       
   156 		virtual void ResolveL( const TSmilTime& aTps );
       
   157 
       
   158 		virtual void RepeatL( const TSmilTime& aTime );
       
   159 		virtual void BeginL( const TSmilTime& aTime );
       
   160 
       
   161 		virtual void EndL( const TSmilTime& aTime );
       
   162 
       
   163 		virtual TSmilTime ImplicitDuration() const;
       
   164 
       
   165 		TSmilTime NextActivation( const TSmilTime& aTime ) const;
       
   166 
       
   167 		TBool IsMedia() const { return ETrue; }			
       
   168 
       
   169 		// from MSmilFocus
       
   170 		TRect Rect() const { return GetRectangle(); }
       
   171 		TShape Shape() const { return ERect; }
       
   172 		const CArrayFixFlat<TPoint>* PolyPoints() const { return 0; }
       
   173 		TBool IsSelected() const;
       
   174 
       
   175 	private:
       
   176 		void CreateRendererL(const TSmilTime& aRecalcTime);
       
   177 
       
   178 	protected:
       
   179 		RSmilTextBuf			iSrc;
       
   180 		RSmilTextBuf			iAlt;
       
   181 		RSmilTextBuf			iType;
       
   182 
       
   183 		TBool					iFocus;
       
   184 		TBool					iFocusable;
       
   185 
       
   186     private:    // Data
       
   187 		MSmilRegion*			iRegion;
       
   188 		MSmilMediaRenderer*		iRenderer;
       
   189 		
       
   190 		CSmilTransitionFilter*	iTransitionFilter;
       
   191 
       
   192 	public:		
       
   193 		CSmilTransition*		iTransitionIn;		
       
   194 		CSmilTransition*		iTransitionOut;	
       
   195 
       
   196 		struct CNameValuePair
       
   197 			{
       
   198 			~CNameValuePair() { delete iName; delete iValue; }
       
   199 			HBufC* iName;
       
   200 			HBufC* iValue;
       
   201 			};
       
   202 		RPointerArray<CNameValuePair> iParams;
       
   203 
       
   204 		TSmilTime iClipBegin;
       
   205 		TSmilTime iClipEnd;
       
   206 
       
   207     };
       
   208 
       
   209 #endif      // ?INCLUDE_H   
       
   210             
       
   211 // End of File