os/mm/mdfdevvideoextensions/nga_mdf_postprocessor/inc/NGAPostProcHwDevice.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#ifndef __NGAPOSTPROCHWDEVICE_H__
sl@0
    20
#define __NGAPOSTPROCHWDEVICE_H__
sl@0
    21
sl@0
    22
#include <e32std.h> 
sl@0
    23
#include <w32std.h>
sl@0
    24
#include <e32base.h>
sl@0
    25
#include <e32def.h>
sl@0
    26
#include <e32cmn.h>
sl@0
    27
#include <stdio.h>
sl@0
    28
#include <string.h>
sl@0
    29
#include <stdarg.h>
sl@0
    30
sl@0
    31
#include <mmf/devvideo/videoplayhwdevice.h>
sl@0
    32
#include <mmf/devvideo/devvideostandardcustominterfaces.h>
sl@0
    33
#include <mmf/devvideo/devvideovideosurfacecustominterface.h>
sl@0
    34
#include <graphics/surfacemanager.h> //RSurfaceManager
sl@0
    35
#include <graphics/surface.h> //TSurfaceId
sl@0
    36
#include <mmf/common/mmfvideo.h> //TVideoAspectRatio
sl@0
    37
#include <mmf/devvideo/devvideosurfacehandlecustominterface.h>
sl@0
    38
#include <mmf/devvideo/devvideoplayratecustominterface.h>  
sl@0
    39
#include <surface_hints.h>
sl@0
    40
#include <secureoutputci.h>
sl@0
    41
#include <advancedsecureoutputci.h>
sl@0
    42
#include <graphics/suerror.h>
sl@0
    43
sl@0
    44
#include "fetchframecustominterface.h"
sl@0
    45
#include "MdfRDebug.h"
sl@0
    46
#include "NGAPostProcHwDevice_UID.hrh"
sl@0
    47
#include "NGAPostProcSessionManagerObserver.h"
sl@0
    48
#include "common.h"
sl@0
    49
sl@0
    50
class CNGAPostProcSessionManager;
sl@0
    51
class CNGAPostProcSurfaceHandler;
sl@0
    52
class CNGAPostProcTimer;
sl@0
    53
class RWsSession;
sl@0
    54
sl@0
    55
class CNGAPostProcHwDevice: public CMMFVideoPostProcHwDevice,
sl@0
    56
							public MMmfVideoBufferManagement,
sl@0
    57
							public MNGAPostProcSessionManagerObserver,
sl@0
    58
							public MMMFVideoSurfaceSupport,
sl@0
    59
							public MMmfVideoPropertiesObserver,
sl@0
    60
							public MMmfVideoResourceObserver,
sl@0
    61
							public MMmfVideoSurfaceHandleControl,
sl@0
    62
							public MMmfVideoPropertiesNotifier,
sl@0
    63
							public MMmfVideoPlayRateControl,
sl@0
    64
							public MMmfVideoSecureOutput,
sl@0
    65
							public MMmfAdvancedVideoSecureOutput
sl@0
    66
{
sl@0
    67
sl@0
    68
public: 
sl@0
    69
    //  === Constructors and destructor ===
sl@0
    70
    /**
sl@0
    71
    * Two-phased constructor.   
sl@0
    72
    * @return pointer to an instance of CMMFVideoPostProcHwDevice
sl@0
    73
    */
sl@0
    74
    static CMMFVideoPostProcHwDevice* NewL();
sl@0
    75
sl@0
    76
    /**
sl@0
    77
    * Destructor.
sl@0
    78
    */
sl@0
    79
    ~CNGAPostProcHwDevice();
sl@0
    80
sl@0
    81
public: 
sl@0
    82
    
sl@0
    83
    // === CMMFVideoPostProcHwDevice ===
sl@0
    84
    
sl@0
    85
    /**
sl@0
    86
    Sets the device input format to an uncompressed video format.
sl@0
    87
sl@0
    88
    @param  "aFormat"   "The input format to use."
sl@0
    89
    @leave  "The method will leave if an error occurs. Typical error codes used:
sl@0
    90
            * KErrNotSupported - The input format is not supported."    
sl@0
    91
    @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
sl@0
    92
    */
sl@0
    93
    void SetInputFormatL(const TUncompressedVideoFormat& aFormat);
sl@0
    94
sl@0
    95
    /**
sl@0
    96
    Sets the decoder device that will write data to this post-processor. Decoded pictures will be 
sl@0
    97
    written with WritePictureL() or through a custom interface. After pictures have been processed, 
sl@0
    98
    they must be returned to the decoder using ReturnPicture().
sl@0
    99
sl@0
   100
    @param  "aDevice"   "The decoder source plug-in to use."
sl@0
   101
    @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
sl@0
   102
    */
sl@0
   103
    void SetInputDevice(CMMFVideoDecodeHwDevice* aDevice);
sl@0
   104
sl@0
   105
    /**
sl@0
   106
    Writes an uncompressed video picture to the post-processor. The picture must be returned to the 
sl@0
   107
    client or source plug-in after it has been used.
sl@0
   108
sl@0
   109
    @param  "aPicture"  "The picture to write."
sl@0
   110
    @leave  "This method may leave with one of the system-wide error codes."
sl@0
   111
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   112
    */
sl@0
   113
    void WritePictureL(TVideoPicture* aPicture);    
sl@0
   114
sl@0
   115
    /**
sl@0
   116
    Retrieves post-processing information about this hardware device. 
sl@0
   117
    The device creates a CPostProcessorInfo structure, fills it with correct data, pushes it 
sl@0
   118
    to the cleanup stack and returns it. The client will delete the object when it is no 
sl@0
   119
    longer needed.
sl@0
   120
sl@0
   121
    @return "Post-processor information as a CPostProcessorInfo object. 
sl@0
   122
            The object is pushed to the cleanup stack, and must be deallocated by the caller."
sl@0
   123
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   124
    */
sl@0
   125
    CPostProcessorInfo* PostProcessorInfoLC();
sl@0
   126
sl@0
   127
    /**
sl@0
   128
    Retrieves the list of the output formats that the device supports. The list is ordered in 
sl@0
   129
    plug-in preference order, with the preferred formats at the beginning of the list. The list 
sl@0
   130
    can depend on the device source format, and therefore SetSourceFormatL() must be called before 
sl@0
   131
    calling this method.
sl@0
   132
sl@0
   133
    @param "aFormats" "An array for the result format list. The array must be created and destroyed by the caller."
sl@0
   134
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   135
    @pre    "This method may only be called before the hwdevice has been initialized using Initialize()."
sl@0
   136
    */
sl@0
   137
    void GetOutputFormatListL(RArray<TUncompressedVideoFormat>& aFormats);
sl@0
   138
sl@0
   139
    /**
sl@0
   140
    Sets the device output format.
sl@0
   141
sl@0
   142
    @param  "aFormat" "The format to use."
sl@0
   143
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   144
    @pre    "This method may only be called before the hwdevice has been initialized using Initialize()."
sl@0
   145
    */
sl@0
   146
    void SetOutputFormatL(const TUncompressedVideoFormat &aFormat);
sl@0
   147
sl@0
   148
    /**
sl@0
   149
    Sets the clock source to use for video timing. If no clock source is set. video playback 
sl@0
   150
    will not be synchronized, but will proceed as fast as possible, depending on input data 
sl@0
   151
    and output buffer availability. 
sl@0
   152
sl@0
   153
    @param  "aClock" "The clock source to be used."
sl@0
   154
    @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
sl@0
   155
    */
sl@0
   156
    void SetClockSource(MMMFClockSource* aClock);
sl@0
   157
sl@0
   158
    /**
sl@0
   159
    Sets the device video output destination. The destination can be the screen (using direct 
sl@0
   160
    screen access) or memory buffers. By default memory buffers are used. If data is written 
sl@0
   161
    to another device, this method is ignored, and suitable memory buffers are always used.
sl@0
   162
    
sl@0
   163
    @param  "aScreen" "True if video output destination is the screen, false if memory buffers."
sl@0
   164
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   165
    @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
sl@0
   166
    */
sl@0
   167
    void SetVideoDestScreenL(TBool aScreen);
sl@0
   168
sl@0
   169
    /**
sl@0
   170
    Sets the post-processing types to be used.
sl@0
   171
sl@0
   172
    @param  "aPostProcCombination" "The post-processing steps to perform, a bitwise OR of values from TPostProcessType."
sl@0
   173
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   174
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   175
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   176
    */
sl@0
   177
    void SetPostProcessTypesL(TUint32 aPostProcCombination);
sl@0
   178
sl@0
   179
    /**
sl@0
   180
    Sets post-processing options for input (pan-scan) cropping.
sl@0
   181
sl@0
   182
    @param  "aRect" "The cropping rectangle to use."
sl@0
   183
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   184
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   185
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   186
    */
sl@0
   187
    void SetInputCropOptionsL(const TRect& aRect);
sl@0
   188
sl@0
   189
    /**
sl@0
   190
    Sets post-processing options for YUV to RGB color space conversion. 
sl@0
   191
    Specifies the input YUV and output RGB formats to use explicitly. SetSourceFormatL(), 
sl@0
   192
    SetOutputFormatL(), and SetPostProcessTypesL() must be called before this method is used.
sl@0
   193
sl@0
   194
    @param  "aOptions"      "The conversion options to use."
sl@0
   195
    @param  "aYuvFormat"    "Conversion source YUV format"
sl@0
   196
    @param  "aRgbFormat"    "Conversion target RGB format"
sl@0
   197
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   198
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   199
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   200
    */
sl@0
   201
    void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, 
sl@0
   202
                                TRgbFormat aRgbFormat);
sl@0
   203
sl@0
   204
    /**
sl@0
   205
    Sets post-processing options for YUV to RGB color space conversion.
sl@0
   206
    Uses the device input and output formats. For decoder devices the default YUV format used is 
sl@0
   207
    the format specified in the input bitstream. SetSourceFormatL(), SetOutputFormatL(), and 
sl@0
   208
    SetPostProcessTypesL() must be called before this method is used.
sl@0
   209
sl@0
   210
    @param  "aOptions"      "The conversion options to use."
sl@0
   211
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   212
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   213
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   214
    */
sl@0
   215
    void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions);
sl@0
   216
sl@0
   217
    /**
sl@0
   218
    Sets post-processing options for rotation. SetPostProcessTypesL() must be called before 
sl@0
   219
    this method is used.
sl@0
   220
sl@0
   221
    @param  "aRotationType" "The rotation to perform."  
sl@0
   222
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   223
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   224
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   225
    */
sl@0
   226
    void SetRotateOptionsL(TRotationType aRotationType);
sl@0
   227
sl@0
   228
    /**
sl@0
   229
    Sets post-processing options for scaling. SetPostProcessTypesL() must be called before 
sl@0
   230
    this method is used.
sl@0
   231
    
sl@0
   232
    @param  "aTargetSize"           "Scaling target size. If a fixed scale factor size is used, 
sl@0
   233
                                    the new dimensions must be set to width=floor(factor*width), 
sl@0
   234
                                    height=floor(factor*height). For example, scaling a 
sl@0
   235
                                    QCIF (176x144) picture up by a factor of 4/3 yields a size 
sl@0
   236
                                    of 234x192."
sl@0
   237
    @param  "aAntiAliasFiltering"   "True if anti-aliasing filtering should be used. 
sl@0
   238
                                    If the post-processor does not support anti-aliased scaling, 
sl@0
   239
                                    or supports anti-aliased scaling only, this argument is ignored."
sl@0
   240
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   241
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   242
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   243
    */
sl@0
   244
    void SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering);
sl@0
   245
sl@0
   246
    /**
sl@0
   247
    Sets post-processing options for output cropping. SetPostProcessTypesL() must be called before 
sl@0
   248
    this method is used.
sl@0
   249
    
sl@0
   250
    @param  "aRect" "Output cropping area."
sl@0
   251
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   252
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   253
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   254
    */
sl@0
   255
    void SetOutputCropOptionsL(const TRect& aRect);
sl@0
   256
sl@0
   257
    /**
sl@0
   258
    Sets post-processing plug-in specific options. SetPostProcessTypesL() must be called before 
sl@0
   259
    this method is used.
sl@0
   260
sl@0
   261
    @param  "aOptions" "The options. The format is plug-in specific."
sl@0
   262
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   263
    @pre    "This method can be called either before or after the hwdevice has been initialized with Initialize().
sl@0
   264
            If called after initialization, the change must only be committed when CommitL() is called."
sl@0
   265
    */
sl@0
   266
    void SetPostProcSpecificOptionsL(const TDesC8& aOptions);
sl@0
   267
sl@0
   268
    /**
sl@0
   269
    Initializes the device. This method is asynchronous, the device will call 
sl@0
   270
    MMFVideoPlayProxy::MdvppInitializeComplete() after initialization has completed. After this 
sl@0
   271
    method has successfully completed, further configuration changes are not possible except where 
sl@0
   272
    separately noted.
sl@0
   273
    */
sl@0
   274
    void Initialize();
sl@0
   275
sl@0
   276
    /**
sl@0
   277
    Commit all changes since the last CommitL(), Revert() or Initialize()
sl@0
   278
    to the hardware device.  This only applies to methods which can be called both
sl@0
   279
    before AND after DevVideoPlay has been initialized.
sl@0
   280
sl@0
   281
    @see    SetPostProcessTypesL
sl@0
   282
    @see    SetInputCropOptionsL
sl@0
   283
    @see    SetYuvToRgbOptionsL
sl@0
   284
    @see    SetRotateOptionsL
sl@0
   285
    @see    SetScaleOptionsL
sl@0
   286
    @see    SetOutputCropOptionsL
sl@0
   287
    @see    SetPostProcSpecificOptionsL
sl@0
   288
sl@0
   289
    @leave  "The method will leave if an error occurs."
sl@0
   290
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   291
    */
sl@0
   292
    void CommitL();
sl@0
   293
sl@0
   294
    /**
sl@0
   295
    Revert all changes since the last CommitL(), Revert() or Initialize()
sl@0
   296
    back to their previous settings.  This only applies to methods which can 
sl@0
   297
    be called both before AND after DevVideoPlay has been initialized.
sl@0
   298
sl@0
   299
    @see    SetPostProcessTypesL
sl@0
   300
    @see    SetInputCropOptionsL
sl@0
   301
    @see    SetYuvToRgbOptionsL
sl@0
   302
    @see    SetRotateOptionsL
sl@0
   303
    @see    SetScaleOptionsL
sl@0
   304
    @see    SetOutputCropOptionsL
sl@0
   305
    @see    SetPostProcSpecificOptionsL
sl@0
   306
sl@0
   307
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   308
    */
sl@0
   309
    void Revert();
sl@0
   310
sl@0
   311
    /**
sl@0
   312
    Starts writing output directly to the display frame buffer using Direct Screen Access.
sl@0
   313
sl@0
   314
    @param  "aVideoRect"    "The video output rectangle on screen."
sl@0
   315
    @param  "aScreenDevice" "The screen device to use. The screen device object must be valid in the current thread."
sl@0
   316
    @param  "aClipRegion"   "Initial clipping region to use."
sl@0
   317
    
sl@0
   318
    @leave  "This method may leave with one of the system-wide error codes.
sl@0
   319
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   320
    */
sl@0
   321
    void StartDirectScreenAccessL(const TRect& aVideoRect, 
sl@0
   322
        CFbsScreenDevice& aScreenDevice, const TRegion& aClipRegion);
sl@0
   323
sl@0
   324
    /**
sl@0
   325
    Sets a new clipping region for Direct Screen Access. After the method returns, no video will 
sl@0
   326
    be drawn outside of the region. If clipping is not supported, or the clipping region is too 
sl@0
   327
    complex, either playback will pause or will resume without video display, depending on the 
sl@0
   328
    current setting of SetPauseOnClipFail(), and the result can be verified with IsPlaying(). 
sl@0
   329
    Clipping can be disabled by setting a new clipping region that includes the whole video window.
sl@0
   330
sl@0
   331
    @param  "aRegion" "The new clipping region. After the method returns, no video will be drawn outside the region."
sl@0
   332
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   333
    */
sl@0
   334
    void SetScreenClipRegion(const TRegion& aRegion);
sl@0
   335
sl@0
   336
    /**
sl@0
   337
    Sets whether the system should pause playback when it gets a clipping region it cannot handle, 
sl@0
   338
    or Direct Screen Access is aborted completely. If not, processing will proceed normally, but no 
sl@0
   339
    video will be drawn. By default, playback is paused.
sl@0
   340
sl@0
   341
    @param "aPause" "True if playback should be paused when clipping fails, false if not. 
sl@0
   342
                    If playback is not paused, it will be continued without video display."
sl@0
   343
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   344
    */
sl@0
   345
    void SetPauseOnClipFail(TBool aPause);
sl@0
   346
sl@0
   347
    /**
sl@0
   348
    Aborts Direct Screen Access completely, to be called from MAbortDirectScreenAccess::AbortNow() 
sl@0
   349
    and similar methods. DSA can be resumed by calling StartDirectScreenAccessL().
sl@0
   350
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   351
    */
sl@0
   352
    void AbortDirectScreenAccess();
sl@0
   353
sl@0
   354
    /**
sl@0
   355
    Indicates whether playback is proceeding. This method can be used to check whether playback was 
sl@0
   356
    paused or not in response to a new clipping region or DSA abort.
sl@0
   357
sl@0
   358
    @return "ETrue if video is still being played (even if not necessarily displayed)."
sl@0
   359
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   360
    */
sl@0
   361
    TBool IsPlaying();
sl@0
   362
sl@0
   363
    /**
sl@0
   364
    Re-draws the latest video picture. Only available when DSA is being used. If DSA is aborted or a 
sl@0
   365
    non-supported clipping region has been set, the request may be ignored.
sl@0
   366
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   367
    */
sl@0
   368
    void Redraw();
sl@0
   369
sl@0
   370
sl@0
   371
    /**
sl@0
   372
    Starts video playback, including decoding, post-processing, and rendering. Playback will proceed 
sl@0
   373
    until it has been stopped or paused, or the end of the bitstream is reached.
sl@0
   374
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   375
    */
sl@0
   376
    void Start();
sl@0
   377
sl@0
   378
    /**
sl@0
   379
    Stops video playback. No new pictures will be decoded, post-processed, or rendered.
sl@0
   380
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   381
    */
sl@0
   382
    void Stop();
sl@0
   383
sl@0
   384
    /**
sl@0
   385
    Pauses video playback, including decoding, post-processing, and rendering. No pictures will be 
sl@0
   386
    decoded, post-processed, or rendered until playback has been resumed.
sl@0
   387
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   388
    */
sl@0
   389
    void Pause();
sl@0
   390
sl@0
   391
    /**
sl@0
   392
    Resumes video playback after a pause.
sl@0
   393
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   394
    */
sl@0
   395
    void Resume();
sl@0
   396
sl@0
   397
    /**
sl@0
   398
    Changes to a new decoding and playback position, used for randomly accessing (seeking) the 
sl@0
   399
    input stream. The position change flushes all input and output buffers. Pre-decoder and 
sl@0
   400
    post-decoder buffering are handled as if a new bitstream was being decoded. If the device still
sl@0
   401
    has buffered pictures that precede the new playback position, they will be discarded. If playback
sl@0
   402
    is synchronized to a clock source, the client is responsible for setting the clock source to the 
sl@0
   403
    new position.
sl@0
   404
    
sl@0
   405
    @param "aPlaybackPosition" "The new playback position in the video stream."
sl@0
   406
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   407
    */
sl@0
   408
    void SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition);
sl@0
   409
sl@0
   410
    /**
sl@0
   411
    Freezes a picture on the screen. After the picture has been frozen, no new pictures are 
sl@0
   412
    displayed until the freeze is released with ReleaseFreeze(). If the device output is being 
sl@0
   413
    written to memory buffers or to another plug-in, instead of the screen, no decoded pictures 
sl@0
   414
    will be delivered while the freeze is active, and they are simply discarded.
sl@0
   415
sl@0
   416
    @param "aTimestamp" "The presentation timestamp of the picture to freeze. The frozen picture 
sl@0
   417
                        will be the first picture with a timestamp greater than or equal to this 
sl@0
   418
                        parameter."
sl@0
   419
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   420
    */
sl@0
   421
    void FreezePicture(const TTimeIntervalMicroSeconds& aTimestamp);
sl@0
   422
sl@0
   423
    /**
sl@0
   424
    Releases a picture frozen with FreezePicture().
sl@0
   425
sl@0
   426
    @param "aTimestamp" "The presentation timestamp of the picture to release. The first picture 
sl@0
   427
                        displayed after the release will be the first picture with a timestamp 
sl@0
   428
                        greater than or equal to this parameter. To release the freeze immediately, 
sl@0
   429
                        set the timestamp to zero."
sl@0
   430
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   431
    */
sl@0
   432
    void ReleaseFreeze(const TTimeIntervalMicroSeconds& aTimestamp);
sl@0
   433
sl@0
   434
sl@0
   435
    /**
sl@0
   436
    Returns the current playback position, i.e. the timestamp for the most recently displayed or 
sl@0
   437
    virtually displayed picture. If the device output is written to another device, the most recent 
sl@0
   438
    output picture is used.
sl@0
   439
sl@0
   440
    @return "Current playback position."
sl@0
   441
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   442
    */
sl@0
   443
    TTimeIntervalMicroSeconds PlaybackPosition();
sl@0
   444
sl@0
   445
    /**
sl@0
   446
    Returns the total amount of memory allocated for uncompressed pictures. This figure only 
sl@0
   447
    includes the pictures actually allocated by the plug-in itself, so that the total number of 
sl@0
   448
    bytes allocated in the system can be calculated by taking the sum of the values from all plug-ins.
sl@0
   449
sl@0
   450
    @return "Total number of bytes of memory allocated for uncompressed pictures."
sl@0
   451
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   452
    */
sl@0
   453
    TUint PictureBufferBytes();
sl@0
   454
sl@0
   455
    /**
sl@0
   456
    Reads various counters related to decoded pictures. The counters are reset when Initialize() 
sl@0
   457
    or this method is called, and thus they only include pictures processed since the last call.
sl@0
   458
sl@0
   459
    Post-processor devices return the number of input pictures in iPicturesDecoded and 
sl@0
   460
    iTotalPictures. If the decoded pictures are written to another plug-in, they are considered 
sl@0
   461
    to be "virtually displayed".
sl@0
   462
sl@0
   463
    @param "aCounters" "The counter structure to fill."
sl@0
   464
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   465
    */
sl@0
   466
    void GetPictureCounters(CMMFDevVideoPlay::TPictureCounters& aCounters);
sl@0
   467
sl@0
   468
sl@0
   469
    /**
sl@0
   470
    Sets the computational complexity level to use. If separate complexity levels are not available, 
sl@0
   471
    the method call is ignored. If the level specified is not available, the results are undefined. 
sl@0
   472
    Typically the device will either ignore the request or use the nearest suitable level.
sl@0
   473
sl@0
   474
    The complexity level can be changed at any point during playback.
sl@0
   475
sl@0
   476
    @param "aLevel" "The computational complexity level to use. Level zero (0) is the most complex 
sl@0
   477
                    one, with the highest quality. Higher level numbers require less processing 
sl@0
   478
                    and may have lower quality."
sl@0
   479
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   480
    */
sl@0
   481
    void SetComplexityLevel(TUint aLevel);
sl@0
   482
sl@0
   483
    /**
sl@0
   484
    Gets the number of complexity levels available.
sl@0
   485
    
sl@0
   486
    @return "The number of complexity control levels available, or zero if the information is not 
sl@0
   487
            available yet. The information may not be available if the number of levels depends on 
sl@0
   488
            the input data, and enough input data has not been read yet. In that case, using level 
sl@0
   489
            zero is safe."
sl@0
   490
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   491
    */
sl@0
   492
    TUint NumComplexityLevels();
sl@0
   493
sl@0
   494
    /**
sl@0
   495
    Gets information about a computational complexity level. This method can be called after 
sl@0
   496
    NumComplexityLevels() has returned a non-zero value - at that point the information is guaranteed 
sl@0
   497
    to be available. Some hardware device implementations may not be able to provide all values, 
sl@0
   498
    in that case the values will be approximated.
sl@0
   499
sl@0
   500
    @param "aLevel" "The computational complexity level to query. The level numbers range from zero 
sl@0
   501
                    (the most complex) to NumComplexityLevels()-1."
sl@0
   502
    @param "aInfo"  "The information structure to fill."
sl@0
   503
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   504
    */
sl@0
   505
    void GetComplexityLevelInfo(TUint aLevel, CMMFDevVideoPlay::TComplexityLevelInfo& aInfo);
sl@0
   506
sl@0
   507
    /**
sl@0
   508
    Returns a picture back to the device. This method is called by CMMFDevVideoPlay to return pictures 
sl@0
   509
    from the client (after they have been written with NewPicture()), or by the output device when 
sl@0
   510
    it has finished using a picture.
sl@0
   511
sl@0
   512
    @param "aPicture" "The picture to return. The device can re-use the memory for the picture."
sl@0
   513
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   514
    */
sl@0
   515
    void ReturnPicture(TVideoPicture* aPicture);
sl@0
   516
sl@0
   517
    /**
sl@0
   518
    Gets a copy of the latest picture sent to output.
sl@0
   519
sl@0
   520
    @param "aPictureData"   "Target picture. The memory for the picture must be allocated by the 
sl@0
   521
                            caller, and initialized properly. The data formats must match the snapshot 
sl@0
   522
                            format requested."
sl@0
   523
    @param "aFormat"        "The picture format to use for the snapshot."
sl@0
   524
sl@0
   525
    @return "ETrue if the snapshot was taken, EFalse if a picture is not available. The picture may not 
sl@0
   526
            be available if decoding has not progressed far enough yet."
sl@0
   527
sl@0
   528
    @leave  "The method will leave if an error occurs. Typical error codes used:
sl@0
   529
            * KErrNotSupported - The requested data format or picture size is not supported, or the 
sl@0
   530
            plug-in does not support snapshots."
sl@0
   531
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   532
    */
sl@0
   533
//  TBool GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& aFormat) {return EFalse;};
sl@0
   534
    TBool GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& aFormat);
sl@0
   535
sl@0
   536
    /**
sl@0
   537
    When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete()
sl@0
   538
    callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot 
sl@0
   539
    request can be active at a time.
sl@0
   540
sl@0
   541
    @param "aPictureData"           "Target picture. The memory for the picture must be allocated by 
sl@0
   542
                                    the caller, and initialized properly. The data formats must match 
sl@0
   543
                                    the snapshot format requested. The picture must remain valid until 
sl@0
   544
                                    the snapshot has been taken or until the request has been cancelled 
sl@0
   545
                                    with CancelTimedSnapshot()."
sl@0
   546
    @param "aFormat"                "The picture format to use for the snapshot."
sl@0
   547
    @param "aPresentationTimestamp" "Presentation timestamp for the picture to copy."
sl@0
   548
sl@0
   549
    @leave  "The method will leave if an error occurs. Typical error codes used:
sl@0
   550
            * KErrNotSupported - The requested data format or picture size is not supported or 
sl@0
   551
            the plug-in does not support timed snapshots."
sl@0
   552
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   553
    */
sl@0
   554
    //void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, 
sl@0
   555
    //                        const TTimeIntervalMicroSeconds& aPresentationTimestamp){};
sl@0
   556
    void GetTimedSnapshotL(TPictureData*, const TUncompressedVideoFormat&, const TTimeIntervalMicroSeconds&){};
sl@0
   557
sl@0
   558
sl@0
   559
    /**
sl@0
   560
    When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete()
sl@0
   561
    callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot 
sl@0
   562
    request can be active at a time.
sl@0
   563
sl@0
   564
    @param "aPictureData"           "Target picture. The memory for the picture must be allocated by 
sl@0
   565
                                    the caller, and initialized properly. The data formats must match 
sl@0
   566
                                    the snapshot format requested. The picture must remain valid until 
sl@0
   567
                                    the snapshot has been taken or until the request has been cancelled 
sl@0
   568
                                    with CancelTimedSnapshot()."
sl@0
   569
    @param "aFormat"                "The picture format to use for the snapshot."
sl@0
   570
    @param "aPictureId"             "Picture identifier for the picture to copy."
sl@0
   571
sl@0
   572
    @leave  "The method will leave if an error occurs. Typical error codes used:
sl@0
   573
            * KErrNotSupported - The requested data format or picture size is not supported or 
sl@0
   574
            the plug-in does not support timed snapshots."
sl@0
   575
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   576
    */
sl@0
   577
//    void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, 
sl@0
   578
//                            const TPictureId& aPictureId){};
sl@0
   579
    void GetTimedSnapshotL(TPictureData*, const TUncompressedVideoFormat&, const TPictureId& ){};
sl@0
   580
sl@0
   581
    /**
sl@0
   582
    Cancels a timed snapshot request.
sl@0
   583
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   584
    */
sl@0
   585
    void CancelTimedSnapshot(){};
sl@0
   586
sl@0
   587
    /**
sl@0
   588
    Gets a list of the supported snapshot picture formats.
sl@0
   589
sl@0
   590
    @param "aFormats" "An array for the result format list. The array must be created and destroyed by 
sl@0
   591
    the caller."
sl@0
   592
sl@0
   593
    @leave "This method may leave with one of the standard error codes."
sl@0
   594
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   595
    */
sl@0
   596
    void GetSupportedSnapshotFormatsL(RArray<TUncompressedVideoFormat>&){};
sl@0
   597
sl@0
   598
sl@0
   599
    /**
sl@0
   600
sl@0
   601
    Notifies the hardware device that the end of input data has been reached and no more input data 
sl@0
   602
    will be written. The hardware device can use this signal to ensure that the remaining data gets 
sl@0
   603
    processed, without waiting for new data. For example when the data type is not EDuCodedPicture,
sl@0
   604
    calling this method is necessary otherwise a hardware device implementation might be looking for 
sl@0
   605
    the start code for the next picture to ensure it has a complete picture before starting to decode
sl@0
   606
    the previous one. 
sl@0
   607
    
sl@0
   608
      
sl@0
   609
    After the remaining data has been processed (and displayed, if applicable), the hardware 
sl@0
   610
    device must notify the proxy with the MdvppStreamEnd() callback.
sl@0
   611
sl@0
   612
    DevVideo clients are encouraged to call this method, but its use is not mandatory for synchronized
sl@0
   613
    processing.  For synchronized playback, all video pictures are processed or discarded according to 
sl@0
   614
    their timestamps, and so the client can easily infer when processing is complete.  However, it 
sl@0
   615
    should be noted that the last picture might not be displayed if this method is not called and the 
sl@0
   616
    input data type is not EDuCodedPicture.
sl@0
   617
sl@0
   618
    For non-synchronized playback (e.g. file conversion), a client must call this method otherwise it
sl@0
   619
    will never find out when the hardware device has finished processing the data.
sl@0
   620
    
sl@0
   621
    @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
sl@0
   622
    */
sl@0
   623
    void InputEnd();
sl@0
   624
sl@0
   625
    /**
sl@0
   626
    Retrieves a custom interface to the device.
sl@0
   627
    @param  "aInterface"    "Interface UID, defined with the custom interface."
sl@0
   628
    @return "Pointer to the interface implementation, or NULL if the device does not 
sl@0
   629
            implement the interface requested. The return value must be cast to the 
sl@0
   630
            correct type by the user."
sl@0
   631
    */
sl@0
   632
    TAny* CustomInterface(TUid aInterface);  
sl@0
   633
    
sl@0
   634
    // === MNGAPostProcSessionManagerObserver ===
sl@0
   635
    /**
sl@0
   636
    Set the proxy implementation to be used. Called just after the object is constructed.
sl@0
   637
    @param  "aProxy"    "The proxy to use."
sl@0
   638
    */
sl@0
   639
    void BufferAvailable(TInt aBufId, TInt aStatus);
sl@0
   640
    
sl@0
   641
public: 
sl@0
   642
sl@0
   643
    // === MMmfVideoBufferManagement ===
sl@0
   644
    
sl@0
   645
    /** 
sl@0
   646
     * Sets the observer object to use. The observer gets notified
sl@0
   647
     * when new buffers are available and when buffers need to be
sl@0
   648
     * released back to the media device.
sl@0
   649
     *
sl@0
   650
     * This method can only be called before the media device has
sl@0
   651
     * been Initialized with InitializeL().
sl@0
   652
     * 
sl@0
   653
     * @param aObserver The observer object to use.
sl@0
   654
     */
sl@0
   655
    void MmvbmSetObserver(MMmfVideoBufferManagementObserver* aObserver);
sl@0
   656
    
sl@0
   657
    /** 
sl@0
   658
     * Enables input buffer management mode. In buffer management mode
sl@0
   659
     * the target media device allocates memory for input buffers and
sl@0
   660
     * the client can only use input buffers allocated with
sl@0
   661
     * MmvbmGetBufferL().
sl@0
   662
     *
sl@0
   663
     * This method can only be called before the media device has been
sl@0
   664
     * Initialized with InitializeL(). This method must be called if
sl@0
   665
     * the client uses MmvbmGetBufferL().
sl@0
   666
     * 
sl@0
   667
     * @param aEnable ETrue if input buffer management mode is used.
sl@0
   668
     */
sl@0
   669
    void MmvbmEnable(TBool aEnable);
sl@0
   670
    
sl@0
   671
    /** 
sl@0
   672
     * Sets the buffer options to use. The client can request the
sl@0
   673
     * number of input buffers that should be available, but typically
sl@0
   674
     * only few (one or two) buffers can be used.
sl@0
   675
     *
sl@0
   676
     * This method can only be called before the media device has been
sl@0
   677
     * Initialized with InitializeL().
sl@0
   678
     * 
sl@0
   679
     * @param aOptions The buffer options to use, see TBufferOptions.
sl@0
   680
     *
sl@0
   681
     * @leave KErrNotSupported The requested buffer options are not
sl@0
   682
     *   supported. Typically the client has requested too many input
sl@0
   683
     *   buffers.
sl@0
   684
     */
sl@0
   685
    void MmvbmSetBufferOptionsL(const TBufferOptions& aOptions);
sl@0
   686
    
sl@0
   687
    /** 
sl@0
   688
     * Gets the buffer options currently in use.
sl@0
   689
     *
sl@0
   690
     * This method can only be called before the media device has been
sl@0
   691
     * Initialized with InitializeL().
sl@0
   692
     * 
sl@0
   693
     * @param aOptions Target buffer options data structure.
sl@0
   694
     */
sl@0
   695
    void MmvbmGetBufferOptions(TBufferOptions& aOptions);
sl@0
   696
    
sl@0
   697
    /** 
sl@0
   698
     * Gets a new input picture buffer. The client can then write data
sl@0
   699
     * into the buffer and write it back to the media device with
sl@0
   700
     * WritePictureL().
sl@0
   701
     *
sl@0
   702
     * This method can only be called after the media device has been
sl@0
   703
     * Initialized with InitializeL(). This method can only be called
sl@0
   704
     * in buffer management mode, i.e. if the client has called
sl@0
   705
     * MmvbmEnable(ETrue).
sl@0
   706
     *
sl@0
   707
     * Note that target-allocated and client-allocated input buffers
sl@0
   708
     * cannot be mixed. In buffer management mode only input buffers
sl@0
   709
     * allocated with this method can be sent to the media device.
sl@0
   710
     *
sl@0
   711
     * If a client has retrieved buffers with MmvbmGetBufferL(), it
sl@0
   712
     * must be prepated to release them synchronously at any point if
sl@0
   713
     * MmmfBufferManagementObserver::MmvbmoReleaseBuffers() is
sl@0
   714
     * called. This may happen if the target media device suddenly
sl@0
   715
     * loses access to the buffers due to DSA abort, resource
sl@0
   716
     * management conflict, or media device destruction.
sl@0
   717
     * 
sl@0
   718
     * @param aSize The requested buffer size, in pixels. The buffer
sl@0
   719
     *   size should match the picture size set at initialisation phase,
sl@0
   720
     *   or otherwise suitable buffer may not be available. If the size
sl@0
   721
     *   is smaller than the size set at initialisation phase, the
sl@0
   722
     *   allocated buffer may be larger than requested.
sl@0
   723
     * 
sl@0
   724
     * @return A new input picture buffer. If no free buffers are
sl@0
   725
     * available, the return value is NULL.
sl@0
   726
     *
sl@0
   727
     * @leave General The method will leave if an error occurs. Lack
sl@0
   728
     * of free buffers is not considered an error.
sl@0
   729
     */
sl@0
   730
    TVideoPicture* MmvbmGetBufferL(const TSize& aSize);
sl@0
   731
    
sl@0
   732
    /** 
sl@0
   733
     * Releases an input buffer back to the media device without using
sl@0
   734
     * it. This method is mainly used as a response to a
sl@0
   735
     * MmvbmReleaseBuffers() callback.
sl@0
   736
     * 
sl@0
   737
     * @param aBuffer The buffer to release.
sl@0
   738
     */
sl@0
   739
    void MmvbmReleaseBuffer(TVideoPicture* aBuffer);    
sl@0
   740
    
sl@0
   741
public:
sl@0
   742
    
sl@0
   743
     // === MMMFVideoSurfaceSupport ===
sl@0
   744
    
sl@0
   745
	/** 
sl@0
   746
    Requests the media device to use graphics surfaces for video rendering. 
sl@0
   747
    The client must call this method before Initialize() to ensure the media 
sl@0
   748
    device allocates the right types of resources for rendering.
sl@0
   749
    */
sl@0
   750
    void MmvssUseSurfaces();
sl@0
   751
    
sl@0
   752
    /** 
sl@0
   753
    Sets a new video surface support observer to receive surface management events 
sl@0
   754
    from the media device.
sl@0
   755
     
sl@0
   756
    @param aObserver New observer object to use.
sl@0
   757
    */
sl@0
   758
    void MmvssSetObserver(MMMFVideoSurfaceObserver& aObserver);
sl@0
   759
    
sl@0
   760
    /** 
sl@0
   761
    Retrieves surface parameters for a display. The client typically calls this in response 
sl@0
   762
    to a MmvsoSurfaceCreated() or MmvsoSurfaceParametersUpdated() observer callback.
sl@0
   763
     
sl@0
   764
    @param  aSurfaceId
sl@0
   765
	        Surface ID for the display.
sl@0
   766
	@param  aCropRect
sl@0
   767
	        Cropping rectangle within the surface. The crop rectangle identifies the area of 
sl@0
   768
	        the surface that should be shown on the screen.
sl@0
   769
	@param  aPixelAspectRatio
sl@0
   770
	        Video picture pixel aspect ratio.
sl@0
   771
sl@0
   772
	@leave KErrNotReady if no surface is available for the display.
sl@0
   773
    */
sl@0
   774
    
sl@0
   775
    void MmvssGetSurfaceParametersL(TSurfaceId& aSurfaceId, TRect& aCropRect, 
sl@0
   776
    					TVideoAspectRatio& aPixelAspectRatio);
sl@0
   777
    /** 
sl@0
   778
    Indicates that the surface is no longer in use and can be destroyed. The client typically calls
sl@0
   779
    this in response to MmvsoSurfaceCreated() (while old surface is already in use and the current
sl@0
   780
    should be removed) or MmvsoRemoveSurface() observer callback.  
sl@0
   781
         
sl@0
   782
    @param aSurfaceId Surface ID that is no longer in use
sl@0
   783
    
sl@0
   784
    @leave KErrNotFound if the surface does not exist
sl@0
   785
    */
sl@0
   786
    void MmvssSurfaceRemovedL(const TSurfaceId& aSurfaceId);    
sl@0
   787
sl@0
   788
public:    
sl@0
   789
sl@0
   790
    // === MMmfVideoPropertiesObserver ===
sl@0
   791
    
sl@0
   792
    /** 
sl@0
   793
    Decoded video properties updated. The media device implementing the
sl@0
   794
    MMmfVideoPropertiesNotifier extension will call this method immediately
sl@0
   795
    before outputting a picture with the updated properties.
sl@0
   796
    
sl@0
   797
    When the extension is used between a decoder and a post-processor media
sl@0
   798
    device, the post-processor can associate the changed properties with the
sl@0
   799
    correct picture, since the next incoming picture after this call will
sl@0
   800
    be the first updated one. 
sl@0
   801
    
sl@0
   802
    When the extension is used between a DevVideoPlay client and a
sl@0
   803
    post-processor media device, the client can synchronously reconfigure
sl@0
   804
    video display options using SetScaleOptionsL() and related methods. This
sl@0
   805
    lets the client reconfigure the display for the correct picture.
sl@0
   806
    
sl@0
   807
    @param aYuvFormat Updated YUV format parameters. The updated fields are
sl@0
   808
                      iAspectRatioDenom, iAspectRatioNum, and iCoefficients     
sl@0
   809
    @param aPictureSize	Updated picture size. This size will be the true
sl@0
   810
                       	picture display size, excluding any padding that
sl@0
   811
                       	the codec might use.
sl@0
   812
    */
sl@0
   813
    virtual void MmvpoUpdateVideoProperties(const TYuvFormat& aYuvFormat, const TSize& aPictureSize);
sl@0
   814
    
sl@0
   815
public:
sl@0
   816
sl@0
   817
    // === MMmfVideoResourceObserver ===
sl@0
   818
    
sl@0
   819
    /** 
sl@0
   820
    Indicates that a media device has lost its resources. The client must
sl@0
   821
    synchronously pause or stop processing before returning from this method
sl@0
   822
    so that the media device can release its resources to the system. If
sl@0
   823
    the client does not pause or stop, resource loss will be handled as a
sl@0
   824
    fatal error.
sl@0
   825
     
sl@0
   826
    The client may start again or resume after receiving a
sl@0
   827
    MvroResourcesRestored() callback.
sl@0
   828
     
sl@0
   829
    @param aMediaDevice UID for the media device that lost resources. The
sl@0
   830
                        client can use this e.g. to determine whether the
sl@0
   831
                        decoder or the post-processor lost resources. This
sl@0
   832
                        is typically not required though since the client
sl@0
   833
                        must pause DevVideo entirely.
sl@0
   834
    */
sl@0
   835
    virtual void MmvroResourcesLost(TUid aMediaDevice);
sl@0
   836
sl@0
   837
    /** 
sl@0
   838
    Indicates that a media device has regained its resources after a
sl@0
   839
    previous resource loss. The client can restart or resume processing.
sl@0
   840
    This can be done either synchronously or asynchronously.
sl@0
   841
     
sl@0
   842
    @param aMediaDevice UID for the media device that regained resources.
sl@0
   843
    */
sl@0
   844
    virtual void MmvroResourcesRestored(TUid aMediaDevice);
sl@0
   845
            
sl@0
   846
    
sl@0
   847
    // === MMmfVideoSurfaceHandleControl ===
sl@0
   848
    
sl@0
   849
    /** 
sl@0
   850
    Sets an external surface ID. This should be called as soon as external surface is created.    
sl@0
   851
     
sl@0
   852
    @param aSurfaceID external surface ID.
sl@0
   853
        
sl@0
   854
    */
sl@0
   855
    
sl@0
   856
    virtual void MmvshcSetSurfaceHandle(const TSurfaceId& aSurfaceHandle);
sl@0
   857
    
sl@0
   858
    /** 
sl@0
   859
    Sets a redraw buffer to be used during resource loss.    
sl@0
   860
     
sl@0
   861
    @param aRedrawBuffer redraw buffer.
sl@0
   862
        
sl@0
   863
    */
sl@0
   864
     virtual void MmvshcRedrawBufferToSurface(TPtrC8& aRedrawBuffer);
sl@0
   865
public:
sl@0
   866
	// === MMmfVideoPropertiesNotifier ===
sl@0
   867
    /** 
sl@0
   868
    Sets a new video properties observer. This method can be called at any
sl@0
   869
    time after the media device has been instantiated.
sl@0
   870
     
sl@0
   871
    @param aObserver New observer object.
sl@0
   872
    */
sl@0
   873
    virtual void MmvpnSetObserver(MMmfVideoPropertiesObserver* aObserver);
sl@0
   874
sl@0
   875
public:
sl@0
   876
	
sl@0
   877
	void ReturnPicToDecoder(TVideoPicture* aPic);
sl@0
   878
	TInt AttemptToPost();
sl@0
   879
	
sl@0
   880
public:
sl@0
   881
    //=== MMdfTrickPlayControl === =     
sl@0
   882
    /**        
sl@0
   883
     * Query the Direction capabilities from the MDF decoders and       
sl@0
   884
     * post processor.       
sl@0
   885
     *        
sl@0
   886
    */       
sl@0
   887
    virtual void MmvprcGetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities);
sl@0
   888
sl@0
   889
    /**       
sl@0
   890
     * Sets the playback speed. A negative rate means play backward.       
sl@0
   891
     * +/- percentage.       
sl@0
   892
     *        
sl@0
   893
     */       
sl@0
   894
    virtual void MmvprcSetPlayRateL(const TInt aRate);
sl@0
   895
sl@0
   896
    /**       
sl@0
   897
     * Gets the playback speed. A negative rate means play backward.       
sl@0
   898
     * +/- percentage.       
sl@0
   899
     *        
sl@0
   900
     */       
sl@0
   901
    virtual TInt MmvprcPlayRateL();
sl@0
   902
sl@0
   903
    /**       
sl@0
   904
     * Sets the step frame number in frame step mode       
sl@0
   905
     * +/- frames       
sl@0
   906
     */       
sl@0
   907
    virtual void MmvprcStepFrameL(const TInt aStep);
sl@0
   908
sl@0
   909
    /**       
sl@0
   910
     * Registers the observer       
sl@0
   911
     */       
sl@0
   912
    virtual void MmvprcSetObserver(MMmfVideoPlayRateObserver& aObserver); 
sl@0
   913
sl@0
   914
public: 
sl@0
   915
     
sl@0
   916
    // === MMmfVideoSecureOutput ===
sl@0
   917
    /**
sl@0
   918
     * Notifies the media device if the content can only be sent to a
sl@0
   919
     * secure output. The device display is typically considered a
sl@0
   920
     * secure output, but a high-quality unprotected analog or digital
sl@0
   921
     * video output connector is not. By default all content can be
sl@0
   922
     * sent to both secure and insecure outputs.
sl@0
   923
     *
sl@0
   924
     * This method can only be called before the media device has been
sl@0
   925
     * initialised with InitializeL().
sl@0
   926
     *
sl@0
   927
     * @param aSecure Set to ETrue if the content can only be sent to
sl@0
   928
     *     a secure output, EFalse if both secure and unsecure outputs can
sl@0
   929
     *     be used.
sl@0
   930
     *
sl@0
   931
     * @leave KErrNotSupported Insecure outputs cannot be
sl@0
   932
     * disabled. The client should not play protected content.
sl@0
   933
     */    
sl@0
   934
     virtual void MmvsoSetSecureOutputL(TBool aSecure);
sl@0
   935
sl@0
   936
public:
sl@0
   937
     //=== AdvancedVideoSecureOutput === =     
sl@0
   938
     virtual void MmavsoSetAllowedOutputL(TUint aAllowedOutputMask);
sl@0
   939
    
sl@0
   940
protected: 
sl@0
   941
sl@0
   942
    // === CMMFVideoPostProcHwDevice ===
sl@0
   943
    /**
sl@0
   944
    Set the proxy implementation to be used. Called just after the object is constructed.
sl@0
   945
    @param  "aProxy"    "The proxy to use."
sl@0
   946
    */
sl@0
   947
    void SetProxy(MMMFDevVideoPlayProxy& aProxy);
sl@0
   948
    
sl@0
   949
protected:
sl@0
   950
sl@0
   951
    /**
sl@0
   952
     *  Symbian 2nd phase constructor .
sl@0
   953
     */
sl@0
   954
    void ConstructL();
sl@0
   955
    
sl@0
   956
private:    
sl@0
   957
	TInt IsTimeToPost(TVideoPicture* frame, TInt64& delta);
sl@0
   958
	TVideoPicture* CreateBuffersL(TInt aBufId);
sl@0
   959
    void CreateVBMBuffersL();
sl@0
   960
    TInt SetupExternalSurface(const TSurfaceId &aSurfaceID);
sl@0
   961
    void ReleaseInputQ();
sl@0
   962
    void ReleaseProcessQ();
sl@0
   963
    void ReleasePicture(TVideoPicture *pic);
sl@0
   964
    void PublishSurfaceCreated();
sl@0
   965
    void PublishSurfaceUpdated();
sl@0
   966
    TInt SetupSurface(const TSize& aSize);
sl@0
   967
    void SetSurfaceAttributes(const TSize& aSize, TInt aNumBuf);
sl@0
   968
    TInt GetID(TVideoPicture *aPicture);
sl@0
   969
    TInt GetExternalBufferID(TVideoPicture *aPicture);
sl@0
   970
    TInt RegisterSurface(const TSurfaceId& aSurfaceId);
sl@0
   971
    TInt IsGceReady();
sl@0
   972
    void SetTimer(TInt64 aDelta);
sl@0
   973
    TInt ConvertPostProcBuffer(TVideoPicture* pSrc, TVideoPicture* pDest);
sl@0
   974
    void AddPictureToVBMQ(TVideoPicture *pic);
sl@0
   975
    void AddPictureToColorConversionQ(TVideoPicture *pic);
sl@0
   976
    void ResetCountingBuffer();
sl@0
   977
    void PicturesSkipped();
sl@0
   978
    TVideoPicture* DoColorConvert(TVideoPicture* aPicture);
sl@0
   979
sl@0
   980
    /**       
sl@0
   981
     Adds a picture to the Input queue. Based on the timestamp of the picture,
sl@0
   982
     it is either appeneded at the end of the queue or inserted at the 
sl@0
   983
     appropriate position. The queue is arranged in the ascending order. 
sl@0
   984
     The ret value indicates if the head of the queue was changed or not.         
sl@0
   985
    */  
sl@0
   986
    TInt AddToQ(TVideoPicture* aPicture);
sl@0
   987
    
sl@0
   988
    /**       
sl@0
   989
     Removes a picture from Input queue based on the playrate.
sl@0
   990
     If the playrate is +ve ie forward playback head will be removed
sl@0
   991
     and if the playrate is -ve ie backward playback tail
sl@0
   992
     will be removed.         
sl@0
   993
    */  
sl@0
   994
    void RemoveFromQ();
sl@0
   995
    
sl@0
   996
    /**       
sl@0
   997
     Returns a picture from Input queue based on the playrate.
sl@0
   998
     If the playrate is +ve ie forward playback head will be returned
sl@0
   999
     and if the playrate is -ve ie backward playback tail  
sl@0
  1000
     will be returned.       
sl@0
  1001
    */  
sl@0
  1002
    TVideoPicture* PeekQ();
sl@0
  1003
sl@0
  1004
    /**
sl@0
  1005
    Adds a surface hint to a video surface. If there is any hint already added, 
sl@0
  1006
    the surface is updated with the new hint. 
sl@0
  1007
    */		
sl@0
  1008
    TInt AddHints();
sl@0
  1009
    
sl@0
  1010
	#ifdef _DUMP_YUV_FRAMES
sl@0
  1011
    void captureYuv(TVideoPicture* aPicture);
sl@0
  1012
    #endif
sl@0
  1013
    
sl@0
  1014
    TInt SetSourceFormat();
sl@0
  1015
    TInt SetSourceRange();
sl@0
  1016
    TInt ColorConvert(tBaseVideoFrame* aInputFrame, TUint8* aDestPtr, tWndParam* aInputCropWindow, tWndParam* aOutputCropWindow);
sl@0
  1017
sl@0
  1018
private:
sl@0
  1019
sl@0
  1020
    //
sl@0
  1021
    // C++ default constructor.  
sl@0
  1022
    //
sl@0
  1023
    CNGAPostProcHwDevice();
sl@0
  1024
sl@0
  1025
    //
sl@0
  1026
    // State of post processor
sl@0
  1027
    //
sl@0
  1028
    enum TPPState
sl@0
  1029
    {
sl@0
  1030
        EInitializing,
sl@0
  1031
        EInitialized,
sl@0
  1032
        EPlaying,
sl@0
  1033
        EPaused,
sl@0
  1034
        EStopped
sl@0
  1035
    };
sl@0
  1036
    
sl@0
  1037
    enum TTimeToPost
sl@0
  1038
    {
sl@0
  1039
        ESkipIt = -1,
sl@0
  1040
        EPostIt = 0,
sl@0
  1041
        EDelayIt = 1,
sl@0
  1042
    };
sl@0
  1043
    
sl@0
  1044
private: 
sl@0
  1045
sl@0
  1046
    MMMFDevVideoPlayProxy*      				iProxy;															
sl@0
  1047
    CMMFVideoDecodeHwDevice*    				iInputDecoderDevice;															
sl@0
  1048
    RArray<TVideoPicture*>              		iInputQ;															
sl@0
  1049
    RArray<TVideoPicture*>              		iProcessQ;															
sl@0
  1050
    MMMFClockSource*            				iClockSource;															
sl@0
  1051
    TTimeIntervalMicroSeconds					iCurrentPlaybackPosition;															
sl@0
  1052
    TPPState        							iPPState;															
sl@0
  1053
    CNGAPostProcSurfaceHandler*					iSurfaceHandler;
sl@0
  1054
    CNGAPostProcSessionManager*					iSessionManager;
sl@0
  1055
	
sl@0
  1056
	RSurfaceManager::TSurfaceCreationAttributesBuf	iAttributes;
sl@0
  1057
	RChunk										iChunk;
sl@0
  1058
	RSurfaceManager::TInfoBuf 					iInfo;
sl@0
  1059
	TSurfaceId									iSurfaceId;
sl@0
  1060
	TBool           							iIsInputEnded;
sl@0
  1061
	CNGAPostProcTimer*							iPostingTimer;
sl@0
  1062
	CMMFDevVideoPlay::TPictureCounters  		iPictureCounters;
sl@0
  1063
	TBool 										iFirstPictureUpdated;
sl@0
  1064
	TBool 										iUsingExternalSurface;
sl@0
  1065
    TBool           							iIsColorConversionNeeded;
sl@0
  1066
    RArray<TVideoPicture*>              		iColorConversionQ;
sl@0
  1067
    TBool 										iSurfaceCreatedEventPublished;
sl@0
  1068
    TInt                                		iOverflowPictureCounter;
sl@0
  1069
    TInt 								    	iVideoFrameBufSize;	
sl@0
  1070
    TBool 										iResourceLost;
sl@0
  1071
    TBool 										iRedrawDone;
sl@0
  1072
	// Flag to indicate that the redraw surface has been created, and
sl@0
  1073
	// can be used in a subsequent call ro Redraw()
sl@0
  1074
	TBool										iRedrawSurfaceInUse;
sl@0
  1075
sl@0
  1076
    //-- members for buffer management --
sl@0
  1077
    MMmfVideoBufferManagementObserver*  		iVBMObserver;
sl@0
  1078
    TBufferOptions                      		iVBMBufferOptions;
sl@0
  1079
    RArray<TVideoPicture*>              		iVBMBufferReferenceQ;
sl@0
  1080
    RArray<TVideoPicture*>              		iVBMBufferQ;
sl@0
  1081
    TBool                               		iVBMEnabled;
sl@0
  1082
    RArray<TUncompressedVideoFormat>    		iSupportedInputFormats;
sl@0
  1083
    TInt										count;
sl@0
  1084
    
sl@0
  1085
    //-- members for Surface Hints --
sl@0
  1086
    RSurfaceManager::THintPair					iHint;
sl@0
  1087
    TUint 										iSurfaceMask;
sl@0
  1088
    TUid										iSurfaceKey;
sl@0
  1089
            
sl@0
  1090
    //-- members for Surface support --
sl@0
  1091
    MMMFVideoSurfaceObserver*					iVideoSurfaceObserver;
sl@0
  1092
	MMmfVideoPropertiesObserver*				iVPObserver;
sl@0
  1093
	RWsSession									iWsSession;
sl@0
  1094
	TSize										iPicSize;
sl@0
  1095
	TUint										iAspectRatioNum;
sl@0
  1096
	TUint										iAspectRatioDenom;
sl@0
  1097
	//-- members for Trickplay support --
sl@0
  1098
	TInt                                iStepFrameCount;
sl@0
  1099
    TInt                                iPlayRate;       
sl@0
  1100
    TBool                               iKeyFrameMode;       
sl@0
  1101
    MMmfVideoPlayRateObserver*          iFPObserver;       
sl@0
  1102
    TUint8                              iSkippedFramesCountingBuffer[64];       
sl@0
  1103
    TUint8                              iSkippedFramesInLast64Frames;       
sl@0
  1104
    TUint8                              iCurrentPosInFramesCountingBuffer; 
sl@0
  1105
    TUncompressedVideoFormat 			iVideoFormat;
sl@0
  1106
        //---------- utility variables -------
sl@0
  1107
	// Image source format
sl@0
  1108
	TUint8 								iSourceFormat;
sl@0
  1109
sl@0
  1110
	//Image range
sl@0
  1111
	TUint8		 						iSourceRange;
sl@0
  1112
};    
sl@0
  1113
sl@0
  1114
/**
sl@0
  1115
 * Timer of Posting
sl@0
  1116
 */
sl@0
  1117
sl@0
  1118
class CNGAPostProcTimer: public CTimer
sl@0
  1119
    {
sl@0
  1120
public:
sl@0
  1121
    static CNGAPostProcTimer* NewL( CNGAPostProcHwDevice& aParent );
sl@0
  1122
    ~CNGAPostProcTimer();
sl@0
  1123
    
sl@0
  1124
protected:    
sl@0
  1125
    void RunL();
sl@0
  1126
    
sl@0
  1127
private:
sl@0
  1128
    CNGAPostProcTimer( CNGAPostProcHwDevice& aParent );
sl@0
  1129
    void ConstructL();
sl@0
  1130
    
sl@0
  1131
private:
sl@0
  1132
    CNGAPostProcHwDevice& iParent;
sl@0
  1133
};
sl@0
  1134
sl@0
  1135
#endif //__NGAPOSTPROCHWDEVICE_H__
sl@0
  1136