From 4a617aa9eb2def230534bdf01ec54a09372f950d Mon Sep 17 00:00:00 2001 From: Ylva Selling Date: Tue, 28 Feb 2023 10:05:52 -0500 Subject: [PATCH] Add set property function for doubles --- modules/video/include/videoplayer.h | 1 + modules/video/src/videoplayer.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/modules/video/include/videoplayer.h b/modules/video/include/videoplayer.h index bced277b51..2e4526c296 100644 --- a/modules/video/include/videoplayer.h +++ b/modules/video/include/videoplayer.h @@ -105,6 +105,7 @@ private: void setPropertyStringMpv(const char* name, const char* value); void setPropertyAsyncMpv(int value, MpvKey key); void setPropertyAsyncMpv(const char* value, MpvKey key); + void setPropertyAsyncMpv(double value, MpvKey key); void getPropertyAsyncMpv(MpvKey key); // Map to simulation time functions diff --git a/modules/video/src/videoplayer.cpp b/modules/video/src/videoplayer.cpp index a633b53bbf..ebf87772dc 100644 --- a/modules/video/src/videoplayer.cpp +++ b/modules/video/src/videoplayer.cpp @@ -192,6 +192,22 @@ void VideoPlayer::setPropertyAsyncMpv(const char* value, MpvKey key) { } } +void VideoPlayer::setPropertyAsyncMpv(double value, MpvKey key) { + if (!_isInitialized) { + return; + } + int result = mpv_set_property_async( + _mpvHandle, + static_cast(key), + keys[key], + formats[key], + &value + ); + if (!checkMpvError(result)) { + LWARNING("Error when playing video"); + } +} + void VideoPlayer::getPropertyAsyncMpv(MpvKey key) { int result = mpv_get_property_async( _mpvHandle,