summaryrefslogtreecommitdiffstats
path: root/vlcwrapper/VLCVideoWidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vlcwrapper/VLCVideoWidget.cpp')
-rw-r--r--vlcwrapper/VLCVideoWidget.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/vlcwrapper/VLCVideoWidget.cpp b/vlcwrapper/VLCVideoWidget.cpp
index 69d111c..04f1a3c 100644
--- a/vlcwrapper/VLCVideoWidget.cpp
+++ b/vlcwrapper/VLCVideoWidget.cpp
@@ -41,7 +41,7 @@ VLCVideoWidget::~VLCVideoWidget()
libvlc_event_detach(m_eventManager, libvlc_MediaPlayerTimeChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
libvlc_event_detach(m_eventManager, libvlc_MediaPlayerPositionChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
libvlc_event_detach(m_eventManager, libvlc_MediaPlayerSeekableChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
- libvlc_event_detach(m_eventManager, libvlc_MediaPlayerPausableChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
+ libvlc_event_detach(m_eventManager, libvlc_MediaPlayerPausableChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
libvlc_event_detach(m_eventManager, libvlc_MediaPlayerTitleChanged, vlcCallbacks, this, VLCLoader::instance()->exception());
libvlc_event_detach(m_eventManager, libvlc_MediaPlayerSnapshotTaken, vlcCallbacks, this, VLCLoader::instance()->exception());
libvlc_media_player_stop(m_mediaPlayer, VLCLoader::instance()->exception());
@@ -105,15 +105,15 @@ void VLCVideoWidget::vlcCallbacks(const libvlc_event_t* event, void* ptr)
/*
the file has to be in one of the following formats:
- [file://]filename Plain media file
- http://ip:port/file HTTP URL
- ftp://ip:port/file FTP URL
- mms://ip:port/file MMS URL
- screen:// Screen capture
- [dvd://][device][@raw_device] DVD device
- [vcd://][device] VCD device
- [cdda://][device] Audio CD device
- udp:[[<source address>]@[<bind address>][:<bind port>]]
+ [file://]filename Plain media file
+ http://ip:port/file HTTP URL
+ ftp://ip:port/file FTP URL
+ mms://ip:port/file MMS URL
+ screen:// Screen capture
+ [dvd://][device][@raw_device] DVD device
+ [vcd://][device] VCD device
+ [cdda://][device] Audio CD device
+ udp:[[<source address>]@[<bind address>][:<bind port>]]
*/
bool VLCVideoWidget::setSource(const QString &source)
{
@@ -134,16 +134,21 @@ QString VLCVideoWidget::source() const
}
bool VLCVideoWidget::play()
{
+ attachVideoDisplay();
+ libvlc_media_player_play(m_mediaPlayer, VLCLoader::instance()->exception());
+ return VLCLoader::instance()->checkError();
+}
+bool VLCVideoWidget::attachVideoDisplay()
+{
+ if (!effectiveWinId())
+ return false;
#if defined(Q_WS_WIN)
- libvlc_media_player_set_hwnd(m_mediaPlayer, winId(), VLCLoader::instance()->exception());
+ libvlc_media_player_set_hwnd(m_mediaPlayer, effectiveWinId(), VLCLoader::instance()->exception());
#elif defined(Q_WS_MAC)
- libvlc_media_player_set_agl(m_mediaPlayer, winId(), VLCLoader::instance()->exception());
+ libvlc_media_player_set_agl(m_mediaPlayer, effectiveWinId(), VLCLoader::instance()->exception());
#elif defined(Q_WS_X11)
- libvlc_media_player_set_xwindow(m_mediaPlayer, winId(), VLCLoader::instance()->exception());
+ libvlc_media_player_set_xwindow(m_mediaPlayer, effectiveWinId(), VLCLoader::instance()->exception());
#endif
- if(!VLCLoader::instance()->checkError())
- return false;
- libvlc_media_player_play(m_mediaPlayer, VLCLoader::instance()->exception());
return VLCLoader::instance()->checkError();
}
bool VLCVideoWidget::pause()