dvrengine/CommonRecordingEngine/DvrRtpClipHandler/inc/CRtpClipRepairer.h
branchRCL_3
changeset 22 826cea16efd9
parent 21 798ee5f1972c
child 23 13a33d82ad98
equal deleted inserted replaced
21:798ee5f1972c 22:826cea16efd9
     1 /*
       
     2 * Copyright (c) 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 the License "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:    RTP clip repairer for common recording engine.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CRTPCLIPREPAIRER_H
       
    21 #define CRTPCLIPREPAIRER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <ipvideo/CRtpFileBase.h>
       
    25 #include "CCRRtpFileSource.h"
       
    26 #include <ipvideo/MRtpClipRepairObserver.h>
       
    27 
       
    28 // CONSTANTS
       
    29 // None
       
    30 
       
    31 // MACROS
       
    32 // None
       
    33 
       
    34 // DATA TYPES
       
    35 // None
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CRtpMetaHeader;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 *  Repairs corrupted DVB-H RTP clip.
       
    44 *  
       
    45 *  @lib DvrRtpClipHandler.lib
       
    46 *  @since Series 60 3.0
       
    47 */
       
    48 class CRtpClipRepairer : public CRtpFileBase
       
    49     {
       
    50 
       
    51 public: // Constructors and destructor
       
    52 
       
    53     /**
       
    54     * Two-phased constructor.
       
    55     * @since Series 60 3.0
       
    56     * @param aObs observer for repair status
       
    57     * @return None.
       
    58     */
       
    59     static CRtpClipRepairer* NewL( MRtpClipRepairObserver* aObs );
       
    60 
       
    61     /**
       
    62     * Destructor.
       
    63     */
       
    64     virtual ~CRtpClipRepairer();
       
    65 
       
    66 public: // New functions
       
    67 
       
    68     /**
       
    69     * Check if corrupted meta header can be fixed.
       
    70     * @since Series 60 3.0
       
    71     * @param aClipName a full path of the clip.
       
    72     * @return None.
       
    73     */
       
    74     void CheckMetaHeaderL( const TDesC& aClipName ); 
       
    75 
       
    76     /**
       
    77     * Getter for the clip name under repairing.
       
    78     * @since Series 60 3.0
       
    79     * @return a full path of the clip under repairing.
       
    80     */
       
    81     TPtrC CurrentClipName(); 
       
    82 
       
    83 private: // Constructors and destructor
       
    84 
       
    85     /**
       
    86     * C++ default constructor.
       
    87     * @since Series 60 3.0
       
    88     * @param aObs observer for repair status
       
    89     */
       
    90     CRtpClipRepairer( MRtpClipRepairObserver* aObs );
       
    91 
       
    92     /**
       
    93     * Symbian 2nd phase constructor can leave and is private by default.
       
    94     */
       
    95     void ConstructL();
       
    96   	
       
    97 private: // Functions from base classes
       
    98 
       
    99     /**
       
   100     * From CRtpFileBase.
       
   101     * Called when request completion event occurs.
       
   102     * @since Series 60 3.0
       
   103     * @param none.
       
   104     * @return none.
       
   105     */
       
   106     void RunL();
       
   107 
       
   108     /**
       
   109     * From CRtpFileBase.
       
   110     * Handles a leave occurring in the request completion event handler RunL().
       
   111     * @since Series 60 3.0
       
   112     * @param aError the leave code.
       
   113     * @return a status of function.
       
   114     */
       
   115     TInt RunError( TInt aError );
       
   116 
       
   117     /**
       
   118     * From CRtpFileBase : Called when request completion event cancelled.
       
   119     * @since Series 60 3.0
       
   120     * @param none.
       
   121     * @return None.
       
   122     */
       
   123     void DoCancel();
       
   124 
       
   125 private: // New functions
       
   126 
       
   127     /**
       
   128     * Veryfies that seek header and array are valid.
       
   129     * @since Series 60 3.0
       
   130     * @param none.
       
   131     * @return true if are, otherwise false.
       
   132     */
       
   133     TBool ValidSeekHeaderL();
       
   134 
       
   135     /**
       
   136     * Scans whole clip and updates seek array for it.
       
   137     * @since Series 60 3.0
       
   138     * @param none.
       
   139     * @return none.
       
   140     */
       
   141     void UpdateSeekArrayL();
       
   142 
       
   143     /**
       
   144     * Activates asyncronous group header reading.
       
   145     * @since Series 60 3.0
       
   146     * @param none.
       
   147     * @return none.
       
   148     */
       
   149     void ReadNextGroupHeaderFromFileL();
       
   150 
       
   151     /**
       
   152     * Appends rec groups to seek array in 30s interval.
       
   153     * @since Series 60 3.0
       
   154     * @param none.
       
   155     * @return none.
       
   156     */
       
   157     void GroupToSeekArrayL();
       
   158 
       
   159     /**
       
   160     * Adds special packet to the end.
       
   161     * @since Series 60 3.0
       
   162     * @param aType a type of special packet.
       
   163     * @return none.
       
   164     */
       
   165     void AddSpecialPacketL( const MRtpFileWriteObserver::TRtpType aType );
       
   166 
       
   167     /**
       
   168     * Saves readed seek array.
       
   169     * @since Series 60 3.0
       
   170     * @param aError a error code.
       
   171     * @return none.
       
   172     */
       
   173     void FinalizeSeekArrayL( const TInt aError );
       
   174 
       
   175 private: // Data
       
   176 
       
   177     /**
       
   178     * Repair observer.
       
   179     */
       
   180     MRtpClipRepairObserver* iObs;
       
   181 
       
   182     /**
       
   183     * File data buffer.
       
   184     */
       
   185     HBufC8* iFileData;
       
   186     
       
   187     /**
       
   188     * Meta header.
       
   189     */
       
   190     CRtpMetaHeader* iMetaHeader;
       
   191     
       
   192     /**
       
   193     * Last group time.
       
   194     */
       
   195     TUint iLastGroupTime;
       
   196     
       
   197     /**
       
   198     * Seek array point.
       
   199     */
       
   200     TInt iSeekArrayPoint;
       
   201         
       
   202   };
       
   203 
       
   204 #endif // CRTPCLIPREPAIRER_H
       
   205 
       
   206 // End of File