os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/mvsvideocontrol.cpp
Update contrib.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <mvs/videoplayagent.h>
19 #include "mvsvideocontrol.h"
21 CMVSVideoControl* CMVSVideoControl::NewLC(CMVSVideoPlayAgent& aVideoPlayAgent, TInt aDisplay, RWindowTreeNode& aParent)
23 CMVSVideoControl* self = new (ELeave) CMVSVideoControl(aVideoPlayAgent, aDisplay);
24 CleanupStack::PushL(self);
25 self->ConstructL(aParent);
29 CMVSVideoControl* CMVSVideoControl::NewL(CMVSVideoPlayAgent& aVideoPlayAgent, TInt aDisplay, RWindowTreeNode& aParent)
31 CMVSVideoControl* self = CMVSVideoControl::NewLC(aVideoPlayAgent, aDisplay, aParent);
32 CleanupStack::Pop(self);
36 CMVSVideoControl::CMVSVideoControl(CMVSVideoPlayAgent& aVideoPlayAgent, TInt aDisplay) :
37 iVideoPlayAgent(aVideoPlayAgent),
42 void CMVSVideoControl::ConstructL(RWindowTreeNode& aParent)
44 CreateWindowL(aParent);
45 iPip = CMVSPipControl::NewL(Window());
47 Window().SetBackgroundColor(KRgbDarkGray);
50 CMVSVideoControl::~CMVSVideoControl()
56 RWindow& CMVSVideoControl::ControlWindow() const
61 TInt CMVSVideoControl::ScreenNumber() const
66 CMVSPipControl& CMVSVideoControl::Pip() const
71 void CMVSVideoControl::EnablePip(CMVSPipControl::TRenderType aRenderType)
73 iPip->ControlWindow().SetVisible(ETrue);
74 iPip->SetRenderType(aRenderType);
77 void CMVSVideoControl::DisablePip()
79 iPip->ControlWindow().SetVisible(EFalse);
82 void CMVSVideoControl::SetOverlayTextL(const TDesC& aOverlayText)
85 iOverlayText.CreateL(aOverlayText);
88 void CMVSVideoControl::ClearOverlayText()
93 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
94 void CMVSVideoControl::Draw(const TRect& aRect) const
96 void CMVSVideoControl::Draw(const TRect& /*aRect*/) const
99 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
100 iVideoPlayAgent.RenderSubtitle(aRect);
101 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
103 if (0 < iOverlayText.Length())
105 //Establish a Graphics Context
106 CWindowGc& gc = SystemGc();
108 //Establish a drawing rectangle
111 // Draw the overlay text if needed
112 gc.SetBrushStyle(CGraphicsContext::ENullBrush);
113 gc.SetBrushColor(KRgbRed);
115 gc.SetPenStyle(CGraphicsContext::ESolidPen);
116 gc.SetPenColor(KRgbBlue);
119 const CFont* appFont = CEikonEnv::Static()->AnnotationFont();
122 // Rect will always be at lest 3 in size
124 TInt baseline = (rect.Height() + appFont->AscentInPixels()) >> 1;
126 gc.DrawText(iOverlayText, rect, baseline, CGraphicsContext::ECenter);
133 TInt CMVSVideoControl::CountComponentControls() const
138 CCoeControl* CMVSVideoControl::ComponentControl(TInt aIndex) const
150 CMVSPipControl* CMVSPipControl::NewL(RWindowTreeNode& aParent)
152 CMVSPipControl* self = new (ELeave) CMVSPipControl();
153 CleanupStack::PushL(self);
154 self->ConstructL(aParent);
155 CleanupStack::Pop(self);
159 CMVSPipControl::CMVSPipControl()
163 void CMVSPipControl::ConstructL(RWindowTreeNode& aParent)
165 CreateWindowL(aParent);
166 Window().SetBackgroundColor(TRgb(0, 0));
169 CMVSPipControl::~CMVSPipControl()
173 void CMVSPipControl::Draw(const TRect& /*aRect*/) const
177 void CMVSPipControl::MmsehSurfaceCreated(TInt aDisplayId, const TSurfaceId& /*aId*/, const TRect& aCropRect, TVideoAspectRatio /*aAspectRatio*/)
179 __ASSERT_ALWAYS(iRenderType == EUseCrp, User::Invariant());
180 iDisplayId = aDisplayId;
181 iCropRect = aCropRect;
184 void CMVSPipControl::MmsehSurfaceParametersChanged(const TSurfaceId& /*aId*/, const TRect& /*aCropRect*/, TVideoAspectRatio /*aAspectRatio*/)
186 __ASSERT_ALWAYS(iRenderType == EUseCrp, User::Invariant());
189 void CMVSPipControl::MmsehRemoveSurface(const TSurfaceId& /*aId*/)
191 __ASSERT_ALWAYS(iRenderType == EUseCrp, User::Invariant());
194 void CMVSPipControl::SetRenderType(TRenderType aRenderType)
196 iRenderType = aRenderType;
199 void CMVSPipControl::Clear()
204 RWindow& CMVSPipControl::ControlWindow() const