[vlc-commits] [Git][videolan/libvlcpp][master] 3 commits: MediaPlayer: Bind stopAsync for 4.0
Hugo Beauzée-Luyssen
gitlab at videolan.org
Tue May 28 18:17:42 CEST 2019
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / libvlcpp
Commits:
64e0df49 by Hugo Beauzée-Luyssen at 2019-05-28T16:13:53Z
MediaPlayer: Bind stopAsync for 4.0
- - - - -
a3763c0f by Hugo Beauzée-Luyssen at 2019-05-28T16:13:53Z
MediaPlayer: willPlay was removed in 4.0
- - - - -
5147d358 by Hugo Beauzée-Luyssen at 2019-05-28T16:17:44Z
common: Simplify wrapCStr
- - - - -
6 changed files:
- examples/helloworld/main.cpp
- examples/imem/imem.cpp
- test/main.cpp
- vlcpp/MediaListPlayer.hpp
- vlcpp/MediaPlayer.hpp
- vlcpp/common.hpp
Changes:
=====================================
examples/helloworld/main.cpp
=====================================
@@ -14,5 +14,9 @@ int main(int ac, char** av)
auto mp = VLC::MediaPlayer(media);
mp.play();
std::this_thread::sleep_for( std::chrono::seconds( 10 ) );
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+ mp.stopAsync();
+#else
mp.stop();
+#endif
}
=====================================
examples/imem/imem.cpp
=====================================
@@ -78,8 +78,13 @@ int main(int ac, char**av)
std::this_thread::sleep_for( std::chrono::seconds( 10 ) );
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+ mp.stopAsync();
+ mp2.stopAsync();
+#else
mp.stop();
mp2.stop();
+#endif
delete dummyOpaque;
fclose(opaque2->file);
=====================================
test/main.cpp
=====================================
@@ -139,7 +139,11 @@ int main(int ac, char** av)
// expect a single call since both media player share the same event manager
expected = false;
});
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+ mp.stopAsync();
+#else
mp.stop();
+#endif
// Unregister the RegisteredEvent from the other MP's event manager.
// It will be unregistered from both, and when the object gets destroyed
// by leaving the scope, it won't be unregistered from mp2's eventManager.
=====================================
vlcpp/MediaListPlayer.hpp
=====================================
@@ -161,6 +161,15 @@ public:
getInternalPtr<libvlc_media_t>( md ) ) == 0;
}
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+ /**
+ * Stop playing media list
+ */
+ void stopAsync()
+ {
+ libvlc_media_list_player_stop_async(*this);
+ }
+#else
/**
* Stop playing media list
*/
@@ -168,6 +177,7 @@ public:
{
libvlc_media_list_player_stop(*this);
}
+#endif
/**
* Play next item from media list
=====================================
vlcpp/MediaPlayer.hpp
=====================================
@@ -192,6 +192,15 @@ public:
libvlc_media_player_pause(*this);
}
+#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0)
+ /**
+ * @brief stop Stop the playback (no effect if there is no media)
+ */
+ void stopAsync()
+ {
+ libvlc_media_player_stop_async(*this);
+ }
+#else
/**
* @brief stop Stop the playback (no effect if there is no media)
*
@@ -203,6 +212,7 @@ public:
{
libvlc_media_player_stop(*this);
}
+#endif
/**
* Set the NSView handler where the media player should render its video
@@ -403,6 +413,7 @@ public:
return libvlc_media_player_get_chapter_count(*this);
}
+#if LIBVLC_VERSION_INT < LIBVLC_VERSION(4, 0, 0, 0)
/**
* Is the player able to play
*
@@ -412,6 +423,7 @@ public:
{
return libvlc_media_player_will_play(*this) != 0;
}
+#endif
/**
* Get title chapter count
=====================================
vlcpp/common.hpp
=====================================
@@ -55,7 +55,7 @@ namespace VLC
inline std::unique_ptr<char, void (*)(void*)> wrapCStr(char* str)
{
- return std::unique_ptr<char, void(*)(void*)>( str, [](void* ptr) { libvlc_free(ptr); } );
+ return std::unique_ptr<char, decltype(&libvlc_free)>( str, &libvlc_free );
}
#if !defined(_MSC_VER)
View it on GitLab: https://code.videolan.org/videolan/libvlcpp/compare/59676a24aa99a606330232d21ba9df39f13119df...5147d358c5918bdf1ebb96d1292b3b7ac2c800f9
--
View it on GitLab: https://code.videolan.org/videolan/libvlcpp/compare/59676a24aa99a606330232d21ba9df39f13119df...5147d358c5918bdf1ebb96d1292b3b7ac2c800f9
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list