diff options
-rw-r--r-- | configure.ac | 34 | ||||
-rw-r--r-- | libmediaart/Makefile.am | 7 | ||||
-rw-r--r-- | libmediaart/cache.h | 9 | ||||
-rw-r--r-- | libmediaart/extract.h | 14 | ||||
-rw-r--r-- | libmediaart/extractgeneric.h | 6 | ||||
-rw-r--r-- | libmediaart/mediaart-macros.h | 31 |
6 files changed, 98 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 9993b4e..74f0408 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,40 @@ fi AM_CONDITIONAL(HAVE_UNIT_TESTS, test "x$have_unit_tests" = "xyes") +dnl ********************************************************************* +dnl * Check for -fvisibility=hidden to determine if we can do GNU-style * +dnl * visibility attributes for symbol export control * +dnl ********************************************************************* + +LIBMEDIAART_HIDDEN_VISIBILITY_CFLAGS="" +case "$host" in + *-*-mingw*) + dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) + AC_DEFINE([_LIBMEDIAART_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern], + [defines how to decorate public symbols while building]) + CFLAGS="${CFLAGS} -fvisibility=hidden" + ;; + *) + dnl on other compilers, check if we can do -fvisibility=hidden + SAVED_CFLAGS="${CFLAGS}" + CFLAGS="-fvisibility=hidden" + AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) + AC_TRY_COMPILE([], [return 0], + AC_MSG_RESULT(yes) + enable_fvisibility_hidden=yes, + AC_MSG_RESULT(no) + enable_fvisibility_hidden=no) + CFLAGS="${SAVED_CFLAGS}" + + AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [ + AC_DEFINE([_LIBMEDIAART_EXTERN], [__attribute__((visibility("default"))) extern], + [defines how to decorate public symbols while building]) + LIBMEDIAART_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" + ]) + ;; +esac +AC_SUBST(LIBMEDIAART_HIDDEN_VISIBILITY_CFLAGS) + ################################################################## # Write generated files ################################################################## diff --git a/libmediaart/Makefile.am b/libmediaart/Makefile.am index da5073a..a6f7bc2 100644 --- a/libmediaart/Makefile.am +++ b/libmediaart/Makefile.am @@ -1,6 +1,8 @@ AM_CPPFLAGS = \ $(BUILD_CFLAGS) \ - $(LIBMEDIAART_CFLAGS) + $(LIBMEDIAART_CFLAGS) \ + $(LIBMEDIAART_HIDDEN_VISIBILITY_CFLAGS) + # # Binaries @@ -49,8 +51,7 @@ endif endif libmediaart_@LIBMEDIAART_API_VERSION@_la_LDFLAGS = \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -export-symbols-regex '^media_art_.*' + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) libmediaart_@LIBMEDIAART_API_VERSION@_la_LIBADD = \ $(BUILD_LIBS) \ diff --git a/libmediaart/cache.h b/libmediaart/cache.h index 2bb711c..e656011 100644 --- a/libmediaart/cache.h +++ b/libmediaart/cache.h @@ -23,27 +23,34 @@ #include <glib.h> #include <gio/gio.h> +#include "mediaart-macros.h" + #if !defined (__LIBMEDIAART_INSIDE__) && !defined (LIBMEDIAART_COMPILATION) #error "Only <libmediaart/mediaart.h> must be included directly." #endif G_BEGIN_DECLS +_LIBMEDIAART_EXTERN gchar * media_art_strip_invalid_entities (const gchar *original); +_LIBMEDIAART_EXTERN gboolean media_art_get_path (const gchar *artist, const gchar *title, const gchar *prefix, gchar **cache_path); +_LIBMEDIAART_EXTERN gboolean media_art_get_file (const gchar *artist, const gchar *title, const gchar *prefix, GFile **cache_file); +_LIBMEDIAART_EXTERN gboolean media_art_remove (const gchar *artist, const gchar *album, GCancellable *cancellable, GError **error); +_LIBMEDIAART_EXTERN void media_art_remove_async (const gchar *artist, const gchar *album, gint io_priority, @@ -51,6 +58,8 @@ void media_art_remove_async (const gchar *artist, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); + +_LIBMEDIAART_EXTERN gboolean media_art_remove_finish (GObject *source_object, GAsyncResult *result, GError **error); diff --git a/libmediaart/extract.h b/libmediaart/extract.h index 8f6440a..460015d 100644 --- a/libmediaart/extract.h +++ b/libmediaart/extract.h @@ -23,6 +23,8 @@ #include <glib.h> #include <gio/gio.h> +#include "mediaart-macros.h" + #if !defined (__LIBMEDIAART_INSIDE__) && !defined (LIBMEDIAART_COMPILATION) #error "Only <libmediaart/mediaart.h> must be included directly." #endif @@ -88,6 +90,7 @@ typedef enum { } MediaArtError; +_LIBMEDIAART_EXTERN GQuark media_art_error_quark (void) G_GNUC_CONST; @@ -122,9 +125,12 @@ struct _MediaArtProcessClass { }; +_LIBMEDIAART_EXTERN GType media_art_process_get_type (void) G_GNUC_CONST; +_LIBMEDIAART_EXTERN MediaArtProcess *media_art_process_new (GError **error); +_LIBMEDIAART_EXTERN gboolean media_art_process_uri (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -133,6 +139,7 @@ gboolean media_art_process_uri (MediaArtProcess *process const gchar *title, GCancellable *cancellable, GError **error); +_LIBMEDIAART_EXTERN void media_art_process_uri_async (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -143,9 +150,11 @@ void media_art_process_uri_async (MediaArtProcess *process GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); +_LIBMEDIAART_EXTERN gboolean media_art_process_uri_finish (MediaArtProcess *process, GAsyncResult *result, GError **error); +_LIBMEDIAART_EXTERN gboolean media_art_process_file (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -154,6 +163,7 @@ gboolean media_art_process_file (MediaArtProcess *process const gchar *title, GCancellable *cancellable, GError **error); +_LIBMEDIAART_EXTERN void media_art_process_file_async (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -164,9 +174,11 @@ void media_art_process_file_async (MediaArtProcess *process GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); +_LIBMEDIAART_EXTERN gboolean media_art_process_file_finish (MediaArtProcess *process, GAsyncResult *result, GError **error); +_LIBMEDIAART_EXTERN gboolean media_art_process_buffer (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -178,6 +190,7 @@ gboolean media_art_process_buffer (MediaArtProcess *process const gchar *title, GCancellable *cancellable, GError **error); +_LIBMEDIAART_EXTERN void media_art_process_buffer_async (MediaArtProcess *process, MediaArtType type, MediaArtProcessFlags flags, @@ -191,6 +204,7 @@ void media_art_process_buffer_async (MediaArtProcess *process GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); +_LIBMEDIAART_EXTERN gboolean media_art_process_buffer_finish (MediaArtProcess *process, GAsyncResult *result, GError **error); diff --git a/libmediaart/extractgeneric.h b/libmediaart/extractgeneric.h index 8fa114b..b08fe2c 100644 --- a/libmediaart/extractgeneric.h +++ b/libmediaart/extractgeneric.h @@ -25,18 +25,24 @@ #include <glib.h> +#include "mediaart-macros.h" + #if !defined (__LIBMEDIAART_INSIDE__) && !defined (LIBMEDIAART_COMPILATION) #error "Only <libmediaart/mediaart.h> must be included directly." #endif G_BEGIN_DECLS +_LIBMEDIAART_EXTERN void media_art_plugin_init (gint max_width); +_LIBMEDIAART_EXTERN void media_art_plugin_shutdown (void); +_LIBMEDIAART_EXTERN gboolean media_art_file_to_jpeg (const gchar *filename, const gchar *target, GError **error); +_LIBMEDIAART_EXTERN gboolean media_art_buffer_to_jpeg (const unsigned char *buffer, size_t len, const gchar *buffer_mime, diff --git a/libmediaart/mediaart-macros.h b/libmediaart/mediaart-macros.h new file mode 100644 index 0000000..84b6d79 --- /dev/null +++ b/libmediaart/mediaart-macros.h @@ -0,0 +1,31 @@ +/* + * Copyright 2017, Sam Thursfield <sam.thursfield@codethink.co.uk> + * + * 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. + */ + +#ifndef __LIBMEDIAART_MACROS_H__ +#define __LIBMEDIAART_MACROS_H__ + +#if !defined (__LIBMEDIAART_INSIDE__) && !defined (LIBMEDIAART_COMPILATION) +#error "Only <libmediaart/mediaart.h> must be included directly." +#endif + +#ifndef _LIBMEDIAART_EXTERN +#define _LIBMEDIAART_EXTERN extern +#endif + +#endif /* __LIBMEDIAART_MACROS_H__ */ |