accessoryservices/pluggeddisplay/edidparser/inc/cea861edidparser.h
changeset 0 4e1aa6a622a0
child 7 1a73e8f1b64d
child 9 b0e374890c7b
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2008,2009 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 * Declaration of CCea861EdidParser class.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef C_CCEA861EDIDPARSER_H
       
    20 #define C_CCEA861EDIDPARSER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "ediddatatypes.h"
       
    25 #include "cea861ediddatatypes.h"
       
    26 
       
    27 
       
    28 /**
       
    29  *  CCea861EdidParser is the base class for parsing CEA 861 EDID extension data
       
    30  *
       
    31  *  @lib    edidparser.dll
       
    32  *  @since  S60 v9.2
       
    33  */
       
    34 class CCea861EdidParser : public CBase
       
    35     {
       
    36 
       
    37 public:
       
    38 
       
    39     /**
       
    40      * Two-phased constructor.
       
    41      *
       
    42      * Creates an instance of CCea861EdidParser
       
    43      *
       
    44      * @param   aData
       
    45      * @return  CCea861EdidParser* created instance of CCea861EdidParser
       
    46      *
       
    47      */
       
    48     IMPORT_C static CCea861EdidParser* NewL( const TExtDataBlock& aData );
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      *
       
    53      * Creates an instance of CEdidParserBase
       
    54      *
       
    55      * @param   aData
       
    56      * @return  CCea861EdidParser* created instance of CCea861EdidParser
       
    57      *
       
    58      */
       
    59     IMPORT_C static CCea861EdidParser* NewLC( const TExtDataBlock& aData );
       
    60 
       
    61     /**
       
    62      * Destructor.
       
    63      */
       
    64     virtual ~CCea861EdidParser();
       
    65 
       
    66     /**
       
    67      * Parses extension block
       
    68      *
       
    69      * @param   aData Extension data block.
       
    70      * @return  TInt
       
    71      */
       
    72     IMPORT_C TInt ParseExtensionBlockL( const TExtDataBlock& aData );
       
    73 
       
    74     /**
       
    75      * Indicates whether or not extension data is parsed
       
    76      *
       
    77      * @param   none
       
    78      * @return  TBool
       
    79      */
       
    80     IMPORT_C TBool IsExtensionBlockParsed();
       
    81 
       
    82     /**
       
    83      * Gets VIC (Video Identification Code) from given video data block
       
    84      *
       
    85      * @param   aNumber
       
    86      * @return  VIC. Returns -1 if aNumber > number of VICs
       
    87      */
       
    88     IMPORT_C TInt8 GetVIC( TUint8 aNumber );
       
    89 
       
    90     /**
       
    91      * Indicates whether or not underscan is supported
       
    92      *
       
    93      * @param   none
       
    94      * @return  true/false
       
    95      */
       
    96     IMPORT_C TBool Underscan();
       
    97 
       
    98     /**
       
    99      * Indicates whether or not basic audio is supported
       
   100      *
       
   101      * @param   none
       
   102      * @return  true/false
       
   103      */
       
   104     IMPORT_C TBool BasicAudio();
       
   105 
       
   106     /**
       
   107      * Indicates whether or not YCbCr 4:4:4 color space is supported
       
   108      *
       
   109      * @param   none
       
   110      * @return  true/false
       
   111      */
       
   112     IMPORT_C TBool YCbCr444();
       
   113 
       
   114     /**
       
   115      * Indicates whether or not YCbCr 4:2:2 color space is supported
       
   116      *
       
   117      * @param   none
       
   118      * @return  true/false
       
   119      */
       
   120     IMPORT_C TBool YCbCr422();
       
   121 
       
   122     /**
       
   123      * Returns number of native formats.
       
   124      * Section 2.2 in CEA-861-E.pdf describes native format as below:
       
   125      * "A video format with native pixel layout and scanning method that the display device
       
   126      * accepts and displays without any internal scaling, de-interlacing, interlacing or frame
       
   127      * rate conversion"
       
   128      *
       
   129      * @param   none
       
   130      * @return  number of native formats
       
   131      */
       
   132     IMPORT_C TUint8 TotalNumberOfNativeFormats();
       
   133 
       
   134     /**
       
   135      * Indicates whether or not Audio Data Block is supported
       
   136      *
       
   137      * @param   none
       
   138      * @return  true/false
       
   139      */
       
   140     IMPORT_C TBool IsAudioDataBlockSupported();
       
   141     
       
   142     /**
       
   143      * Indicates whether or not Video Data Block is supported
       
   144      *
       
   145      * @param   none
       
   146      * @return  true/false
       
   147      */
       
   148     IMPORT_C TBool IsVideoDataBlockSupported();    
       
   149     
       
   150     /**
       
   151      * Indicates whether or not Vendor Specific Data Block is supported
       
   152      *
       
   153      * @param   none
       
   154      * @return  true/false
       
   155      */
       
   156     IMPORT_C TBool IsVendorSpecificDataBlockSupported();        
       
   157     
       
   158     /**
       
   159      * Indicates whether or not Speaker Allocation Data Block is supported
       
   160      *
       
   161      *
       
   162      * @param   none
       
   163      * @return  true/false
       
   164      */
       
   165     IMPORT_C TBool IsSpeakerAllocationDataBlockSupported();
       
   166 
       
   167     /**
       
   168      * Returns parsed information.
       
   169      * Ownership of the pointer is not transfered.
       
   170      *
       
   171      * @param   none
       
   172      * @return  CCea861ExtEdidInformation*
       
   173      */
       
   174     IMPORT_C CCea861ExtEdidInformation* GetParsedInformation();
       
   175     
       
   176     /**
       
   177      * Returns video latency from Vendor specific data block.
       
   178      * Value is number of (milliseconds / 2) + 1 with a maximum allowed value of 251 (indicating
       
   179      * 500 millisecond duration). A value of 0 indicates that the field is not valid
       
   180      * or that the latency is unknown. A value of 255 indicates that no video is
       
   181      * supported in this device or downstream.
       
   182      *
       
   183      * @param   aVendorDataBlock
       
   184      * @return  video latency in ms
       
   185      */
       
   186     IMPORT_C TUint8 GetVideoLatency();
       
   187     
       
   188     /**
       
   189      * Returns audio latency from Vendor specific data block.
       
   190      * Value is number of (milliseconds / 2) + 1 with a maximum allowed value of 251 (indicating
       
   191      * 500 millisecond duration). A value of 0 indicates that the field is not valid
       
   192      * or that the latency is unknown. A value of 255 indicates that no audio is
       
   193      * supported in this device or downstream.
       
   194      * 
       
   195      * @param   none
       
   196      * @return  audio latency in ms
       
   197      */
       
   198     IMPORT_C TUint8 GetAudioLatency();
       
   199 
       
   200     /**
       
   201      * Returns interlaced video latency from Vendor specific data block.
       
   202      * Value is number of (milliseconds / 2) + 1 with a maximum allowed value of 251 (indicating
       
   203      * 500 millisecond duration). A value of 0 indicates that the field is not valid
       
   204      * or that the latency is unknown. A value of 255 indicates that no video is
       
   205      * supported in this device or downstream.
       
   206      *
       
   207      * @param   aVendorDataBlock
       
   208      * @return  video latency in ms
       
   209      */
       
   210     IMPORT_C TUint8 GetInterlacedVideoLatency();
       
   211         
       
   212     /**
       
   213      * Returns interlaced audio latency from Vendor specific data block.
       
   214      * Value is number of (milliseconds / 2) + 1 with a maximum allowed value of 251 (indicating
       
   215      * 500 millisecond duration). A value of 0 indicates that the field is not valid
       
   216      * or that the latency is unknown. A value of 255 indicates that no audio is
       
   217      * supported in this device or downstream.
       
   218      *
       
   219      * @param   none
       
   220      * @return  audio latency in ms
       
   221      */
       
   222     IMPORT_C TUint8 GetInterlacedAudioLatency();
       
   223 
       
   224 private:
       
   225 
       
   226     /**
       
   227      * Default constructor.
       
   228      */
       
   229     CCea861EdidParser();
       
   230 
       
   231     /**
       
   232      * By default Symbian 2nd phase constructor is private.
       
   233      */
       
   234     void ConstructL( const TExtDataBlock& aData );
       
   235 
       
   236     /**
       
   237      * Reads CEA 861 extension v1
       
   238      * See table 36 in CEA-861-E.pdf
       
   239      *
       
   240      * @param   aData
       
   241      * @return  TBool
       
   242      */
       
   243     TInt ReadCeaVersion1L( const TExtDataBlock& aData, TInt aIndex );
       
   244 
       
   245     /**
       
   246      * Reads CEA 861 extension v2
       
   247      * See table 37 in CEA-861-E.pdf
       
   248      *
       
   249      * @param   aData
       
   250      * @return  TBool
       
   251      */
       
   252     TInt ReadCeaVersion2L( const TExtDataBlock& aData, TInt aIndex );
       
   253 
       
   254     /**
       
   255      * Reads CEA 861 extension v2
       
   256      * See table 38 in CEA-861-E.pdf
       
   257      *
       
   258      * @param   aData
       
   259      * @return  TBool
       
   260      */
       
   261     TInt ReadCeaVersion3L( const TExtDataBlock& aData, TInt aIndex );
       
   262 
       
   263     /**
       
   264      * Reads common parts of CEA 861 extension v2 and v3
       
   265      * See table 38 in CEA-861-E.pdf
       
   266      *
       
   267      * @param   aData
       
   268      * @return  TBool
       
   269      */
       
   270     TInt ReadCeaVersion2and3Common( const TExtDataBlock& aData, TInt& aIndex );
       
   271 
       
   272     /**
       
   273      * Gets EDID descriptor block
       
   274      *
       
   275      * @param   aData
       
   276      * @param   aIndex
       
   277      * @return  TEdidDescriptorBlock
       
   278      */
       
   279     TEdidDescriptorBlock GetDescriptorBlock( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   280 
       
   281     /**
       
   282      * Gets pixel clock from descriptor block
       
   283      *
       
   284      * @param   aData
       
   285      * @param   aIndex
       
   286      * @return  TUint16
       
   287      */
       
   288     TUint16 GetPixelClock( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   289 
       
   290     /**
       
   291      * Gets Horizontal Addressable Video in pixels
       
   292      *
       
   293      * @param   aData
       
   294      * @param   aIndex
       
   295      * @return  TUint16
       
   296      */
       
   297     TUint16 GetHorizontalAddressableVideoPixels( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   298 
       
   299     /**
       
   300      * Gets Horizontal Blanking in pixels
       
   301      *
       
   302      * @param   aData
       
   303      * @param   aIndex
       
   304      * @return  TUint16
       
   305      */
       
   306     TUint16 GetHorizontalBlanking( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   307 
       
   308     /**
       
   309      * Gets Vertical Addressable Video in lines
       
   310      *
       
   311      * @param   aData
       
   312      * @param   aIndex
       
   313      * @return  TUint16
       
   314      */
       
   315     TUint16 GetVerticalAddressableVideoPixels( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   316 
       
   317     /**
       
   318      * Gets Vertical Blanking in lines
       
   319      *
       
   320      * @param   aData
       
   321      * @param   aIndex
       
   322      * @return  TUint16
       
   323      */
       
   324     TUint16 GetVerticalBlanking( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   325 
       
   326     /**
       
   327      * Gets Horizontal Front Porch in pixels
       
   328      *
       
   329      * @param   aData
       
   330      * @param   aIndex
       
   331      * @return  TUint16
       
   332      */
       
   333     TUint16 GetHorizontalFrontPorch( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   334 
       
   335     /**
       
   336      * Gets Horizontal Sync Pulse Width in lines
       
   337      *
       
   338      * @param   aData
       
   339      * @param   aIndex
       
   340      * @return  TUint16
       
   341      */
       
   342     TUint16 GetHorizontalSyncPulseWidth( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   343 
       
   344     /**
       
   345      * Gets Vertical Front Porch in lines
       
   346      *
       
   347      * @param   aData
       
   348      * @param   aIndex
       
   349      * @return  TUint16
       
   350      */
       
   351     TUint16 GetVerticalFrontPorch( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   352 
       
   353     /**
       
   354      * Gets Vertical Sync Pulse Width in lines
       
   355      *
       
   356      * @param   aData
       
   357      * @param   aIndex
       
   358      * @return  TUint16
       
   359      */
       
   360     TUint8 GetVerticalSyncPulseWidth( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   361 
       
   362     /**
       
   363      * Gets Horizontal Addressable Video Image Size in mm
       
   364      *
       
   365      * @param   aData
       
   366      * @param   aIndex
       
   367      * @return  TUint16
       
   368      */
       
   369     TUint16 GetHorizontalAddressableImageSizeInMm( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   370 
       
   371     /**
       
   372      * Gets Vertical Addressable Video Image Size in mm
       
   373      *
       
   374      * @param   aData
       
   375      * @param   aIndex
       
   376      * @return  TUint16
       
   377      */
       
   378     TUint16 GetVerticalAddressableImageSizeInMm( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   379 
       
   380     /**
       
   381      * Gets Right Horizontal Border or Left Horizontal Border in Pixels
       
   382      *
       
   383      * @param   aData
       
   384      * @param   aIndex
       
   385      * @return  TUint8
       
   386      */
       
   387     TUint8 GetHorizontalBorderSize( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   388 
       
   389     /**
       
   390      * Gets Top Vertical Border or Bottom Vertical Border in Lines
       
   391      *
       
   392      * @param   aData
       
   393      * @param   aIndex
       
   394      * @return  TUint8
       
   395      */
       
   396     TUint8 GetVerticalBorderSize(const TExtDataBlock& aData, TInt& aIndex) const;
       
   397 
       
   398     /**
       
   399      * Checks whether or not video is interlaced
       
   400      *
       
   401      * @param   aData
       
   402      * @param   aIndex
       
   403      * @return  TBool
       
   404      */
       
   405     TBool GetVideoIsInterlaced( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   406 
       
   407     /**
       
   408      * Gets stero support
       
   409      *
       
   410      * @param   aData
       
   411      * @param   aIndex
       
   412      * @return  TEdidStereoViewingSupport
       
   413      */
       
   414     TEdidStereoViewingSupport GetStereoViewingSupport( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   415 
       
   416     /**
       
   417      * Gets signal definitions
       
   418      *
       
   419      * @param   aData
       
   420      * @param   aIndex
       
   421      * @return  TEdidSyncSignalDefinitions
       
   422      */
       
   423     TEdidSyncSignalDefinitions GetSyncSignalDefinitions( const TExtDataBlock& aData, TInt& aIndex ) const;
       
   424 
       
   425     /**
       
   426      * Gets analog sync signal definitions
       
   427      *
       
   428      * @param   aByte17
       
   429      * @return  TEdidSyncSignalDefinitions
       
   430      */
       
   431     static TEdidSyncSignalDefinitions GetAnalogSyncSignalDefinitions( const TUint8 aByte17 );
       
   432 
       
   433     /**
       
   434      * Gets digital sync signal definitions
       
   435      *
       
   436      * @param   aByte17
       
   437      * @return  TEdidSyncSignalDefinitions
       
   438      */
       
   439     static TEdidSyncSignalDefinitions GetDigitalSyncSignalDefinitions( const TUint8 aByte17 );
       
   440 
       
   441 
       
   442     /**
       
   443      * CEA data block
       
   444      **/
       
   445 
       
   446     /**
       
   447      * Reads CEA data block collection
       
   448      *
       
   449      * @param   aData
       
   450      * @param   aIndex
       
   451      * @return  TInt
       
   452      */
       
   453     TInt ReadCeaDataBlockCollectionL( const TExtDataBlock& aData, TInt& aIndex );
       
   454 
       
   455     /**
       
   456      * Reads CEA 861 short audio data block
       
   457      *
       
   458      * @param   aData
       
   459      * @param   aIndex
       
   460      * @param   aLen
       
   461      * @return  none
       
   462      */
       
   463     void ReadCea861ShortAudioDataBlockL( const TExtDataBlock& aData, TInt& aIndex, const TInt8 aLen );
       
   464 
       
   465     /**
       
   466      * Reads CEA 861 short video data block
       
   467      *
       
   468      * @param   aData
       
   469      * @param   aIndex
       
   470      * @param   aLen
       
   471      *
       
   472      * @return  none
       
   473      */
       
   474     void ReadCea861ShortVideoDataBlockL( const TExtDataBlock& aData, TInt& aIndex, const TInt8 aLen );
       
   475 
       
   476     /**
       
   477      * Reads CEA 861 vendor data block
       
   478      *
       
   479      * @param   aData
       
   480      * @param   aIndex
       
   481      * @param   aLen
       
   482      * @return  none
       
   483      */
       
   484     void ReadCea861VendorSpecificDataBlockL( const TExtDataBlock& aData, TInt& aIndex, TInt8 aLen );
       
   485 
       
   486     /**
       
   487      * Reads CEA 861 speaker allocation data block
       
   488      *
       
   489      * @param   aData
       
   490      * @param   aIndex
       
   491      * @param   aLen
       
   492      * @return  none
       
   493      */
       
   494     void ReadCea861SpeakerAllocationDataBlock( const TExtDataBlock& aData, TInt& aIndex, const TInt8 aLen );
       
   495 
       
   496 
       
   497     /**
       
   498      * Reads video capability block
       
   499      *
       
   500      * @param   aData
       
   501      * @param   aIndex
       
   502      * @param   aLen
       
   503      * @return  none
       
   504      */
       
   505     void ReadVideoCapabilityDataBlockL( const TExtDataBlock& aData, TInt& aIndex, const TInt8 aLen );
       
   506 
       
   507     /**
       
   508      * Reads unknwown data block to skip it
       
   509      *
       
   510      * @param   aData
       
   511      * @param   aIndex
       
   512      * @param   aLen
       
   513      * @return  none
       
   514      */
       
   515     void ReadUnknownTagCode( const TExtDataBlock& aData, TInt& aIndex, const TInt8 aLen );
       
   516 
       
   517     /**
       
   518      * Determines audio block information
       
   519      *
       
   520      * @param   aAudioBlock
       
   521      * @return  none
       
   522      */
       
   523     void CCea861EdidParser::DetermineAudioBlockInformation( TCEA861AudioDataBlock* aAudioBlock );
       
   524     
       
   525     /**
       
   526      * Check if Latency_Fields_Preset bit is set as specified in HDMISpecification13a.pdf.
       
   527      * 
       
   528      * @param aByte Byte to check.
       
   529      * @return ETrue if Latency_Fields_Present bit is set.
       
   530      */
       
   531     TBool LatencyFieldsPresent( TUint8 aByte ) const;
       
   532 
       
   533     /**
       
   534      * Check if I_Latency_Fields_Preset bit is set as specified in HDMISpecification13a.pdf.
       
   535      * 
       
   536      * @param aByte Byte to check.
       
   537      * @return ETrue if I_Latency_Fields_Present bit is set.
       
   538      */
       
   539     TBool InterlacedLatencyFieldsPresent( TUint8 aByte ) const;
       
   540     
       
   541     /**
       
   542      * Calculate the video/audio latency in mm seconds.
       
   543      * 
       
   544      * @param aByte Byte containing the latency information.
       
   545      * @return Latency information in ms.
       
   546      */
       
   547     TUint8 LatencyInMs( TUint8 aByte ) const;
       
   548 
       
   549 private: // data
       
   550 
       
   551      TBool                       iParsed;           // Indicates whether or not extension block is parsed
       
   552      TExtDataBlock               iExtensionData;    // Extension data
       
   553      CCea861ExtEdidInformation*  iParsedInfo;       // Contains Parsed information
       
   554      TBool                       iAudioDataBlockSupported;
       
   555      TBool                       iVideoDataBlockSupported;
       
   556      TBool                       iVendorSpecificDataBlockSupported;
       
   557      TBool                       iSpeakerAllocationDataBlockSupported;
       
   558      
       
   559     };
       
   560 
       
   561 
       
   562 #endif // C_CCEA861EDIDPARSER_H