"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/backend-vlc/vlcmediawidget.cpp" between
kaffeine-2.0.17.tar.gz and kaffeine-2.0.18.tar.gz

About: Kaffeine is a full featured Multimedia-Player for KDE (default backend is xine).

vlcmediawidget.cpp  (kaffeine-2.0.17):vlcmediawidget.cpp  (kaffeine-2.0.18)
skipping to change at line 116 skipping to change at line 116
case libvlc_MediaListViewItemDeleted: case libvlc_MediaListViewItemDeleted:
return "MediaListViewItemDeleted"; return "MediaListViewItemDeleted";
case libvlc_MediaListViewWillDeleteItem: case libvlc_MediaListViewWillDeleteItem:
return "MediaListViewWillDeleteItem"; return "MediaListViewWillDeleteItem";
case libvlc_MediaListPlayerPlayed: case libvlc_MediaListPlayerPlayed:
return "MediaListPlayerPlayed"; return "MediaListPlayerPlayed";
case libvlc_MediaListPlayerNextItemSet: case libvlc_MediaListPlayerNextItemSet:
return "MediaListPlayerNextItemSet"; return "MediaListPlayerNextItemSet";
case libvlc_MediaListPlayerStopped: case libvlc_MediaListPlayerStopped:
return "MediaListPlayerStopped"; return "MediaListPlayerStopped";
case libvlc_RendererDiscovererItemAdded:
return "RendererDiscovererItemAdded";
case libvlc_RendererDiscovererItemDeleted:
return "RendererDiscovererItemDeleted";
case libvlc_VlmMediaAdded: case libvlc_VlmMediaAdded:
return "VlmMediaAdded"; return "VlmMediaAdded";
case libvlc_VlmMediaRemoved: case libvlc_VlmMediaRemoved:
return "VlmMediaRemoved"; return "VlmMediaRemoved";
case libvlc_VlmMediaChanged: case libvlc_VlmMediaChanged:
return "VlmMediaChanged"; return "VlmMediaChanged";
case libvlc_VlmMediaInstanceStarted: case libvlc_VlmMediaInstanceStarted:
return "VlmMediaInstanceStarted"; return "VlmMediaInstanceStarted";
case libvlc_VlmMediaInstanceStopped: case libvlc_VlmMediaInstanceStopped:
return "VlmMediaInstanceStopped"; return "VlmMediaInstanceStopped";
skipping to change at line 143 skipping to change at line 139
return "VlmMediaInstanceStatusOpening"; return "VlmMediaInstanceStatusOpening";
case libvlc_VlmMediaInstanceStatusPlaying: case libvlc_VlmMediaInstanceStatusPlaying:
return "VlmMediaInstanceStatusPlaying"; return "VlmMediaInstanceStatusPlaying";
case libvlc_VlmMediaInstanceStatusPause: case libvlc_VlmMediaInstanceStatusPause:
return "VlmMediaInstanceStatusPause"; return "VlmMediaInstanceStatusPause";
case libvlc_VlmMediaInstanceStatusEnd: case libvlc_VlmMediaInstanceStatusEnd:
return "VlmMediaInstanceStatusEnd"; return "VlmMediaInstanceStatusEnd";
case libvlc_VlmMediaInstanceStatusError: case libvlc_VlmMediaInstanceStatusError:
return "VlmMediaInstanceStatusError"; return "VlmMediaInstanceStatusError";
#if LIBVLC_VERSION_MAJOR > 2 #if LIBVLC_VERSION_MAJOR > 2
case libvlc_RendererDiscovererItemAdded:
return "RendererDiscovererItemAdded";
case libvlc_RendererDiscovererItemDeleted:
return "RendererDiscovererItemDeleted";
case libvlc_MediaPlayerAudioVolume: case libvlc_MediaPlayerAudioVolume:
return "MediaPlayerAudioVolume"; return "MediaPlayerAudioVolume";
case libvlc_MediaPlayerAudioDevice: case libvlc_MediaPlayerAudioDevice:
return "MediaPlayerAudioDevice"; return "MediaPlayerAudioDevice";
case libvlc_MediaListEndReached: case libvlc_MediaListEndReached:
return "MediaListEndReached"; return "MediaListEndReached";
case libvlc_MediaPlayerChapterChanged: case libvlc_MediaPlayerChapterChanged:
return "MediaPlayerChapterChanged"; return "MediaPlayerChapterChanged";
case libvlc_MediaPlayerESAdded: case libvlc_MediaPlayerESAdded:
return "MediaPlayerESAdded"; return "MediaPlayerESAdded";
skipping to change at line 174 skipping to change at line 174
return "Unknown"; return "Unknown";
} }
} }
VlcMediaWidget::VlcMediaWidget(QWidget *parent) : AbstractMediaWidget(parent), VlcMediaWidget::VlcMediaWidget(QWidget *parent) : AbstractMediaWidget(parent),
timer(NULL), vlcInstance(NULL), vlcMedia(NULL), vlcMediaPlayer(NULL), timer(NULL), vlcInstance(NULL), vlcMedia(NULL), vlcMediaPlayer(NULL),
isPaused(false), playingDvd(false), urlIsAudioCd(false), isPaused(false), playingDvd(false), urlIsAudioCd(false),
typeOfDevice(""), trackNumber(1), numTracks(1) typeOfDevice(""), trackNumber(1), numTracks(1)
{ {
libvlc_event_e events[] = { libvlc_event_e events[] = {
libvlc_MediaMetaChanged,
libvlc_MediaPlayerEncounteredError, libvlc_MediaPlayerEncounteredError,
libvlc_MediaPlayerEndReached, libvlc_MediaPlayerEndReached,
libvlc_MediaPlayerLengthChanged, libvlc_MediaPlayerLengthChanged,
libvlc_MediaPlayerSeekableChanged, libvlc_MediaPlayerSeekableChanged,
libvlc_MediaPlayerStopped, libvlc_MediaPlayerStopped,
libvlc_MediaPlayerTimeChanged,
#if LIBVLC_VERSION_MAJOR > 2 #if LIBVLC_VERSION_MAJOR > 2
libvlc_MediaMetaChanged,
libvlc_MediaPlayerESAdded, libvlc_MediaPlayerESAdded,
libvlc_MediaPlayerESDeleted, libvlc_MediaPlayerESDeleted,
#endif #endif
libvlc_MediaPlayerTimeChanged,
#if 0 // all other possible events #if 0 // all other possible events
libvlc_MediaSubItemAdded, libvlc_MediaSubItemAdded,
libvlc_MediaDurationChanged, libvlc_MediaDurationChanged,
libvlc_MediaParsedChanged, libvlc_MediaParsedChanged,
libvlc_MediaFreed, libvlc_MediaFreed,
libvlc_MediaStateChanged, libvlc_MediaStateChanged,
libvlc_MediaSubItemTreeAdded, libvlc_MediaSubItemTreeAdded,
libvlc_MediaPlayerMediaChanged, libvlc_MediaPlayerMediaChanged,
libvlc_MediaPlayerNothingSpecial, libvlc_MediaPlayerNothingSpecial,
libvlc_MediaPlayerOpening, libvlc_MediaPlayerOpening,
skipping to change at line 560 skipping to change at line 560
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
timer->start(1000); timer->start(1000);
setMouseTracking(true); setMouseTracking(true);
} }
void VlcMediaWidget::unregisterEvents() void VlcMediaWidget::unregisterEvents()
{ {
for (int i = 0; i < eventType.size(); ++i) for (int i = 0; i < eventType.size(); ++i)
libvlc_event_detach(eventManager, eventType.at(i), libvlc_event_detach(eventManager, eventType.at(i),
vlcEventHandler, this); vlcEventHandler, this);
#if LIBVLC_VERSION_MAJOR <= 2
if (!vlcMedia)
return;
libvlc_event_manager_t *mediaEvent = libvlc_media_event_manager(vlcMedia)
;
libvlc_event_detach(mediaEvent, libvlc_MediaMetaChanged,
vlcEventHandler, this);
#endif
} }
bool VlcMediaWidget::registerEvents() bool VlcMediaWidget::registerEvents()
{ {
for (int i = 0; i < eventType.size(); ++i) { for (int i = 0; i < eventType.size(); ++i) {
if (libvlc_event_attach(eventManager, eventType.at(i), vlcEventHa ndler, this) != 0) { if (libvlc_event_attach(eventManager, eventType.at(i), vlcEventHa ndler, this) != 0) {
qCCritical(logMediaWidget, "Cannot attach event handler % d", eventType.at(i)); qCCritical(logMediaWidget, "Cannot attach event handler % d", eventType.at(i));
return false; return false;
} }
} }
return true; return true;
} }
int VlcMediaWidget::makePlay() int VlcMediaWidget::makePlay()
{ {
if (vlcMedia == NULL) { if (vlcMedia == NULL) {
libvlc_media_player_stop(vlcMediaPlayer); libvlc_media_player_stop(vlcMediaPlayer);
return -1; return -1;
} }
#if LIBVLC_VERSION_MAJOR <= 2
/*
* There is a difference between libVlc 2.x and 3.x:
* With version 2.x, the event needs to be registered at the
* vlcMedia object, just before calling libvlc_media_player_set_media()
*
* On version 3.x, while this still works, you can simply register the
* event directly at vlcMediaPlayer, together with all other events,
* with simplifies the code.
*/
libvlc_event_manager_t *mediaEvent = libvlc_media_event_manager(vlcMedia)
;
if (libvlc_event_attach(mediaEvent, libvlc_MediaMetaChanged,
vlcEventHandler, this) != 0) {
qCWarning(logMediaWidget, "Cannot attach event handler %d",
libvlc_MediaMetaChanged);
}
#endif
libvlc_media_player_set_media(vlcMediaPlayer, vlcMedia); libvlc_media_player_set_media(vlcMediaPlayer, vlcMedia);
/* /*
* FIXME: This is mostly a boilerplate as, at least with vlc 3, * FIXME: This is mostly a boilerplate as, at least with vlc 3,
* this function always return -1 * this function always return -1
*/ */
if (urlIsAudioCd) if (urlIsAudioCd)
numTracks = libvlc_audio_get_track_count(vlcMediaPlayer); numTracks = libvlc_audio_get_track_count(vlcMediaPlayer);
return libvlc_media_player_play(vlcMediaPlayer); return libvlc_media_player_play(vlcMediaPlayer);
 End of changes. 8 change blocks. 
6 lines changed or deleted 34 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)