upnpavcontroller/upnpavcontrollerhelper/inc/upnptranscodehelper.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
       
     1 /*
       
     2 * Copyright (c) 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:  UPnP transcode helper
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_UPNPTRANSCODEHELPER_H
       
    19 #define C_UPNPTRANSCODEHELPER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "upnpgstwrapperobserver.h"
       
    25 
       
    26 class CUpnpItem;
       
    27 class CUpnpAVDevice;
       
    28 class CUpnpGstWrapper;
       
    29 
       
    30 
       
    31 NONSHARABLE_CLASS(CUpnpTranscodeHelper) : public CBase
       
    32                            , public MUpnpGstWrapperObserver
       
    33     {
       
    34     
       
    35     enum TContainerType
       
    36         {
       
    37         EUnknownContainer,
       
    38         EMp4Container,
       
    39         ETsContainer
       
    40         };
       
    41     
       
    42 public: // construction / destruction
       
    43     
       
    44     /**
       
    45      * Static NewL
       
    46      *
       
    47      * @param none
       
    48      * @return instance to CUpnpTranscodeHelper
       
    49      */
       
    50      static CUpnpTranscodeHelper* CUpnpTranscodeHelper::NewL();
       
    51 
       
    52     /**
       
    53      * Destructor
       
    54      */
       
    55      virtual ~CUpnpTranscodeHelper();
       
    56     
       
    57 private: // construction, private part
       
    58     
       
    59     /**
       
    60      * Constructor
       
    61      */
       
    62     CUpnpTranscodeHelper();  
       
    63     
       
    64     /**
       
    65      * 2nd phrase Constructor
       
    66      */
       
    67     void ConstructL();  
       
    68      
       
    69 public:
       
    70     
       
    71      /**
       
    72       * Fetch pre-defined transcoding pipeline and protocol info for renderer
       
    73       * 
       
    74       * @param aRenderer Reference to renderer
       
    75       * @param aUpnpItem Reference to original upnp item  
       
    76       * @param aPipeline Reference pointer to descriptor where parsed 
       
    77       *        transcoding pipeline will be allocated
       
    78       * @param aProtocolInfo Reference pointer to descriptor where parsed 
       
    79       *        protocol info will be allocated
       
    80       */
       
    81      void PreDefinedCfgL( const CUpnpAVDevice& aRenderer, 
       
    82              CUpnpItem& aUpnpItem, HBufC8*& aPipeline, 
       
    83              HBufC8*& aProtocolInfo );
       
    84     
       
    85     /**
       
    86      * Create transcoding pipeline 
       
    87      * 
       
    88      * @param aUpnpItem Reference to original upnp item
       
    89      * @param aRendererProtocolInfos Reference to descriptor array containing
       
    90      *        protocol list from the renderer
       
    91      * @return Pointer to descriptor containing transcoding pipeline; 
       
    92      *         NULL if match not found
       
    93      */
       
    94     HBufC8* PipelineL( CUpnpItem& aUpnpItem, 
       
    95             const CDesC8Array& aRendererProtocolInfos );    
       
    96     
       
    97     /**
       
    98      * Add a valid protocol info according to transcoding pipeline
       
    99      * 
       
   100      * @param aUpnpItem Reference to original upnp item
       
   101      * @param aPipeline Reference to pipeline descriptor
       
   102      * @param aProtocolMatches Reference to descriptor array containing
       
   103      *        protocol list from the renderer
       
   104      */    
       
   105     void AddValidResElementL( CUpnpItem& aUpnpItem, 
       
   106             const TDesC8& aPipeline, const CDesC8Array& aProtocolMatches );        
       
   107     
       
   108 
       
   109     void ReplaceResourceL( CUpnpItem& aUpnpItem, const TDesC8& aProtocolInfo );
       
   110     
       
   111     /*
       
   112      * Start transcoding
       
   113      * 
       
   114      * @param aPipeline Reference to pipeline descriptor
       
   115      */
       
   116     void TranscodeL( const TDesC8& aPipeline );
       
   117     
       
   118 private:
       
   119     
       
   120     HBufC8* GeneratePipelineL( const TDesC8& aOriginalFilePath, 
       
   121             TContainerType aDestContainerType );
       
   122     
       
   123     HBufC8* PathToLinuxSyntaxL( const TDesC& aOriginalPath );
       
   124     
       
   125 private:
       
   126     
       
   127     void HandleGstEvent( Gst::TEvent aEvent );
       
   128     
       
   129 private:
       
   130     
       
   131     RFs iFs;
       
   132     CUpnpGstWrapper* iGstWrapper;
       
   133     
       
   134     };
       
   135 
       
   136 #endif // C_UPNPTRANSCODEHELPER_H