os/mm/mdfdevvideoextensions/nga_mdf_postprocessor_shai/inc/NGAPostProcSurfaceHandler.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2008 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:
    15 *
    16 */
    17 
    18 
    19 #ifndef __NGAPOSTPROCSURFACEHANDLER_H__
    20 #define __NGAPOSTPROCSURFACEHANDLER_H__
    21 
    22 #include <e32std.h>
    23 #include <graphics/surface.h>
    24 
    25 class RSurfaceManager;
    26 
    27 class CNGAPostProcSurfaceHandler: public CBase
    28 {
    29 
    30 public: 
    31     //  === Constructors and destructor ===
    32     /**
    33     * Two-phased constructor.   
    34     * @return pointer to an instance of CMMFVideoPostProcHwDevice
    35     */
    36     static CNGAPostProcSurfaceHandler* NewL();
    37 
    38     /**
    39     * Destructor.
    40     */
    41     ~CNGAPostProcSurfaceHandler();
    42 
    43 public: 
    44     
    45     /**
    46     Sets the device input format to an uncompressed video format.
    47 
    48     @param  "aFormat"   "The input format to use."
    49     @leave  "The method will leave if an error occurs. Typical error codes used:
    50             * KErrNotSupported - The input format is not supported."    
    51     @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
    52     */
    53     TInt CreateSurface(const RSurfaceManager::TSurfaceCreationAttributes & aAttributes, TSurfaceId& aSurfaceId, const RChunk& aChunk);
    54     TInt CreateSurface(const RSurfaceManager::TSurfaceCreationAttributesBuf & aAttributes, TSurfaceId& aSurfaceId);
    55 
    56     /**
    57     Sets the decoder device that will write data to this post-processor. Decoded pictures will be 
    58     written with WritePictureL() or through a custom interface. After pictures have been processed, 
    59     they must be returned to the decoder using ReturnPicture().
    60 
    61     @param  "aDevice"   "The decoder source plug-in to use."
    62     @pre    "This method can only be called before the hwdevice has been initialized with Initialize()."
    63     */
    64     TInt OpenSurface(const TSurfaceId& aSurfaceId);
    65 
    66     /**
    67     Writes an uncompressed video picture to the post-processor. The picture must be returned to the 
    68     client or source plug-in after it has been used.
    69 
    70     @param  "aPicture"  "The picture to write."
    71     @leave  "This method may leave with one of the system-wide error codes."
    72     @pre    "This method can only be called after the hwdevice has been initialized with Initialize()."
    73     */
    74     TInt MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle);    
    75 
    76     /**
    77     Retrieves post-processing information about this hardware device. 
    78     The device creates a CPostProcessorInfo structure, fills it with correct data, pushes it 
    79     to the cleanup stack and returns it. The client will delete the object when it is no 
    80     longer needed.
    81 
    82     @return "Post-processor information as a CPostProcessorInfo object. 
    83             The object is pushed to the cleanup stack, and must be deallocated by the caller."
    84     @leave  "This method may leave with one of the system-wide error codes.
    85     */
    86     TInt SurfaceInfo(const TSurfaceId& aSurfaceId, RSurfaceManager::TInfoBuf& aInfo);
    87 
    88     /**
    89     Retrieves the list of the output formats that the device supports. The list is ordered in 
    90     plug-in preference order, with the preferred formats at the beginning of the list. The list 
    91     can depend on the device source format, and therefore SetSourceFormatL() must be called before 
    92     calling this method.
    93 
    94     @param "aFormats" "An array for the result format list. The array must be created and destroyed by the caller."
    95     @leave  "This method may leave with one of the system-wide error codes.
    96     @pre    "This method may only be called before the hwdevice has been initialized using Initialize()."
    97     */
    98     TInt DestroySurface(const TSurfaceId& aSurfaceId);
    99     
   100     /**
   101 	Get the offset of the specified buffer from the base address of the underlying
   102 	chunk.
   103 	
   104 	To obtain the address of the buffer, the offset returned must be added onto the
   105 	base address of the RChunk returned in a call to MapSurface(). Note that
   106 	buffer offsets are immutable during the lifetime of the surface.
   107 	@param aParam The input parameters including the surface ID and buffer index.
   108 	@pre The surface is open in the calling process.
   109 	@return KErrNone if successful, KErrArgument if aSurfaceId or aBuffer are invalid,
   110 	KErrAccessDenied if the surface is not open in the current process, KErrNotSupported if
   111 	the surface is not mappable, otherwise a system wide error code.
   112 	*/
   113     TInt GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset);
   114     
   115      /**
   116     Adds a Surface hint to the video surface. 
   117     
   118     */
   119     TInt AddSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint);
   120     
   121     /**
   122     Updates an existing Surface hint. 
   123     
   124     */
   125     TInt SetSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint);
   126     
   127 protected:
   128 	CNGAPostProcSurfaceHandler();
   129     /**
   130      *  Symbian 2nd phase constructor .
   131      */
   132     void ConstructL();
   133 
   134 private: 
   135 
   136     RSurfaceManager*      iSurfaceManager;
   137 
   138     RSurfaceManager::TSurfaceCreationAttributesBuf iSurfaceAttributesBuf;
   139     // A surface attribute.
   140     RSurfaceManager::TSurfaceCreationAttributes& iSurfaceAttributes;
   141 };    
   142 
   143 #endif //__NGAPOSTPROCSURFACEHANDLER_H__