Set libswscale option which doesn't work. 2564-alpha
authorCarl Hetherington <cth@carlh.net>
Sun, 18 Jun 2023 22:51:53 +0000 (00:51 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 18 Jun 2023 22:51:53 +0000 (00:51 +0200)
src/lib/image.cc

index 3aba3ebd535715a820d437cf0859f4b67a162cb9..86824539726309855b6a3dcfc8b01fbfd7c6a53b 100644 (file)
@@ -40,6 +40,7 @@
 LIBDCP_DISABLE_WARNINGS
 extern "C" {
 #include <libavutil/frame.h>
+#include <libavutil/opt.h>
 #include <libavutil/pixdesc.h>
 #include <libavutil/pixfmt.h>
 #include <libswscale/swscale.h>
@@ -260,6 +261,17 @@ Image::crop_scale_window (
                0, 1 << 16, 1 << 16
                );
 
+       static int64_t uniform_color = -1;
+       if (uniform_color == -1) {
+               // auto error = av_opt_get_int(scale_context, "uniform_color", AV_OPT_SEARCH_CHILDREN, &uniform_color);
+               auto option = av_opt_find2(scale_context, "uniform_color", "alphablend", 0, AV_OPT_SEARCH_CHILDREN, nullptr);
+               DCPOMATIC_ASSERT(option->type == AV_OPT_TYPE_CONST);
+               uniform_color = option->default_val.i64;
+               std::cout << "uniform_color=" << uniform_color << "\n";
+       }
+
+       std::cout << "set it: " << av_opt_set_int(scale_context, "alphablend", uniform_color, AV_OPT_SEARCH_CHILDREN) << "\n";
+
        /* Prepare input data pointers with crop */
        uint8_t* scale_in_data[planes()];
        for (int c = 0; c < planes(); ++c) {