/* * Copyright (C) 2013 Emeric Poupon * * This file is part of LMS. * * LMS 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 3 of the License, or * (at your option) any later version. * * LMS 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 LMS. If not, see . */ #ifndef __AUDIO_MEDIA_PLAYER_HPP #define __AUDIO_MEDIA_PLAYER_HPP #include #include #include #include #include #include #include #include "transcode/Parameters.hpp" #include "resource/AvConvTranscodeStreamResource.hpp" #include "resource/CoverResource.hpp" namespace UserInterface { namespace Desktop { class AudioMediaPlayer : public Wt::WContainerWidget { public: static Wt::WMediaPlayer::Encoding getBestEncoding(); AudioMediaPlayer( Wt::WMediaPlayer::Encoding encoding, Wt::WContainerWidget *parent = 0); void load(const Transcode::Parameters& parameters); // Accessors Wt::WMediaPlayer::Encoding getEncoding() const { return _encoding; } // Signal slots Wt::Signal& playbackEnded() {return _playbackEnded;} Wt::Signal& playNext() {return _playNext;} Wt::Signal& playPrevious() {return _playPrevious;} Wt::Signal& shuffle() {return _shuffle;} Wt::Signal& loop() {return _loop;} private: void handlePlayOffset(int offsetSecs); void handleTrackEnded(void); void handleValueChanged(double); void handleTimeUpdated(void); void handleSliderMoved(int value); void handleVolumeSliderMoved(int value); void loadPlayer(void); // Signals Wt::Signal _playbackEnded; Wt::Signal _playNext; Wt::Signal _playPrevious; Wt::Signal _shuffle; Wt::Signal _loop; // Core Wt::WMediaPlayer* _mediaPlayer; AvConvTranscodeStreamResource* _mediaResource; Wt::WMediaPlayer::Encoding _encoding; // Media info Wt::WImage* _mediaCover; Wt::WText* _mediaTitle; Wt::WText* _mediaArtistRelease; // Controls std::shared_ptr _currentParameters; Wt::WPushButton* _playBtn; Wt::WPushButton* _pauseBtn; Wt::WSlider* _timeSlider; Wt::WSlider* _volumeSlider; Wt::WText* _curTime; Wt::WText* _duration; }; } // namespace Desktop } // namespace UserInterface #endif