summaryrefslogtreecommitdiff
path: root/media-libs/mlt/files/mlt-6.20.0-no-gtk2.patch
blob: 5031ab374f6b5ab42bb03d0b293957204a26710a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
From 1c45ceae1d06cd3df7063e2644140b647b6d0acd Mon Sep 17 00:00:00 2001
From: martin <martin.sandsmark@kde.org>
Date: Mon, 13 Apr 2020 19:15:32 +0000
Subject: [PATCH] split out gdk code from gtk2 code, disable gtk2 by default
 (#544)

* split gtk2 code out from gdk code

* remove gtk2 module from default build
---
 CMakeLists.txt                                |  2 +-
 src/modules/gdk/CMakeLists.txt                | 39 ++++++++
 src/modules/gdk/Makefile                      | 74 +++++++++++++++
 src/modules/gdk/configure                     | 82 +++++++++++++++++
 src/modules/gdk/factory.c                     | 92 +++++++++++++++++++
 src/modules/{gtk2 => gdk}/filter_rescale.c    |  0
 src/modules/{gtk2 => gdk}/filter_rescale.yml  |  0
 src/modules/{gtk2 => gdk}/have_mmx.S          |  0
 src/modules/{gtk2 => gdk}/pixops.c            |  0
 src/modules/{gtk2 => gdk}/pixops.h            |  0
 src/modules/{gtk2 => gdk}/producer_pango.c    |  1 -
 src/modules/{gtk2 => gdk}/producer_pango.yml  |  0
 src/modules/{gtk2 => gdk}/producer_pixbuf.c   |  0
 src/modules/{gtk2 => gdk}/producer_pixbuf.yml |  0
 .../{gtk2 => gdk}/scale_line_22_yuv_mmx.S     |  0
 src/modules/gtk2/deprecated                   |  0
 20 files changed, 291 insertions(+), 151 deletions(-)
 create mode 100644 src/modules/gdk/CMakeLists.txt
 create mode 100644 src/modules/gdk/Makefile
 create mode 100755 src/modules/gdk/configure
 create mode 100644 src/modules/gdk/factory.c
 rename src/modules/{gtk2 => gdk}/filter_rescale.c (100%)
 rename src/modules/{gtk2 => gdk}/filter_rescale.yml (100%)
 rename src/modules/{gtk2 => gdk}/have_mmx.S (100%)
 rename src/modules/{gtk2 => gdk}/pixops.c (100%)
 rename src/modules/{gtk2 => gdk}/pixops.h (100%)
 rename src/modules/{gtk2 => gdk}/producer_pango.c (99%)
 rename src/modules/{gtk2 => gdk}/producer_pango.yml (100%)
 rename src/modules/{gtk2 => gdk}/producer_pixbuf.c (100%)
 rename src/modules/{gtk2 => gdk}/producer_pixbuf.yml (100%)
 rename src/modules/{gtk2 => gdk}/scale_line_22_yuv_mmx.S (100%)
 create mode 100644 src/modules/gtk2/deprecated

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54afeceda..e25ca68b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ set(modules
     src/modules/decklink
     src/modules/frei0r
     src/modules/feeds
-    src/modules/gtk2
+    src/modules/gdk
     src/modules/kdenlive
     src/modules/motion_est
     src/modules/normalize
diff --git a/src/modules/gdk/CMakeLists.txt b/src/modules/gdk/CMakeLists.txt
new file mode 100644
index 000000000..b7bdb2c24
--- /dev/null
+++ b/src/modules/gdk/CMakeLists.txt
@@ -0,0 +1,39 @@
+set(mltgdk_src factory.c)
+set(mltgdk_lib mlt m Threads::Threads)
+set(mltgdk_def "")
+
+
+pkg_check_modules(GdkPixbuf IMPORTED_TARGET gdk-pixbuf-2.0 REQUIRED)
+if(TARGET PkgConfig::GdkPixbuf)
+    list(APPEND mltgdk_src producer_pixbuf.c pixops.c filter_rescale.c)
+    list(APPEND mltgdk_lib PkgConfig::GdkPixbuf)
+    list(APPEND mltgdk_def USE_PIXBUF)
+    message(STATUS "${mltgdk_lib}")
+else()
+    message(FATAL_ERROR "Failed to find gdk pixbuf")
+endif()
+
+pkg_check_modules(pango IMPORTED_TARGET pango)
+if(TARGET PkgConfig::pango)
+    pkg_check_modules(fontconfig IMPORTED_TARGET fontconfig)
+    if(TARGET PkgConfig::fontconfig)
+        list(APPEND mltgdk_src producer_pango.c)
+        list(APPEND mltgdk_lib PkgConfig::pango PkgConfig::fontconfig)
+        list(APPEND mltgdk_def USE_PANGO)
+    endif()
+endif()
+
+pkg_check_modules(libexif IMPORTED_TARGET libexif)
+if(TARGET PkgConfig::libexif)
+    list(APPEND mltgdk_lib PkgConfig::libexif)
+    list(APPEND mltgdk_def USE_EXIF)
+endif()
+# Only for MMX but not x86_64: deprecated
+# list(APPEND mltgdk_src have_mmx.S scale_line_22_yuv_mmx.S)
+add_library(mltgdk MODULE ${mltgdk_src})
+target_link_libraries(mltgdk ${mltgdk_lib})
+target_compile_definitions(mltgdk PRIVATE ${mltgdk_def})
+install(TARGETS mltgdk LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mlt)
+file(GLOB yml *.yml)
+install(FILES ${yml}
+        DESTINATION ${CMAKE_INSTALL_DATADIR}/mlt/gdk)
diff --git a/src/modules/gdk/Makefile b/src/modules/gdk/Makefile
new file mode 100644
index 000000000..2e3018976
--- /dev/null
+++ b/src/modules/gdk/Makefile
@@ -0,0 +1,74 @@
+include ../../../config.mak
+include config.mak
+
+CFLAGS := -I../.. $(CFLAGS)
+
+LDFLAGS := -L../../framework -lmlt -lpthread -lm $(LDFLAGS)
+
+TARGET = ../libmltgdk$(LIBSUF)
+
+OBJS = factory.o
+
+ifdef USE_PIXBUF
+OBJS += producer_pixbuf.o pixops.o filter_rescale.o
+CFLAGS += $(shell pkg-config $(PKGCONFIG_PREFIX) --cflags gdk-pixbuf-2.0)
+LDFLAGS += $(shell pkg-config $(PKGCONFIG_PREFIX) --libs gdk-pixbuf-2.0)
+endif
+
+ifdef USE_EXIF
+CFLAGS += $(EXIFCXXFLAGS) 
+LDFLAGS += $(EXIFLIBS)
+endif
+
+ifdef MMX_FLAGS
+ifndef ARCH_X86_64
+ASM_OBJS = have_mmx.o scale_line_22_yuv_mmx.o
+endif
+endif
+
+ifdef USE_PANGO
+OBJS += producer_pango.o
+CFLAGS += $(shell pkg-config $(PKGCONFIG_PREFIX) --cflags pangoft2)
+CFLAGS += $(shell pkg-config $(PKGCONFIG_PREFIX) --cflags-only-I freetype2 | awk '{for (i=1; i<=NF; i++) $$i=sprintf("%s/freetype", $$i); print}')
+LDFLAGS += $(shell pkg-config $(PKGCONFIG_PREFIX) --libs pangoft2)
+ifeq ($(targetos),Darwin)
+LDFLAGS += -liconv
+endif
+ifeq ($(targetos),FreeBSD)
+LDFLAGS += -liconv
+endif
+ifeq ($(targetos), MinGW)
+LDFLAGS += -liconv
+endif
+endif
+
+SRCS := $(OBJS:.o=.c)
+
+all: 	$(TARGET)
+
+$(TARGET): $(OBJS) $(ASM_OBJS)
+		$(CC) $(SHFLAGS) -o $@ $(OBJS) $(ASM_OBJS) $(LDFLAGS)
+
+have_mmx.o:
+	$(CC) -o $@ -c have_mmx.S
+
+scale_line_22_yuv_mmx.o: scale_line_22_yuv_mmx.S
+	$(CC) -o $@ -c scale_line_22_yuv_mmx.S
+
+depend:	$(SRCS)
+		$(CC) -MM $(CFLAGS) $^ 1>.depend
+
+distclean:	clean
+		rm -f .depend
+
+clean:	
+		rm -f $(OBJS) $(ASM_OBJS) $(TARGET)
+
+install: all
+	install -m 755 $(TARGET) "$(DESTDIR)$(moduledir)"
+	install -d "$(DESTDIR)$(mltdatadir)/gdk"
+	install -m 644 *.yml "$(DESTDIR)$(mltdatadir)/gdk"
+
+ifneq ($(wildcard .depend),)
+include .depend
+endif
diff --git a/src/modules/gdk/configure b/src/modules/gdk/configure
new file mode 100755
index 000000000..07003b049
--- /dev/null
+++ b/src/modules/gdk/configure
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+if [ "$help" = "1" ]
+then
+	cat << EOF
+GDK options:
+
+  --gdk-prefix=path      - Override the gdk prefix for pkg-config
+
+EOF
+
+else
+	pkgconfig_prefix=
+	for i in "$@"
+	do
+		case $i in
+			--gdk-prefix=* )	pkgconfig_prefix="${i#--gdk-prefix=}" ;;
+		esac
+	done
+	[ "$pkgconfig_prefix" != "" ] && pkgconfig_prefix="--define-variable=prefix=\"$pkgconfig_prefix\""
+
+	pkg-config $pkgconfig_prefix gdk-pixbuf-2.0 2> /dev/null
+	disable_pixbuf=$?
+
+	pkg-config $pkgconfig_prefix gdk-pixbuf-2.0 pangoft2 2> /dev/null
+	disable_pango=$?
+
+	if [ "$disable_pixbuf" != 0 -a "$disable_pango" != "0" ]
+	then
+		echo "- GDK components not found: disabling"
+		touch ../disable-gdk
+		exit 0
+	fi
+
+	echo > config.mak
+	
+	if [ "$disable_pixbuf" = "0" ]
+	then
+		echo "CFLAGS += -DUSE_PIXBUF" >> config.mak
+		echo "USE_PIXBUF=1" >> config.mak
+	else
+		echo "- pixbuf not found: pixbuf loader and rescaler disabled"
+	fi
+
+	if [ "$disable_pango" = "0" ]
+	then
+		echo "CFLAGS += -DUSE_PANGO" >> config.mak
+			echo "USE_PANGO=1" >> config.mak
+	else
+		echo "- pango not found: pango titler disabled"
+	fi
+
+	[ "$pkgconfig_prefix" != "" ] && echo "PKGCONFIG_PREFIX=$pkgconfig_prefix" >> config.mak
+
+	pkg-config --exists 'libexif'
+	if [ $? -eq 0 ]
+	then
+		echo "- Libexif found, enabling auto rotate"
+		echo "USE_EXIF=1" >> config.mak
+		echo EXIFCXXFLAGS=$(pkg-config --cflags libexif ) >> config.mak
+		echo EXIFCXXFLAGS += -DUSE_EXIF >> config.mak
+		echo EXIFLIBS=$(pkg-config --libs libexif) >> config.mak
+	elif [ -d "$exif_libdir" -a -d "$exif_includedir" ]
+	then
+		# test if we have a libexif
+		if [ -f "$exif_libdir/exif-data.h" ]
+		then
+			echo "- Libexif found, enabling auto rotate"
+			echo "USE_EXIF=1" >> config.mak
+			echo EXIFCXXFLAGS=-I$exif_includedir >> config.mak
+			echo EXIFCXXFLAGS += -DUSE_EXIF >> config.mak
+			echo EXIFLIBS=-L$exif_libdir lexif >> config.mak
+		else
+			echo "- Libexif not found, disabling exif features (auto rotate)"
+		fi
+	else
+		echo "- Libexif not found, disabling exif features (auto rotate)"
+	fi
+
+	exit 0
+fi
+
diff --git a/src/modules/gdk/factory.c b/src/modules/gdk/factory.c
new file mode 100644
index 000000000..94b89466e
--- /dev/null
+++ b/src/modules/gdk/factory.c
@@ -0,0 +1,92 @@
+/*
+ * factory.c -- the factory method interfaces
+ * Copyright (C) 2003-2014 Meltytech, LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <string.h>
+#include <framework/mlt.h>
+#include <stdlib.h>
+
+#ifdef USE_PIXBUF
+extern mlt_producer producer_pixbuf_init( char *filename );
+extern mlt_filter filter_rescale_init( mlt_profile profile, char *arg );
+#endif
+
+#ifdef USE_PANGO
+extern mlt_producer producer_pango_init( const char *filename );
+#endif
+
+static void initialise( )
+{
+	static int init = 0;
+	if ( init == 0 )
+	{
+		init = 1;
+		if ( getenv("MLT_PIXBUF_PRODUCER_CACHE") )
+		{
+			int n = atoi( getenv("MLT_PIXBUF_PRODUCER_CACHE" )  );
+			mlt_service_cache_set_size( NULL, "pixbuf.image", n );
+			mlt_service_cache_set_size( NULL, "pixbuf.alpha", n );
+			mlt_service_cache_set_size( NULL, "pixbuf.pixbuf", n );
+		}
+		if ( getenv("MLT_PANGO_PRODUCER_CACHE") )
+		{
+			int n = atoi( getenv("MLT_PANGO_PRODUCER_CACHE" )  );
+			mlt_service_cache_set_size( NULL, "pango.image", n );
+		}
+	}
+}
+
+void *create_service( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
+{
+	initialise( );
+
+#ifdef USE_PIXBUF
+	if ( !strcmp( id, "pixbuf" ) )
+		return producer_pixbuf_init( arg );
+#endif
+
+#ifdef USE_PANGO
+	if ( !strcmp( id, "pango" ) )
+		return producer_pango_init( arg );
+#endif
+
+#ifdef USE_PIXBUF
+	if ( !strcmp( id, "gtkrescale" ) )
+		return filter_rescale_init( profile, arg );
+#endif
+
+	return NULL;
+}
+
+static mlt_properties metadata( mlt_service_type type, const char *id, void *data )
+{
+	char file[ PATH_MAX ];
+	snprintf( file, PATH_MAX, "%s/gtk2/%s", mlt_environment( "MLT_DATA" ), (char*) data );
+	return mlt_properties_parse_yaml( file );
+}
+
+MLT_REPOSITORY
+{
+	MLT_REGISTER( filter_type, "gtkrescale", create_service );
+	MLT_REGISTER( producer_type, "pango", create_service );
+	MLT_REGISTER( producer_type, "pixbuf", create_service );
+
+	MLT_REGISTER_METADATA( filter_type, "gtkrescale", metadata, "filter_rescale.yml" );
+	MLT_REGISTER_METADATA( producer_type, "pango", metadata, "producer_pango.yml" );
+	MLT_REGISTER_METADATA( producer_type, "pixbuf", metadata, "producer_pixbuf.yml" );
+}
diff --git a/src/modules/gtk2/filter_rescale.c b/src/modules/gdk/filter_rescale.c
similarity index 100%
rename from src/modules/gtk2/filter_rescale.c
rename to src/modules/gdk/filter_rescale.c
diff --git a/src/modules/gtk2/filter_rescale.yml b/src/modules/gdk/filter_rescale.yml
similarity index 100%
rename from src/modules/gtk2/filter_rescale.yml
rename to src/modules/gdk/filter_rescale.yml
diff --git a/src/modules/gtk2/have_mmx.S b/src/modules/gdk/have_mmx.S
similarity index 100%
rename from src/modules/gtk2/have_mmx.S
rename to src/modules/gdk/have_mmx.S
diff --git a/src/modules/gtk2/pixops.c b/src/modules/gdk/pixops.c
similarity index 100%
rename from src/modules/gtk2/pixops.c
rename to src/modules/gdk/pixops.c
diff --git a/src/modules/gtk2/pixops.h b/src/modules/gdk/pixops.h
similarity index 100%
rename from src/modules/gtk2/pixops.h
rename to src/modules/gdk/pixops.h
diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gdk/producer_pango.c
similarity index 99%
rename from src/modules/gtk2/producer_pango.c
rename to src/modules/gdk/producer_pango.c
index b3e11b942..ead6e9123 100644
--- a/src/modules/gtk2/producer_pango.c
+++ b/src/modules/gdk/producer_pango.c
@@ -172,7 +172,6 @@ mlt_producer producer_pango_init( const char *filename )
 		pthread_mutex_lock( &pango_mutex );
 		if ( fontmap == NULL )
 			fontmap = (PangoFT2FontMap*) pango_ft2_font_map_new();
-		g_type_init();
 		pthread_mutex_unlock( &pango_mutex );
 
 		producer->get_frame = producer_get_frame;
diff --git a/src/modules/gtk2/producer_pango.yml b/src/modules/gdk/producer_pango.yml
similarity index 100%
rename from src/modules/gtk2/producer_pango.yml
rename to src/modules/gdk/producer_pango.yml
diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gdk/producer_pixbuf.c
similarity index 100%
rename from src/modules/gtk2/producer_pixbuf.c
rename to src/modules/gdk/producer_pixbuf.c
diff --git a/src/modules/gtk2/producer_pixbuf.yml b/src/modules/gdk/producer_pixbuf.yml
similarity index 100%
rename from src/modules/gtk2/producer_pixbuf.yml
rename to src/modules/gdk/producer_pixbuf.yml
diff --git a/src/modules/gtk2/scale_line_22_yuv_mmx.S b/src/modules/gdk/scale_line_22_yuv_mmx.S
similarity index 100%
rename from src/modules/gtk2/scale_line_22_yuv_mmx.S
rename to src/modules/gdk/scale_line_22_yuv_mmx.S
diff --git a/src/modules/gtk2/deprecated b/src/modules/gtk2/deprecated
new file mode 100644
index 000000000..e69de29bb