📄 shoutcastadapter.h
字号:
/*
* ==============================================================================
* Name : ShoutCastAdapter.h
* Part of : Shoutcast Engine
* Interface :
* Description : Defines the shoutcast adapter interface.
* Version : 1
*
* Copyright (c) 2006, Nokia Corporation All rights reserved. Redistribution
* and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: Redistributions
* of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. Redistributions in binary form
* must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided
* with the distribution. Neither the name of the Nokia Corporation nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. THIS
* SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ==============================================================================
*/
#ifndef __CSHOUTCASTADAPTER__
#define __CSHOUTCASTADAPTER__
// INCLUDE FILES
#if RELEASE_LOG
#include <flogger.h>
#endif
#include <AknWaitDialog.h>
#include <AknProgressDialog.h>
#include "PluginAdapter.h"
#include "MShoutcastStreamObserver.h"
// FORWARD DECLARATIONS
class CAknGlobalNote;
class CShoutcastStream;
class MInternetRadioAdapterObserver;
// CLASS DECLARATION
/**
* This class implements the Shoutcast plugin adapter interface to
* the shoutcast stream object.
*/
class CShoutcastAdapter : public CPluginAdapter,
public MShoutcastStreamObserver,
public MProgressDialogCallback
{
public: // Contructors
/**
* Factory function for a shoutcast adapter
* @param aObserver the observer of this adapter
* @return pointer to new object
*/
static CShoutcastAdapter* NewL(MInternetRadioAdapterObserver *aObserver);
/**
* Destructor
*/
~CShoutcastAdapter();
public: // from CPluginAdapter
virtual void GetMenuText(TDes &aName);
/**
* Get the menu command code
* @return The menu command.
*/
virtual TInt GetMenuCommand();
/**
* Add additional items to the specified menu
* @param aMenuPane The menu pane to which items are added
*/
virtual void AddExtraMenu(CEikMenuPane* aMenuPane);
/**
* Handles the commands from the UI
* @param aCommand The command to be handled
* @return ETrue if the command was handled, EFalse otherwise.
*/
virtual TBool HandleCommandL(TInt aCommand);
public: // from MAudioAdapter
/**
* Start playback of the shoutcast stream
*/
void PlayL();
/**
* Pauses the playback of the shoutcast stream
*/
void PauseL();
/**
* This method will Leave. Recording is not supported.
*/
void RecordL();
/**
* Stop playback of the shoutcast stream. Note that this implementation of the virtual function does not leave.
*/
void StopL();
/**
* Update the menu aMenuPane to reflect the current state of the audio player utility.
* @param aMenuPane the menu pane to update
*/
void UpdateMenuL(CEikMenuPane* aMenuPane);
/**
* Return an identifying string
* @return An identification string
*/
const TDesC& Identify() const;
/**
* Get number of supported metadata
* @return Number of supported metada
*/
virtual TInt SupportMetadata() const;
/**
* Toggles play and pause
*/
void TogglePlayPause();
/**
* Set the volume
* @param aVolume The desired volume level
*/
virtual void SetVolume(TInt aVolume);
/**
* Get the current volume level
* @return Volume Level
*/
virtual TInt Volume();
public: // From MShoutcastStreamObserver
virtual void HandleEvent(TUid aEvent, TInt aError);
virtual void DialogDismissedL ( TInt aButtonId );
public:
enum TOp
{
EOpOpen,
EOpAddDataSink,
EOpAddDataSource,
EOpPrime,
EOpPlay
};
private:
/**
* C++ default constructor.
* @param aObserver the observer of this adapter
*/
CShoutcastAdapter(MInternetRadioAdapterObserver *aObserver);
/**
* Perform the second phase construction of a CPlayerAdapter object
* @param aFileName the audio file
*/
void ConstructL(void);
/**
* Deletes metada labels from the view
* @param aAll Indicates all labels are to be removed
* @param aBuf Buffer containing message to be displayed after the label is deleted
*/
void DeleteLabels(TBool aAll, TDesC *buf=NULL);
/**
* Parses the play list.
* @param aFilename Filename of the playlist to parse
*/
void ParsePlaylistFileL(RFs aFs, const TFileName &aFilename);
void FindPlayListsL(const TDesC& aDir, const TDesC& aWildName);
/**
* Closes the currently opened Url
*/
void CloseUrl();
/**
* Open the specified Url. May leave with one of the system error codes.
* @param aUrl The url index into the url list to open
*/
void OpenUrlL(TInt aUrl);
/**
* Handles the error
* @param aError The error code
* @param aOperation The operation that generated the error.
*/
void HandleError(TInt aError,TOp aOperation);
private:
// The shoutcast stream object
CShoutcastStream* iStreamSource;
// Number of metadata fields
TInt iNrMetadata;
// Indicates whether the stream has been primed for playback
TBool iPrimed;
//this is the playlist. Even entries (0, 2, 4 ...)are the URLs, odd entries are the Titles of the URLs
RPointerArray<HBufC8> iURLs;
// Volume factor used in scaling the volume
TReal iVolFactor;
//note
CAknGlobalNote *iWaitingNote;
TInt iWaitingNoteId;
CAknGlobalNote *iErrorNote;
CAknWaitDialog* iWaitDialog;
#if RELEASE_LOG
RFileLogger iLog;
#endif
friend class CWaitNoteObserver;
};
#endif // __CSHOUTCASTADAPTER__
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -