1 /*****************************************************************************
2 * VLC backend for the Phonon library *
3 * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
4 * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
5 * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
7 * This program is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU Lesser General Public *
9 * License as published by the Free Software Foundation; either *
10 * version 3 of the License, or (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15 * Lesser General Public License for more details. *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with this package; if not, write to the Free Software *
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
20 *****************************************************************************/
22 #ifndef PHONON_VLC_VLCMEDIAOBJECT_H
23 #define PHONON_VLC_VLCMEDIAOBJECT_H
25 #include "vlcmediacontroller.h"
27 #include "mediaobject.h"
29 #include <phonon/mediaobjectinterface.h>
30 #include <phonon/addoninterface.h>
32 #include <QtCore/QObject>
33 #include <QtCore/QString>
34 #include <QtCore/QMultiMap>
43 * This is the "brain" of the VLC backend.
44 * VLCMediaObject uses libvlc in order to send commands and receive events from the VLC.
46 * Encapsulates VLC specific code.
47 * Take care of libvlc events via libvlc_callback()
51 class VLCMediaObject : public MediaObject, public VLCMediaController
54 Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface)
58 VLCMediaObject(QObject * parent);
64 bool hasVideo() const;
65 bool isSeekable() const;
67 qint64 totalTime() const;
69 QString errorString() const;
73 // MediaController signals
74 void availableSubtitlesChanged();
75 void availableAudioChannelsChanged();
77 // void availableChaptersChanged();
78 // void availableTitlesChanged();
79 void availableChaptersChanged(int);
80 void availableTitlesChanged(int);
82 void availableAnglesChanged(int availableAngles);
83 void angleChanged(int angleNumber);
84 void chapterChanged(int chapterNumber);
85 void titleChanged(int titleNumber);
88 * New widget size computed by VLC.
90 * It should be applied to the widget that contains the VLC video.
92 void videoWidgetSizeChanged(int i_width, int i_height);
96 void loadMediaInternal(const QString & filename);
98 void seekInternal(qint64 milliseconds);
100 qint64 currentTimeInternal() const;
105 * Connect libvlc_callback() to all vlc events.
107 * @see libvlc_callback()
109 void connectToAllVLCEvents();
112 * Retrieve meta data of a file (i.e ARTIST, TITLE, ALBUM, etc...).
114 void updateMetaData();
119 * Receive all vlc events.
121 * Warning: owned by libvlc thread.
123 * @see connectToAllVLCEvents()
124 * @see libvlc_event_attach()
126 static void libvlc_callback(const libvlc_event_t *p_event, void *p_user_data);
130 void setVLCWidgetId();
133 // libvlc_media_player_t * p_vlc_media_player;
134 libvlc_event_manager_t * p_vlc_media_player_event_manager;
137 libvlc_media_t * p_vlc_media;
138 libvlc_event_manager_t * p_vlc_media_event_manager;
141 libvlc_media_discoverer_t * p_vlc_media_discoverer;
142 libvlc_event_manager_t * p_vlc_media_discoverer_event_manager;
144 bool b_play_request_reached;
154 } // Namespace Phonon::VLC