mpserviceplugins/m3uplaylistplugin/inc/mpxm3uplaylistimporter.h
changeset 25 3ec52facab4d
parent 19 4e84c994a771
equal deleted inserted replaced
22:ecf06a08d4d9 25:3ec52facab4d
    37 *  if the client wishes to import another m3u playlist file.
    37 *  if the client wishes to import another m3u playlist file.
    38 */
    38 */
    39 class CMPXM3uPlaylistImporter : public CActive
    39 class CMPXM3uPlaylistImporter : public CActive
    40     {
    40     {
    41 public: // Constructors and destructor
    41 public: // Constructors and destructor
    42 
    42     
    43     /**
    43     /**
    44     * Two-phased constructor
    44     * Two-phased constructor
    45     *
    45     *
    46     * @param aFs a file session handle
    46     * @param aFs a file session handle
    47     * @param aObserver reference to the playlist plugin observer
    47     * @param aObserver reference to the playlist plugin observer
    61 
    61 
    62     /**
    62     /**
    63     * Destructor
    63     * Destructor
    64     */
    64     */
    65     IMPORT_C virtual ~CMPXM3uPlaylistImporter();
    65     IMPORT_C virtual ~CMPXM3uPlaylistImporter();
    66 
    66     
    67 protected:
    67 protected:
    68 
    68 
    69     /**
    69     /**
    70     * Constructor
    70     * Constructor
    71     *
    71     *
    79                 RFs* aFs,
    79                 RFs* aFs,
    80                 MMPXPlaylistPluginObserver* aObserver,
    80                 MMPXPlaylistPluginObserver* aObserver,
    81                 const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
    81                 const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
    82                 const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
    82                 const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
    83                 TRequestStatus& aStatus );
    83                 TRequestStatus& aStatus );
    84 
    84     
    85     /**
    85     /**
    86     * 2nd phase constructor
    86     * 2nd phase constructor
    87     *
    87     *
    88     * @param aPlaylistUri URI of the playlist file to be internalized
    88     * @param aPlaylistUri URI of the playlist file to be internalized
    89     */
    89     */
    90     IMPORT_C virtual void ConstructL( const TDesC& aPlaylistUri );
    90     IMPORT_C virtual void ConstructL( const TDesC& aPlaylistUri );
    91 
    91    
    92     /**
    92     /**
    93     *  From CActive
    93     *  From CActive
    94     *  Handles an active object's request completion event
    94     *  Handles an active object's request completion event
    95     */
    95     */
    96     IMPORT_C virtual void RunL();
    96     IMPORT_C virtual void RunL();
   103 
   103 
   104     /**
   104     /**
   105     * Does a step of the task
   105     * Does a step of the task
   106     */
   106     */
   107     IMPORT_C virtual void DoTaskStep();
   107     IMPORT_C virtual void DoTaskStep();
   108 
   108     
   109     /**
   109     /**
   110     * Does a step of the task, leave if there is an error
   110     * Does a step of the task, leave if there is an error
   111     */
   111     */
   112     IMPORT_C virtual void DoTaskStepL();
   112     IMPORT_C virtual void DoTaskStepL();
   113 
   113 
   115 
   115 
   116     /**
   116     /**
   117     * Reads data from playlist file to the buffer
   117     * Reads data from playlist file to the buffer
   118     */
   118     */
   119     void ReadPlaylistFileToBufferL();
   119     void ReadPlaylistFileToBufferL();
   120 
   120     
   121     /**
   121     /**
   122     * Auto detects the character encoding from the supplied character
   122     * Auto detects the character encoding from the supplied character
   123     * set
   123     * set
   124     * @param aSample a sample of the file
   124     * @param aSample a sample of the file
   125     * @param aCharSetId auto-detected character set for the supplied
   125     * @param aCharSetId auto-detected character set for the supplied
   130     */
   130     */
   131     TInt DetectCharacterSetL(
   131     TInt DetectCharacterSetL(
   132         const TDesC8& aSample,
   132         const TDesC8& aSample,
   133         const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
   133         const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
   134         TUint& aCharSetId);
   134         TUint& aCharSetId);
   135 
   135     
   136     /**
   136     /**
   137     * Parses the buffer where playlist file was read to.
   137     * Parses the buffer where playlist file was read to.
   138     */
   138     */
   139     void ParsePlaylistBufferL(
   139     void ParsePlaylistBufferL(
   140             CMPXMediaArray& aPlaylist,
   140             CMPXMediaArray& aPlaylist,
   173 
   173 
   174     /**
   174     /**
   175     * compose CMPXMedia to be sent back to the client
   175     * compose CMPXMedia to be sent back to the client
   176     */
   176     */
   177     void ComposePlaylistL();
   177     void ComposePlaylistL();
   178 
   178     
   179     /**
   179     /**
   180     * Reset data members for after completing the current request
   180     * Reset data members for after completing the current request
   181     */
   181     */
   182     void Cleanup();
   182     void Cleanup();
   183 
   183     
   184     /**
   184     /**
   185     * Notify client of the specified error through MMPXPlaylistPluginObserver
   185     * Notify client of the specified error through MMPXPlaylistPluginObserver
   186     * interface
   186     * interface
   187     */
   187     */
   188     void NotifyClient(TInt aError);
   188     void NotifyClient(TInt aError);
   193         {
   193         {
   194         EMPXM3UReadBufferWithAutoDetectEncoding,
   194         EMPXM3UReadBufferWithAutoDetectEncoding,
   195         EMPXM3UParseWithAutoDetectEncoding,
   195         EMPXM3UParseWithAutoDetectEncoding,
   196         EMPXM3UComposePlaylistMedia
   196         EMPXM3UComposePlaylistMedia
   197         };
   197         };
   198 
   198                          
   199 protected:    // Data
   199 protected:    // Data
   200 
   200 
   201     HBufC*                              iBuffer;
   201     HBufC*                              iBuffer;
   202     TPtrC                               iBufferPtr;
   202     TPtrC                               iBufferPtr;
   203 
   203 
   205 
   205 
   206     HBufC*                              iLine;
   206     HBufC*                              iLine;
   207 
   207 
   208     RFs*                                iFs;      // not owned
   208     RFs*                                iFs;      // not owned
   209     MMPXPlaylistPluginObserver*         iObserver;// not owned
   209     MMPXPlaylistPluginObserver*         iObserver;// not owned
   210 
   210     
   211     TBool                               iExtendedFormat;
   211     TBool                               iExtendedFormat;
   212 
   212     
   213     TRequestStatus*                     iCallerStatus;
   213     TRequestStatus*                     iCallerStatus;
   214 
   214 
   215     TInt                                iEndLineNumber;
   215     TInt                                iEndLineNumber;  
   216     TInt                                iCurrentLineNumber;
   216     TInt                                iCurrentLineNumber;
   217     TBool                               iMoreToDo;
   217     TBool                               iMoreToDo;
   218     TBool                               iEndOfFile;
   218     TBool                               iEndOfFile;
   219     CMPXMedia*                          iItem;
   219     CMPXMedia*                          iItem;
   220 
   220 
   221     CMPXMediaArray*                     iAutoEncodingPlaylistArray;
   221     CMPXMediaArray*                     iAutoEncodingPlaylistArray;
   222     TInt                                iAutoEncodingInvalidItems;
   222     TInt                                iAutoEncodingInvalidItems;
   223 
   223     
   224     CMPXMedia*                          iPlaylist;
   224     CMPXMedia*                          iPlaylist;
   225 
   225     
   226     TMPXM3UImporterState                iState;
   226     TMPXM3UImporterState                iState;
   227 
   227     
   228     const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iTopCharacterSet;
   228     const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iTopCharacterSet;
   229     const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iAvailableCharacterSet;
   229     const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iAvailableCharacterSet;
   230     };
   230     };
   231 
   231 
   232 #endif   // MPXM3UPLAYLISTIMPORTER_H
   232 #endif   // MPXM3UPLAYLISTIMPORTER_H
   233 
   233             
   234 
   234