From c21f2c32a4f525164414e9299dae67ec10390fae Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 6 Jul 2020 00:08:34 +0200 Subject: [PATCH] encoders/ffmpeg: Add support for settings migration --- source/encoders/encoder-ffmpeg.cpp | 6 +++++- source/encoders/handlers/handler.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/encoders/encoder-ffmpeg.cpp b/source/encoders/encoder-ffmpeg.cpp index dff3807b..09ed124b 100644 --- a/source/encoders/encoder-ffmpeg.cpp +++ b/source/encoders/encoder-ffmpeg.cpp @@ -180,7 +180,11 @@ void ffmpeg_instance::get_properties(obs_properties_t* props) obs_property_set_enabled(obs_properties_get(props, KEY_FFMPEG_GPU), false); } -void ffmpeg_instance::migrate(obs_data_t* settings, std::uint64_t version) {} +void ffmpeg_instance::migrate(obs_data_t* settings, std::uint64_t version) +{ + if (_handler) + _handler->migrate(settings, version, _codec, _context); +} bool ffmpeg_instance::update(obs_data_t* settings) { diff --git a/source/encoders/handlers/handler.hpp b/source/encoders/handlers/handler.hpp index 14c56301..3401d498 100644 --- a/source/encoders/handlers/handler.hpp +++ b/source/encoders/handlers/handler.hpp @@ -60,6 +60,8 @@ namespace streamfx::encoder::ffmpeg { virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context, bool hw_encode){}; + virtual void migrate(obs_data_t* settings, std::uint64_t version, const AVCodec* codec, AVCodecContext* context){}; + virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context){}; virtual void override_update(ffmpeg_instance* instance, obs_data_t* settings){};