/***************************************************************************
 *   Copyright (C) 2006 by Jens Koehler                                    *
 *   irimi_at_gmx_de                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef AMAROKPLAYER_H
#define AMAROKPLAYER_H

#include <vdr/thread.h>
#include <vdr/player.h>
#include "amarokData.h"
#include "amarokCommander.h"


class cMenuAmBase;
class AmarokQueryResult;

/////////////////////////////////////////////////////////////////////////
////////// cStillDvbPlayer
/////////////////////////////////////////////////////////////////////////


class cStillPlayer  : public cPlayer
{
public:
    cStillPlayer();

    ~cStillPlayer();

    void showImage (const char *file);

private:

};

/////////////////////////////////////////////////////////////////////////
////////// cAmarokPlayer
/////////////////////////////////////////////////////////////////////////

class cAmarokPlayer : public cThread
{
public:
    cAmarokPlayer(cMenuAmBase* p_OsdMenu);

    ~cAmarokPlayer();

    const char* initialize();


    void buildTrackview();
    void removeTrack(unsigned int index);
    void play(unsigned int index=0);
    void playPause();
    void stop();
    void next();
    void prev();
    void seekRelative(int seconds);

    void pause();
    void mute();
    void volumeUp();
    void volumeDown();
    void showOsd();

    void setSleep(bool bSleep=true);
    void attachTrackMenu(cMenuAmBase*);
    void detachTrackMenu();
    void rebuildPlaylist();
    void shufflePlaylist();
    void clearPlaylist();
    void loadPlaylist(const char* plist);

    void queryLists(AmarokQueryResult &result);
    void addArtist(const char* name);
    void addAlbum(const char* name);
    void addGenre(const char* name);
    void addTitle(const char* name);
private:

    void Activate(bool On);
    const char* connectHost();
    void createPlaylist();
    void startStillPlayer();


    bool getSleep();

    bool checkRemoteIsPlaying();
    void updatePlaylist();
    void checkSyncPlaylist();
    virtual void Action();

    void updateTrackview();
    void updateTracktime();
    void deleteCurrentTrack();

    AmarokPlaylist m_Playlist;
    AmarokCommander m_commander;

    cStillPlayer *p_StillPlayer;

    cMenuAmBase* p_ListMenu;
    cMenuAmBase* p_TrackMenu;

    TrackItem *p_Track;

    bool b_Sleep;


};


#endif
