vtprotocolplugins/DisplaySink/inc/CVtImageIYUV.h
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004 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:    Image Transforms subsystem.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CVTIMAGEIYUV_H
       
    23 #define CVTIMAGEIYUV_H
       
    24 
       
    25 // INCLUDE FILES
       
    26 
       
    27 #include "cvtimage.h"
       
    28 
       
    29 // CLASS DECLARATIONS
       
    30 
       
    31 /**
       
    32 *  CFbsBitmap image implementation.
       
    33 *
       
    34 *  @lib videosource.lib
       
    35 */
       
    36 class CVtImageIYUV : public CVtImage
       
    37     {
       
    38     public:
       
    39         
       
    40         /**
       
    41         * Creates new instance of CVtImageIYUV.
       
    42         * @param "aSize" Size of the image in pixels.
       
    43         * @exception In error situation leaves with one of the system wide
       
    44         * error codes.
       
    45         * @return Pointer to newly created instance.
       
    46         */
       
    47         IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize );
       
    48 
       
    49         /**
       
    50         * Creates new instance of CVtImageIYUV.
       
    51         * @param "aSize" Size of the image in pixels.
       
    52         * @param "aImage" Image data as 8-bit descriptor. Image data is copied into 
       
    53         * this instance.
       
    54         * @exception In error situation leaves with one of the system wide
       
    55         * error codes.
       
    56         * @return Pointer to newly created instance.
       
    57         */
       
    58         IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, const TDesC8& aImage );
       
    59 
       
    60         /**
       
    61         * Creates new instance of CVtImageIYUV.
       
    62         * @param "aSize" Size of the image in pixels.
       
    63         * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
       
    64         * and thus changes to this instance will be visible in the caller descriptor
       
    65         * as well. Also descriptor must remain accessible lifetime of the current 
       
    66         * instance or until new non-referenced image is set.
       
    67         * @exception In error situation leaves with one of the system wide
       
    68         * error codes.
       
    69         * @return Pointer to newly created instance.
       
    70         */
       
    71         IMPORT_C static CVtImageIYUV* NewL( const TSize& aSize, TPtr8& aImage );
       
    72 
       
    73         /**
       
    74         * C++ destructor.
       
    75         */
       
    76         IMPORT_C ~CVtImageIYUV();
       
    77 
       
    78         /**
       
    79         * Updates image with given data.
       
    80         * @param "aImage" New image.
       
    81         * @param "aImage" Image data as 8-bit descriptor. Image data is copied into 
       
    82         * this instance.
       
    83         * @exception In error situation leaves with one of the system wide
       
    84         * error codes.
       
    85         */
       
    86         IMPORT_C void SetImageL( const TDesC8& aImage );
       
    87 
       
    88         /**
       
    89         * Updates image with given data.
       
    90         * @param "aImage" Image data as 8-bit descriptor. This image will be referenced
       
    91         * and thus changes to this instance will be visible in the caller descriptor
       
    92         * as well. Also descriptor must remain accessible lifetime of the current 
       
    93         * instance or until new non-referenced image is set.
       
    94         * @exception In error situation leaves with one of the system wide
       
    95         * error codes.
       
    96         */
       
    97         IMPORT_C void SetImageL( TPtr8& aImage );
       
    98 
       
    99         /**
       
   100         * Returns image as descriptor.
       
   101         * @return Image as 8-bit descriptor.
       
   102         */
       
   103         IMPORT_C TPtrC8 Image() const;
       
   104 
       
   105         /**
       
   106         * Returns pointer to Y plane of this image.
       
   107         * @return Pointer to Y plane of this image.
       
   108         */
       
   109         IMPORT_C TUint8* Y() const;
       
   110         
       
   111         /**
       
   112         * Returns pointer to U plane of this image.
       
   113         * @return Pointer to U plane of this image.
       
   114         */
       
   115         IMPORT_C TUint8* U() const;
       
   116         
       
   117         /**
       
   118         * Returns pointer to V plane of this image.
       
   119         * @return Pointer to V plane of this image.
       
   120         */
       
   121         IMPORT_C TUint8* V() const;
       
   122 
       
   123         /**
       
   124         * Returns width of the U and V plane in bytes.
       
   125         * @return Width of the U and V plane in bytes.
       
   126         */
       
   127         IMPORT_C TInt UVPlaneWidth() const;
       
   128  
       
   129         /**
       
   130         * Returns height of the U and V plane in bytes.
       
   131         * @return Height of the U and V plane in bytes.
       
   132         */
       
   133         IMPORT_C TInt UVPlaneHeight() const;
       
   134 
       
   135     public: // from CVtImage
       
   136 
       
   137         /**
       
   138         * From CVtImage. See CVtImage for description.
       
   139         */
       
   140         TBool NeedHeapLock() const;
       
   141 
       
   142         /**
       
   143         * From CVtImage. See CVtImage for description.
       
   144         */
       
   145         TVtDisplayMode DisplayMode() const;
       
   146 
       
   147         /**
       
   148         * From CVtImage. See CVtImage for description.
       
   149         */
       
   150         TSize Size() const;
       
   151 
       
   152         /**
       
   153         * From CVtImage. See CVtImage for description.
       
   154         */
       
   155         TInt BytesPerRow() const;
       
   156 
       
   157         /**
       
   158         * From CVtImage. See CVtImage for description.
       
   159         */
       
   160         TUint32* DataAddress() const;
       
   161         
       
   162         /**
       
   163         * From CVtImage. See CVtImage for description.
       
   164         */
       
   165         TUint32* LineAddress( TInt aLine ) const;
       
   166 
       
   167 
       
   168     private:
       
   169 
       
   170         /**
       
   171         * Returns size of the image in bytes (all planes
       
   172         * included).
       
   173         * @return Size of the image in bytes.
       
   174         */
       
   175         TInt ImageSize() const;
       
   176 
       
   177         /**
       
   178         * C++ constructor.
       
   179         */
       
   180         CVtImageIYUV( const TSize& aSize );
       
   181 
       
   182         /**
       
   183         * Second phase constructor.
       
   184         * @exception In error situation leaves with one of the system wide
       
   185         * error codes.
       
   186         */
       
   187         void ConstructL( const TDesC8* aImage );
       
   188 
       
   189         /**
       
   190         * Validates given size.
       
   191         * @exception If the size is not correct leaves with KErrArgument.
       
   192         */
       
   193         void ValidateSizeL( const TSize& aSize );
       
   194 
       
   195         /**
       
   196         * Checks the size of the given descriptor against required size.
       
   197         * @exception If the size is not correct leaves with KErrArgument.
       
   198         */
       
   199         void CheckDescriptorSizeL( const TDesC8& aImage );
       
   200 
       
   201         /**
       
   202         * Sets Y, U and V plane pointers.
       
   203         */
       
   204         void SetYUVPointers();
       
   205     private:
       
   206         
       
   207         // Size of the image
       
   208         TSize iSize;
       
   209         
       
   210         // Image data
       
   211         HBufC8* iImage; // owned
       
   212 
       
   213         // Image data ptr descriptor
       
   214         TPtr8 iPtrImage;
       
   215 
       
   216         // Ptr to Y plane
       
   217         TUint8* iY;
       
   218 
       
   219         // Ptr to U plane
       
   220         TUint8* iU;
       
   221         
       
   222         // Ptr to V plane
       
   223         TUint8* iV;
       
   224     };
       
   225 
       
   226 
       
   227 #endif // CVTIMAGEIYUV_H
       
   228             
       
   229 // End of File
       
   230 
       
   231