/* ColdFish Music Player
* Copyright (C) 2003 Kristian Van Der Vliet
* Copyright (C) 2003 Arno Klenke
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Library
* General Public License as published by the Free Software
* Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA
*/
#ifndef __CFAPP_H_
#define __CFAPP_H_
#include <util/application.h>
#include <util/looper.h>
#include <util/message.h>
#include <util/string.h>
#include <media/manager.h>
#include <media/input.h>
#include <media/output.h>
#include <media/codec.h>
#include <media/format.h>
#include <media/inputselector.h>
#include <storage/registrar.h>
#include <storage/fsnode.h>
#include <storage/directory.h>
class CFWindow;
class CFApp : public os::Looper
{
public:
CFApp();
virtual ~CFApp();
virtual void HandleMessage( os::Message * pcMessage );
virtual bool OkToQuit();
void Start( os::String zFileName, bool bLoad );
void SetState( uint8 nState );
void OpenInput( os::String zFileName, os::String zInput );
bool OpenList( os::String zFileName );
void SaveList();
void AddFile( os::String zFile );
void AddFileToPlaylist( os::String zFileName );
int OpenFile( os::String zFileName, uint32 nTrack, uint32 nStream );
void CloseCurrentFile();
void PlayThread();
void PlayNext();
void PlayPrevious();
CFWindow* GetWindow();
private:
os::RegistrarManager* m_pcRegManager;
CFWindow* m_pcWin;
uint8 m_nState;
bool m_bListShown;
os::Rect m_cSavedFrame;
os::String m_zListName;
os::String m_zTrackName;
os::String m_zAudioName;
os::String m_zAudioFile;
uint32 m_nAudioTrack;
uint32 m_nAudioStream;
os::MediaManager* m_pcManager;
os::MediaInputSelector* m_pcInputSelector;
os::MediaInput* m_pcInput;
bool m_bLockedInput;
bool m_bPacket;
bool m_bStream;
os::MediaFormat_s m_sAudioFormat;
os::MediaCodec* m_pcAudioCodec;
os::MediaOutput* m_pcAudioOutput;
bool m_bPlayThread;
thread_id m_hPlayThread;
uint64 m_nLastPosition;
};
class CFApplication : public os::Application
{
public:
CFApplication( const char *pzMimeType, os::String zFileName, bool bLoad );
virtual ~CFApplication();
virtual void HandleMessage( os::Message * pcMessage );
virtual bool OkToQuit();
private:
CFApp* m_pcApp;
};
#endif