Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package movit for openSUSE:Factory checked 
in at 2023-07-17 19:23:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/movit (Old)
 and      /work/SRC/openSUSE:Factory/.movit.new.3193 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "movit"

Mon Jul 17 19:23:30 2023 rev:13 rq:1098845 version:1.7.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/movit/movit.changes      2019-07-13 
14:01:02.310886244 +0200
+++ /work/SRC/openSUSE:Factory/.movit.new.3193/movit.changes    2023-07-17 
19:23:50.129928271 +0200
@@ -1,0 +2,11 @@
+Sat Jul 15 18:23:27 UTC 2023 - antoine.belv...@opensuse.org
+
+- Update to version 1.7.0:
+  * Compile shaders into the library.
+  * Use exact sRGB matrix values for COLORSPACE_sRGB.
+- Drop movit-1.6.0-versioned-shaderdir.patch: Made irrelevant
+  since shaders are now compiled into the library.
+- Specify a minimal version for Eigen3: Build now fails with a
+  version below 3.4.0.
+
+-------------------------------------------------------------------

Old:
----
  movit-1.6.0-versioned-shaderdir.patch
  movit-1.6.3.tar.xz

New:
----
  movit-1.7.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ movit.spec ++++++
--- /var/tmp/diff_new_pack.bkrbbC/_old  2023-07-17 19:23:50.629931167 +0200
+++ /var/tmp/diff_new_pack.bkrbbC/_new  2023-07-17 19:23:50.633931190 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package movit
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,20 +18,18 @@
 
 %define _sonum  8
 Name:           movit
-Version:        1.6.3
+Version:        1.7.0
 Release:        0
 Summary:        GPU video filter library
 License:        GPL-2.0-or-later
 Group:          Development/Libraries/C and C++
-Url:            https://movit.sesse.net
+URL:            https://movit.sesse.net
 Source0:        %{name}-%{version}.tar.xz
-# PATCH-FIX-UPSTREAM movit-1.6.0-versioned-shaderdir.patch -- Make shader 
directory versioned
-Patch0:         movit-1.6.0-versioned-shaderdir.patch
 BuildRequires:  libtool
 BuildRequires:  make
 BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(egl)
-BuildRequires:  pkgconfig(eigen3)
+BuildRequires:  pkgconfig(eigen3) >= 3.4.0
 BuildRequires:  pkgconfig(epoxy)
 BuildRequires:  pkgconfig(fftw3)
 BuildRequires:  pkgconfig(sdl2)
@@ -50,9 +48,11 @@
 %package -n libmovit%{_sonum}
 Summary:        GPU video filter library
 Group:          System/Libraries
-Requires:       %{name}%{_sonum}-data
 Provides:       %{name} = %{version}
 Obsoletes:      %{name} < %{version}
+# Shaders used to be split; Ensure upgrade path until Leap 15.5 EOL (Dec. 
2024).
+Provides:       %{name}%{_sonum}-data = %{version}
+Obsoletes:      %{name}%{_sonum}-data < %{version}
 
 %description -n libmovit%{_sonum}
 Movit is a library for video filters. It uses the GPU present in many
@@ -73,24 +73,8 @@
 
 This package contains the development files (library and header files).
 
-%package -n     movit%{_sonum}-data
-Summary:        Data files for the Movit GPU video filter library
-Group:          Development/Libraries/C and C++
-Provides:       %{name}-data = %{version}
-Obsoletes:      %{name}-data < %{version}
-BuildArch:      noarch
-
-%description -n movit%{_sonum}-data
-Movit is a library for video filters. It uses the GPU present in many
-computers to accelerate computation of common filters and
-transitions, facilitating real-time HD video editing.
-
-This package contains the architecture-independent data files (GLSL
-fragment shaders).
-
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 # For SLE12, force use of GCC 7
@@ -98,9 +82,7 @@
 test -x "$(type -p g++-7)" && export CXX=g++-7
 
 ./autogen.sh
-%configure \
-  --disable-static \
-  --with-shaderdir="%{_datadir}/%{name}%{_sonum}"
+%configure --disable-static
 
 make %{?_smp_mflags} TESTS=
 
@@ -116,10 +98,6 @@
 %doc README NEWS
 %{_libdir}/libmovit.so.*
 
-%files -n movit%{_sonum}-data
-%license COPYING
-%{_datadir}/movit%{_sonum}/
-
 %files devel
 %license COPYING
 %{_libdir}/libmovit.so

++++++ _service ++++++
--- /var/tmp/diff_new_pack.bkrbbC/_old  2023-07-17 19:23:50.665931375 +0200
+++ /var/tmp/diff_new_pack.bkrbbC/_new  2023-07-17 19:23:50.665931375 +0200
@@ -1,6 +1,6 @@
 <services>
   <service mode="disabled" name="tar_scm">
-    <param name="revision">1.6.3</param>
+    <param name="revision">1.7.0</param>
     <param name="scm">git</param>
     <param name="url">https://git.sesse.net/movit</param>
     <param name="versionformat">@PARENT_TAG@</param>

++++++ movit-1.6.3.tar.xz -> movit-1.7.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/.gitignore new/movit-1.7.0/.gitignore
--- old/movit-1.6.3/.gitignore  1970-01-01 01:00:00.000000000 +0100
+++ new/movit-1.7.0/.gitignore  2023-07-15 17:43:18.000000000 +0200
@@ -0,0 +1,67 @@
+*.o
+*.lo
+*.la
+*.ld
+*.a
+*.d
+*.jpg
+*.png
+*.gcda
+*.gcno
+perf.data
+*.dot
+demo
+make_bundled_shaders
+bundled_shaders.cpp
+effect_chain_test
+compute_shader_test
+gamma_compression_effect_test
+gamma_expansion_effect_test
+alpha_multiplication_effect_test
+alpha_division_effect_test
+colorspace_conversion_effect_test
+mix_effect_test
+overlay_effect_test
+saturation_effect_test
+deconvolution_sharpen_effect_test
+blur_effect_test
+unsharp_mask_effect_test
+diffusion_effect_test
+white_balance_effect_test
+lift_gamma_gain_effect_test
+resample_effect_test
+dither_effect_test
+glow_effect_test
+padding_effect_test
+flat_input_test
+ycbcr_input_test
+ycbcr_422interleaved_input_test
+complex_modulate_effect_test
+fft_pass_effect_test
+fft_convolution_effect_test
+fp16_test
+luma_mix_effect_test
+slice_effect_test
+vignette_effect_test
+ycbcr_conversion_effect_test
+deinterlace_effect_test
+chain-*.frag
+chain-*.comp
+movit.info
+coverage/
+aclocal.m4
+autogen.sh
+autom4te.cache/
+config.h.in
+config.log
+config.status
+.libs
+config.guess
+config.sub
+install-sh
+libtool
+ltmain.sh
+m4
+configure
+Makefile
+movit.pc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/Makefile.in new/movit-1.7.0/Makefile.in
--- old/movit-1.6.3/Makefile.in 2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/Makefile.in 2023-07-15 17:43:18.000000000 +0200
@@ -6,15 +6,14 @@
 # strive towards having a rock-stable ABI, but at least the soversion will 
increase
 # whenever it breaks, so that you will not have silent failures, and 
distribution package
 # management can run its course.
-movit_ltversion = 8:3:0
-movit_version = 1.6.3
+movit_ltversion = 8:4:0
+movit_version = 1.7.0
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 includedir = @includedir@
 libdir = @libdir@
 datarootdir = @datarootdir@
-datadir = @datadir@
 top_builddir = @top_builddir@
 with_demo_app = @with_demo_app@
 with_benchmark = @with_benchmark@
@@ -90,7 +89,7 @@
 # Unit tests.
 TESTS=effect_chain_test fp16_test $(TESTED_INPUTS:=_test) 
$(TESTED_EFFECTS:=_test)
 
-LIB_OBJS=effect_util.o util.o effect.o effect_chain.o init.o resource_pool.o 
ycbcr.o $(INPUTS:=.o) $(EFFECTS:=.o)
+LIB_OBJS=effect_util.o util.o effect.o effect_chain.o init.o resource_pool.o 
ycbcr.o bundled_shaders.o $(INPUTS:=.o) $(EFFECTS:=.o)
 
 # Default target:
 all: libmovit.la $(TESTS)
@@ -112,8 +111,8 @@
 $(TESTS): %: %.o $(TEST_OBJS) libmovit.la
        $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $^ $(TEST_LDLIBS)
 
-OWN_OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(OWN_TEST_OBJS) $(TESTS:=.o)
-OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o)
+OWN_OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(OWN_TEST_OBJS) $(TESTS:=.o) 
make_bundled_shaders.o
+OBJS=$(DEMO_OBJS) $(LIB_OBJS) $(TEST_OBJS) $(TESTS:=.o) make_bundled_shaders.o
 
 # A small demo program.
 demo: libmovit.la $(DEMO_OBJS)
@@ -135,7 +134,8 @@
 
 clean:
        $(LIBTOOL) --mode=clean $(RM) demo $(TESTS) libmovit.la $(OBJS) 
$(OBJS:.o=.lo)
-       $(RM) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag
+       $(LIBTOOL) --mode=clean $(RM) $(MAKE_BUNDLE_OBJS) 
$(MAKE_BUNDLE_OBJS:.o=.lo) make_bundled_shaders bundled_shaders.cpp
+       $(RM) $(OBJS:.o=.gcno) $(OBJS:.o=.gcda) $(MAKE_BUNDLE_OBJS:.o=.gcno) 
$(MAKE_BUNDLE_OBJS:.o=.gcda) $(DEPS) step*.dot chain*.frag
        $(RM) -r movit.info coverage/ .libs/
 
 distclean: clean
@@ -180,18 +180,23 @@
 MISSING_SHADERS += fft_convolution_effect.frag fft_input.frag
 SHADERS := $(filter-out $(MISSING_SHADERS),$(SHADERS))
 
+# A program to compile all the shaders into one bundle that we can link into 
the library.
+MAKE_BUNDLE_OBJS=make_bundled_shaders.o util.o init.o resource_pool.o
+make_bundled_shaders: $(MAKE_BUNDLE_OBJS)
+       $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o make_bundled_shaders 
$(MAKE_BUNDLE_OBJS) -lepoxy 
+bundled_shaders.cpp: make_bundled_shaders $(SHADERS)
+       ./make_bundled_shaders $(SHADERS) > $@
+
 install: libmovit.la
        $(MKDIR) -p $(DESTDIR)$(libdir)/
        $(LIBTOOL) --mode=install $(INSTALL) -m 0644 libmovit.la 
$(DESTDIR)$(libdir)/
        $(MKDIR) -p $(DESTDIR)$(includedir)/movit/
        $(INSTALL) -m 0644 $(HDRS) $(DESTDIR)$(includedir)/movit/
-       $(MKDIR) -p $(DESTDIR)$(datadir)/movit/
-       $(INSTALL) -m 0644 $(SHADERS) $(DESTDIR)$(datadir)/movit/
        $(MKDIR) -p $(DESTDIR)$(libdir)/pkgconfig/
        $(INSTALL) -m 644 movit.pc $(DESTDIR)$(libdir)/pkgconfig/
 
 DISTDIR=movit-$(movit_version)
-OTHER_DIST_FILES=add.frag autogen.sh blue.frag configure.ac d65.h 
identity.frag invert_effect.frag Makefile.in mipmap_needing_effect.frag 
downscale2x.frag downscale2x.comp mirror.comp identity.comp movit.pc.in README 
NEWS test_util.h widgets.h
+OTHER_DIST_FILES=add.frag autogen.sh blue.frag configure.ac d65.h 
identity.frag invert_effect.frag Makefile.in mipmap_needing_effect.frag 
downscale2x.frag downscale2x.comp mirror.comp identity.comp movit.pc.in README 
NEWS test_util.h widgets.h bundled_shaders.h
 
 dist:
        $(MKDIR) $(DISTDIR)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/NEWS new/movit-1.7.0/NEWS
--- old/movit-1.6.3/NEWS        2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/NEWS        2023-07-15 17:43:18.000000000 +0200
@@ -1,3 +1,12 @@
+Movit 1.7.0, July 15th, 2023
+
+  - Compile shaders into the library. It is now allowed to give ""
+    as the data directory, which will use the compiled-in shaders.
+    Most users should probably just do that.
+
+  - Use exact sRGB matrix values for COLORSPACE_sRGB.
+
+
 Movit 1.6.3, July 7th, 2019
 
   - Various bugfixes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/README new/movit-1.7.0/README
--- old/movit-1.6.3/README      2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/README      2023-07-15 17:43:18.000000000 +0200
@@ -17,7 +17,7 @@
 
 OK, you need
 
-* A C++11 compiler. GCC will do. (I haven't tried Windows, but it
+* A C++14 compiler. GCC will do. (I haven't tried Windows, but it
   works fine on Linux and OS X, and Movit is not very POSIX-bound.)
 * GNU Make.
 * A GPU capable of running OpenGL 3.0 or newer. GLES3 (for mobile devices)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/bundled_shaders.h 
new/movit-1.7.0/bundled_shaders.h
--- old/movit-1.6.3/bundled_shaders.h   1970-01-01 01:00:00.000000000 +0100
+++ new/movit-1.7.0/bundled_shaders.h   2023-07-15 17:43:18.000000000 +0200
@@ -0,0 +1,18 @@
+#ifndef _MOVIT_BUNDLED_SHADERS_H
+#define _MOVIT_BUNDLED_SHADERS_H 1
+
+// Shader files that are compiled into the library.
+
+namespace movit {
+
+struct BundledShader {
+       const char *filename;  // nullptr for end.
+       size_t offset;  // Into shader_bundle.
+       size_t length;
+};
+extern BundledShader bundled_shaders[];
+extern const char *shader_bundle;
+
+}  // namespace movit
+
+#endif  // _MOVIT_BUNDLED_SHADERS_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/colorspace_conversion_effect.cpp 
new/movit-1.7.0/colorspace_conversion_effect.cpp
--- old/movit-1.6.3/colorspace_conversion_effect.cpp    2019-07-07 
11:26:18.000000000 +0200
+++ new/movit-1.7.0/colorspace_conversion_effect.cpp    2023-07-15 
17:43:18.000000000 +0200
@@ -38,12 +38,28 @@
        if (space == COLORSPACE_XYZ) {
                return Matrix3d::Identity();
        }
+       if (space == COLORSPACE_sRGB) {
+               // sRGB is not defined by the color primaries, but by concrete
+               // forward and inverse matrices that are rounded-off versions
+               // of the Rec. 709 color space (see
+               // 
https://photosauce.net/blog/post/what-makes-srgb-a-special-color-space).
+               // We're not compliant with the inverse matrix, since we'd be
+               // too accurate (sRGB is specified for 8-bit only); however,
+               // results should be very close in practice (and even closer to
+               // scRGB's inverse matrix, which is a higher-accuracy inversion 
of
+               // the same forward matrix).
+               return Matrix3d{
+                       { 0.4124, 0.3576, 0.1805 },
+                       { 0.2126, 0.7152, 0.0722 },
+                       { 0.0193, 0.1192, 0.9505 }
+               };
+       }
 
        double x_R, x_G, x_B;
        double y_R, y_G, y_B;
 
        switch (space) {
-       case COLORSPACE_REC_709:  // And sRGB.
+       case COLORSPACE_REC_709:
                x_R = rec709_x_R; x_G = rec709_x_G; x_B = rec709_x_B;
                y_R = rec709_y_R; y_G = rec709_y_G; y_B = rec709_y_B;
                break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/colorspace_conversion_effect_test.cpp 
new/movit-1.7.0/colorspace_conversion_effect_test.cpp
--- old/movit-1.6.3/colorspace_conversion_effect_test.cpp       2019-07-07 
11:26:18.000000000 +0200
+++ new/movit-1.7.0/colorspace_conversion_effect_test.cpp       2023-07-15 
17:43:18.000000000 +0200
@@ -41,7 +41,7 @@
        };
        float out_data[4 * 5];
 
-       EffectChainTester tester(data, 1, 5, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, 
COLORSPACE_sRGB, GAMMA_LINEAR);
+       EffectChainTester tester(data, 1, 5, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, 
COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA32F);
        tester.run(out_data, GL_RGBA, COLORSPACE_XYZ, GAMMA_LINEAR);
 
        // Black should stay black.
@@ -87,6 +87,21 @@
        EXPECT_NEAR(0.150, blue_x, 1e-3);
        EXPECT_NEAR(0.060, blue_y, 1e-3);
        EXPECT_FLOAT_EQ(1.0f, out_data[4 * 4 + 3]);
+
+       // The forward matrix should be exactly as specified in the standard,
+       // up to floating-point precision. (We're not compliant with the
+       // inverse matrix, but we should be very close.)
+       EXPECT_FLOAT_EQ(0.4124f, out_data[2 * 4 + 0]);
+       EXPECT_FLOAT_EQ(0.2126f, out_data[2 * 4 + 1]);
+       EXPECT_FLOAT_EQ(0.0193f, out_data[2 * 4 + 2]);
+
+       EXPECT_FLOAT_EQ(0.3576f, out_data[3 * 4 + 0]);
+       EXPECT_FLOAT_EQ(0.7152f, out_data[3 * 4 + 1]);
+       EXPECT_FLOAT_EQ(0.1192f, out_data[3 * 4 + 2]);
+
+       EXPECT_FLOAT_EQ(0.1805f, out_data[4 * 4 + 0]);
+       EXPECT_FLOAT_EQ(0.0722f, out_data[4 * 4 + 1]);
+       EXPECT_FLOAT_EQ(0.9505f, out_data[4 * 4 + 2]);
 }
 
 TEST(ColorspaceConversionEffectTest, Rec601_525_Primaries) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/configure.ac new/movit-1.7.0/configure.ac
--- old/movit-1.6.3/configure.ac        2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/configure.ac        2023-07-15 17:43:18.000000000 +0200
@@ -12,7 +12,7 @@
 PKG_CHECK_MODULES([epoxy], [epoxy])
 PKG_CHECK_MODULES([FFTW3], [fftw3])
 
-CXXFLAGS="$CXXFLAGS -std=gnu++11"
+CXXFLAGS="$CXXFLAGS -std=gnu++14"
 
 # Needed for unit tests and the demo app.
 with_demo_app=yes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/image_format.h 
new/movit-1.7.0/image_format.h
--- old/movit-1.6.3/image_format.h      2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/image_format.h      2023-07-15 17:43:18.000000000 +0200
@@ -27,12 +27,12 @@
 
 enum Colorspace {
        COLORSPACE_INVALID = -1,  // For internal use.
-       COLORSPACE_sRGB = 0,
-       COLORSPACE_REC_709 = 0,  // Same as sRGB.
+       COLORSPACE_REC_709 = 0,
        COLORSPACE_REC_601_525 = 1,
        COLORSPACE_REC_601_625 = 2,
        COLORSPACE_XYZ = 3,  // Mostly useful for testing and debugging.
        COLORSPACE_REC_2020 = 4,
+       COLORSPACE_sRGB = 5,  // Used to be same as COLORSPACE_REC_709.
 };
 
 enum GammaCurve {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/init.h new/movit-1.7.0/init.h
--- old/movit-1.6.3/init.h      2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/init.h      2023-07-15 17:43:18.000000000 +0200
@@ -17,7 +17,9 @@
 // succeeded.
 //
 // The first parameter gives which directory to read .frag files from.
-// This is a temporary hack until we add something more solid.
+// If you use "", or the file isn't found, a compiled-in version will
+// be used instead (if it exists). Most users should probably use ""
+// unless you need backwards compatibility with Movit 1.6.3 or older.
 //
 // The second parameter specifies whether debugging is on or off.
 // If it is on, Movit will write intermediate graphs and the final
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/make_bundled_shaders.cpp 
new/movit-1.7.0/make_bundled_shaders.cpp
--- old/movit-1.6.3/make_bundled_shaders.cpp    1970-01-01 01:00:00.000000000 
+0100
+++ new/movit-1.7.0/make_bundled_shaders.cpp    2023-07-15 17:43:18.000000000 
+0200
@@ -0,0 +1,65 @@
+#include <stdio.h>
+#include <string>
+#include <vector>
+#include "util.h"
+#include "bundled_shaders.h"
+
+using namespace std;
+using namespace movit;
+
+namespace movit {
+
+// We need a fake (empty) list of shaders, since we reuse read_file().
+BundledShader bundled_shaders[] = {
+       { nullptr, 0, 0 }
+};
+const char *shader_bundle = "";
+extern string *movit_data_directory;
+
+}  // namespace movit
+
+int main(int argc, char **argv)
+{
+       std::vector<BundledShader> shaders;
+       std::string bundle;
+
+       movit_data_directory = new string(".");
+
+       for (int i = 1; i < argc; ++i) {
+               string contents = read_file(argv[i]);
+               shaders.push_back(BundledShader{ argv[i], 
/*offset=*/bundle.size(), /*length=*/contents.size() });
+               bundle += contents;
+       }
+
+       printf("// Autogenerated by make_bundled_shaders.cpp. Do not edit by 
hand!\n");
+       printf("#include <string>\n");
+       printf("#include \"bundled_shaders.h\"\n");
+       printf("\n");
+       printf("namespace movit {\n");
+       printf("\n");
+       printf("BundledShader bundled_shaders[] = {\n");
+       for (const BundledShader &shader : shaders) {
+               printf("\t{ \"%s\", %zu, %zu },\n", shader.filename, 
shader.offset, shader.length);
+       }
+       printf("\t{ nullptr, 0, 0 }\n");
+       printf("};\n");
+       printf("const char *shader_bundle = \"");
+       for (unsigned char ch : bundle) {
+               if (ch == '\n') {
+                       printf("\\n");
+               } else if (ch == '\t') {
+                       printf("\\t");
+               } else if (ch == '"') { 
+                       printf("\\\"");
+               } else if (ch == '\\') {        
+                       printf("\\\\");
+               } else if (!isprint(ch)) {
+                       printf("\\0%o", ch);
+               } else {
+                       printf("%c", ch);
+               }
+       }
+       printf("\";\n");
+       printf("\n");
+       printf("}  // namespace movit\n");
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/util.cpp new/movit-1.7.0/util.cpp
--- old/movit-1.6.3/util.cpp    2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/util.cpp    2023-07-15 17:43:18.000000000 +0200
@@ -9,6 +9,7 @@
 #include <string>
 #include <Eigen/Core>
 
+#include "bundled_shaders.h"
 #include "fp16.h"
 #include "init.h"
 #include "util.h"
@@ -84,18 +85,49 @@
        }
 }
 
+string read_file_from_bundle(const string &filename)
+{
+       for (const BundledShader *shader = bundled_shaders; shader->filename != 
nullptr; ++shader) {
+               if (shader->filename == filename) {
+                       return string(shader_bundle + shader->offset, 
shader->length);
+               }
+       }
+       return "";  // Not found.
+}
+
 string read_file(const string &filename)
 {
+       string contents_from_bundle = read_file_from_bundle(filename);
+
+       // If no data directory has been given, we read only from the bundle.
+       if (*movit_data_directory == "") {
+               if (contents_from_bundle.empty()) {
+                       fprintf(stderr, "%s: Shader not compiled in, and no 
data directory has been given.\n", filename.c_str());
+                       exit(1);
+               } else {
+                       return contents_from_bundle;
+               }
+       }
+
+       // If we're given a data directory, we still support reading from the 
bundle,
+       // but a successful read from the file system takes priority.
        const string full_pathname = *movit_data_directory + "/" + filename;
 
        FILE *fp = fopen(full_pathname.c_str(), "r");
        if (fp == nullptr) {
+               if (!contents_from_bundle.empty()) {
+                       return contents_from_bundle;
+               }
                perror(full_pathname.c_str());
                exit(1);
        }
 
        int ret = fseek(fp, 0, SEEK_END);
        if (ret == -1) {
+               if (!contents_from_bundle.empty()) {
+                       fclose(fp);
+                       return contents_from_bundle;
+               }
                perror("fseek(SEEK_END)");
                exit(1);
        }
@@ -104,6 +136,10 @@
 
        ret = fseek(fp, 0, SEEK_SET);
        if (ret == -1) {
+               if (!contents_from_bundle.empty()) {
+                       fclose(fp);
+                       return contents_from_bundle;
+               }
                perror("fseek(SEEK_SET)");
                exit(1);
        }
@@ -112,10 +148,18 @@
        str.resize(size);
        ret = fread(&str[0], size, 1, fp);
        if (ret == -1) {
+               if (!contents_from_bundle.empty()) {
+                       fclose(fp);
+                       return contents_from_bundle;
+               }
                perror("fread");
                exit(1);
        }
        if (ret == 0) {
+               if (!contents_from_bundle.empty()) {
+                       fclose(fp);
+                       return contents_from_bundle;
+               }
                fprintf(stderr, "Short read when trying to read %d bytes from 
%s\n",
                        size, full_pathname.c_str());
                exit(1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/movit-1.6.3/version.h new/movit-1.7.0/version.h
--- old/movit-1.6.3/version.h   2019-07-07 11:26:18.000000000 +0200
+++ new/movit-1.7.0/version.h   2023-07-15 17:43:18.000000000 +0200
@@ -5,6 +5,6 @@
 // changes, even within git versions. There is no specific version
 // documentation outside the regular changelogs, though.
 
-#define MOVIT_VERSION 37
+#define MOVIT_VERSION 39
 
 #endif // !defined(_MOVIT_VERSION_H)

Reply via email to