javauis/mmapi_qt/baseline/inc/tmmaparametervalidator.h
branchRCL_3
changeset 24 0fd27995241b
child 48 e0d6e9bd3ca7
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  This class is used for parsing and validating properties
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TMMAPARAMETERVALIDATOR_H
       
    20 #define TMMAPARAMETERVALIDATOR_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <mmfutilities.h>
       
    25 #include <imageconversion.h>
       
    26 // STRUCTS
       
    27 
       
    28 /**
       
    29  * These structs are used for storing settings
       
    30  */
       
    31 
       
    32 // Default values for recorder
       
    33 const TInt KDefaultBits =     -1;
       
    34 const TInt KDefaultRate =     -1;
       
    35 const TInt KDefaultChannels = -1;
       
    36 
       
    37 
       
    38 NONSHARABLE_STRUCT(CMMAAudioSettings): public CBase
       
    39 {
       
    40 
       
    41     ~CMMAAudioSettings();
       
    42 
       
    43     TUid iController;
       
    44     TUid iEncoding;
       
    45     TFourCC iDataType;
       
    46     TInt iRate;
       
    47     TInt iChannels;
       
    48     TBool iStreamableFormat;
       
    49     HBufC *iContentType;
       
    50 };
       
    51 
       
    52 NONSHARABLE_STRUCT(TMMAVideoSettings)
       
    53 {
       
    54     TPtrC iEncoding;
       
    55     TReal32 iFps;
       
    56     TInt iWidth;
       
    57     TInt iHeight;
       
    58     inline void operator=(const TMMAVideoSettings& aSettings)
       
    59     {
       
    60         iEncoding.Set(aSettings.iEncoding);
       
    61         iFps = aSettings.iFps;
       
    62         iHeight = aSettings.iHeight;
       
    63         iWidth = aSettings.iWidth;
       
    64     }
       
    65 };
       
    66 /**
       
    67  * Container for image settings
       
    68  */
       
    69 
       
    70 NONSHARABLE_CLASS(CMMAImageSettings): public CBase
       
    71 {
       
    72 public: // destructor
       
    73     ~CMMAImageSettings();
       
    74     // this is basicly struct owning some data
       
    75     // so there is no point to make getters/setters
       
    76 public:
       
    77     HBufC8* iMimeType; //owned
       
    78     HBufC8* iType; // owned
       
    79     TInt  iWidth;
       
    80     TInt  iHeight;
       
    81     CFrameImageData* iImageData; //owned
       
    82 };
       
    83 
       
    84 //  CLASS DECLARATION
       
    85 /**
       
    86 *   This class is used for parsing and validating properties
       
    87 *   The property string is in format "name=value&name=value&..."
       
    88 *
       
    89 */
       
    90 
       
    91 NONSHARABLE_CLASS(TMMAParameterValidator)
       
    92 {
       
    93 public:// New methods
       
    94     /**
       
    95      * Validates audio properties. Accepted keys are:
       
    96      * "encoding", "rate", "bits", "channels", "endian", "signed"
       
    97      * Properties string must start with "encoding" parameter
       
    98      * Leaves with KErrArgument if parameters are not valid.
       
    99      */
       
   100     static CMMAAudioSettings *ValidateAudioPropertiesL(const TDesC& aProperties);
       
   101 
       
   102     /**
       
   103      * Validates video properties. Accepted keys are:
       
   104      * "encoding", "fps", "width", "height"
       
   105      * Properties string must start with "encoding" parameter
       
   106      * Leaves with KErrArgument if parameters are not valid.
       
   107      */
       
   108     static TMMAVideoSettings ValidateVideoPropertiesL(const TDesC& aProperties);
       
   109 
       
   110     /**
       
   111      * Validates image properties. Accepted keys are:
       
   112      * "encoding", "width", "height", "quality", "progressive", "interlaced", "type", "colors"
       
   113      * Properties string must start with "encoding" parameter
       
   114      * Leaves with KErrArgument if parameters are not valid.
       
   115      */
       
   116     static CMMAImageSettings* ValidateImagePropertiesL(const TDesC& aProperties);
       
   117 
       
   118 private: // New methods
       
   119     /**
       
   120      * Every properties must start with "encoding="
       
   121      */
       
   122     static void CheckEncodingL(const TDesC& aProperties);
       
   123 
       
   124     /**
       
   125      * Creates new HBufC8 and copies data to it from aDes.
       
   126      */
       
   127     static HBufC8* CreateHBufC8FromUnicodeL(const TDesC& aDes);
       
   128 };
       
   129 
       
   130 #endif // TMMAPARAMETERVALIDATOR_H