Clementine-audio-player-Mac.../src/engines/vlcengine.h

81 lines
2.0 KiB
C
Raw Normal View History

2010-04-04 22:45:03 +02:00
/* This file is part of Clementine.
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VLCENGINE_H
#define VLCENGINE_H
#include "enginebase.h"
#include <vlc/vlc.h>
2010-04-05 04:21:53 +02:00
#include <boost/circular_buffer.hpp>
#include <QMutex>
2010-04-04 22:45:03 +02:00
class QTimer;
class VlcEngine : public Engine::Base {
Q_OBJECT
public:
VlcEngine();
~VlcEngine();
bool Init();
2010-04-04 22:45:03 +02:00
bool CanDecode( const QUrl &url );
2010-04-04 22:45:03 +02:00
bool Load( const QUrl &url, Engine::TrackChangeType change );
bool Play( uint offset = 0 );
void Stop();
void Pause();
void Unpause();
2010-04-04 22:45:03 +02:00
Engine::State state() const { return state_; }
uint position() const;
uint length() const;
void Seek( uint ms );
2010-04-04 22:45:03 +02:00
2010-04-05 04:21:53 +02:00
static void SetScopeData(float* data, int size);
const Engine::Scope& Scope();
2010-04-05 04:21:53 +02:00
2010-04-04 22:45:03 +02:00
protected:
void SetVolumeSW( uint percent );
2010-04-04 22:45:03 +02:00
private:
void HandleErrors() const;
void AttachCallback(libvlc_event_manager_t* em, libvlc_event_type_t type,
libvlc_callback_t callback);
static void StateChangedCallback(const libvlc_event_t* e, void* data);
private:
2010-04-05 21:16:48 +02:00
// The callbacks need access to this
2010-04-05 04:21:53 +02:00
static VlcEngine* sInstance;
2010-04-05 21:16:48 +02:00
// VLC bits and pieces
2010-04-04 22:45:03 +02:00
libvlc_exception_t exception_;
libvlc_instance_t* instance_;
libvlc_media_player_t* player_;
2010-04-05 21:16:48 +02:00
// Our clementine_scope VLC plugin puts data in here
2010-04-05 04:21:53 +02:00
QMutex scope_mutex_;
boost::circular_buffer<float> scope_data_;
2010-04-04 22:45:03 +02:00
Engine::State state_;
};
#endif // VLCENGINE_H