symba (779893), страница 18
Текст из файла (страница 18)
The controller may not supportchanging the video position if the video is already playing.You can get the current playback position for the video using thePositionL() method:TTimeIntervalMicroSeconds PositionL() const;4.5.9 Trick Play ModesTrick play refers to operations such as fast forward, reverse playback, andslow motion playback.Prior to Symbian OS v9.4, there were two ways that trick play couldbe implemented:• The video controller could supply a custom command2 that allowedthese modes to be used (see Section 4.15 for more information oncustom commands).• The SetPositionL() method (see Section 4.5.8) made it possibleto jump forward or backward through the video by changing theposition that the video is playing from, which emulates fast forwardand reverse playback.From Symbian OS v9.4 onwards, the following API methods allow trickmode functionality to be used.
You can query the supported play rates2A custom command is an extension that allows a developer to access functionality thatis not available using a specific API method call.CONTROLLING VIDEO PLAYBACK69for the video controller using the GetPlayRateCapabilitiesL()method:void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities)const;This returns a TVideoPlayRateCapabilities structure whichcontains a set of public flags to indicate the capabilities:• iPlayForward indicates if fast and slow forward play is possible.• iPlayBackward indicates if fast and slow backward play is possible.• iStepForward indicates if stepping forward is possible.• iStepBackward indicates if stepping backward is possible.Where play forward and play backward modes are supported, you canset the play velocity:void SetPlayVelocityL(TInt aVelocity);The aVelocity parameter specifies the play velocity as a percentageof normal playback velocity.
The meaning of the various velocities isshown in Table 4.1.Table 4.1 Play Velocity ValuesRangeMeaning>100Fast forward playback100Normal speed forward playback1 to 99Slow motion forward playback0No playback−1 to −99Slow motion backward playback−100Normal speed backward playback< −100Fast backward playbackEven if the controller supports play velocity settings, it may not supportthe exact velocities you try to set. In this case, it sets a velocity as close70MULTIMEDIA FRAMEWORK: VIDEOas possible to the one you requested. To find out the exact play velocitybeing used at any time, you can call the PlayVelocityL() method:TInt PlayVelocityL() const;The StepFrameL() method allows you to step forward or backwarda selected number of video frames. The method can only be called oncethe video has been paused (see Section 4.5.5).void StepFrameL(TInt aStep);The aStep parameter indicates how many frames to step.
A negativevalue steps backward, a positive value steps forward.4.5.10 Enabling Video PlaybackFrom Symbian OS v9.4 onwards, it is possible to specify whether thevideo track in a video should be played or not. This can be set by callingSetVideoEnabledL(). If you specify that video is not enabled, thenonly the audio track is played:void SetVideoEnabledL(TBool aVideoEnabled);You can find out whether the video is enabled or not:TBool VideoEnabledL() const;4.5.11 Frame SnapshotIt is possible to try to take a snapshot from the currently playing videousing the GetFrameL() methods:void GetFrameL(TDisplayMode aDisplayMode);void GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent);You need to specify the display mode that specifies the color formatof the returned snapshot.
When accessing DRM content, you also needto specify your intent such as whether you are peeking the content forinternal use or whether you intend to display it to the user.This is an asynchronous method. The result in the form of a CFbsBitmap is returned through the MvpuoFrameReady() method in yourobserver.CONTROLLING SCREEN OUTPUT714.6 Controlling Screen Output4.6.1 Setting the Display WindowWe saw in Section 4.5.1 that the CVideoPlayerUtility::NewL()method takes a number of parameters related to the display.
The CVideoPlayerUtility class also has a method, SetDisplayWindowL(),which you can use to change those parameters later if you want to.void SetDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,RWindowBase& aWindow, const TRect& aWindowRect,const TRect& aClipRect);Both the NewL() method and the SetDisplayWindowL() methodtake a window server session, a screen device, and a window parameter.In addition there are two rectangles specified. The aWindowRect(or aScreenRect for the NewL() method) specifies the video extent(see Section 4.6.4).
The aClipRect specifies the clipping region. Thecoordinates for these rectangles are interpreted relative to the displayposition.SetDisplayWindowL() is not supported when using CVideoPlayerUtility2; it leaves with the KErrNotSupported error code.SetDisplayWindowL() can be called before the video open operationis performed.For CVideoPlayerUtility, you can specify the initial screen touse if multiple displays are supported on the phone:TInt SetInitScreenNumber(TInt aScreenNumber);You should do this before attempting to open the video. If youdon’t call this method, then the screen used is determined by calling GetScreenNumber() on the screen device specified in the callto NewL().
SetInitScreenNumber() is not supported when usingCVideoPlayerUtility2; it leaves with the KErrNotSupportederror code. SetInitScreenNumber() can be called before the videoopen operation is performed.To add a display window when using CVideoPlayerUtility2,you can use one of the AddDisplayWindowL() methods:void AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,RWindowBase& aWindow, const TRect& aVideoExtent,const TRect& aWindowClipRect);void AddDisplayWindowL(RWsSession& aWs, CWsScreenDevice& aScreenDevice,RWindowBase& aWindow);72MULTIMEDIA FRAMEWORK: VIDEOBoth these methods have the same window parameters as the CVideoPlayerUtility::NewL() method.
In addition, one of the methodsallows you to specify the video extent rectangle and the clipping rectangle.If you use the method that does not specify the rectangles, then the videoextent and clipping rectangle default to the same size as the window youhave specified. Note that, in contrast to CVideoPlayerUtility, thevideo extent and clipping region coordinates should be specified relativeto the window position.The AddDisplayWindowL() methods can only be called after thevideo open operation has completed. This is because the AddDisplayWindowL() methods can only be used where the chosen video controllersupports graphics surfaces, and the video controller must have beenopened in order to determine that information.It is possible to add multiple windows using these APIs provided youspecify that they are on different displays i.e.
different CWsScreenDevice instances. The same video is played in each window. This canbe used on Symbian smartphones with multiple displays.If you want to remove a display window when using CVideoPlayerUtility2, you can use the RemoveDisplayWindow() method:void RemoveDisplayWindow(RWindowBase& aWindow);4.6.2 Direct Screen AccessOne method that a controller or codec can use to send output to thedisplay is called direct screen access.
This allows drawing to the screenwithout having to use the window server. This is the default method ofscreen access prior to Symbian OS v9.5.A controller that wants to use direct screen access will start and stopit automatically as required.
It is, however, possible for you to start andstop the direct screen access explicitly if you wish to do so.void StopDirectScreenAccessL();void StartDirectScreenAccessL();It can be useful to do this if you know that a lot of changes are about tobe made to the windows on the UI and you want to temporarily turn offthe direct screen access while this happens to ensure that the video doesnot flicker due to the constant redraws while the windows are movedaround.CONTROLLING SCREEN OUTPUT73The direct screen access methods are not supported when usingCVideoPlayerUtility2 and they leave with KErrNotSupported.The direct screen access methods can be called before the video openoperation is performed.4.6.3 Graphics SurfacesFrom Symbian OS v9.5 onwards, support has been added for graphicssurfaces.
These have the advantage that they allow the user interfacefor the phone to be displayed above a video while it is playing. Theyalso allow specific graphics hardware acceleration devices to be used toprovide improved performance.Controllers or codecs that have been written to support graphicssurfaces always use that method to access the screen.
This means thatat the client API level there is no requirement to ask to use graphicssurfaces. There are however some client APIs that only work whengraphics surfaces are being used and some APIs that won’t work whengraphics surfaces are supported.More details about graphics surfaces are available in the SymbianDeveloper Library documentation for Symbian OS v9.5 in the Graphicssection of the Symbian OS Guide.4.6.4 Video ExtentThe video extent (also known as the screen rectangle or window rectangle)defines the area on the screen where the video is displayed. Figure 4.4shows a video extent that is fully enclosed within the window. This meansthe whole of the original video picture is displayed.It is possible to set the video extent to be fully or partially outsidethe current window.