Skip to content
Commits on Source (3)
......@@ -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
}
......@@ -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);
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......