libs: remove dependency on IN_LIBGSTVAAPI_CORE

This conditional code was when libgstvaapi was intended to be library
used outside GStreamer. This not the case anymore, thus removing it.

https://bugzilla.gnome.org/show_bug.cgi?id=797139
This commit is contained in:
Víctor Manuel Jáquez Leal 2018-09-13 12:22:42 +02:00
parent f4f935b6f4
commit 4505acc522
14 changed files with 61 additions and 234 deletions

View file

@ -21,7 +21,6 @@ noinst_LTLIBRARIES += libgstvaapi-wayland.la
endif
libgstvaapi_cflags = \
-DIN_LIBGSTVAAPI_CORE \
-DGST_USE_UNSTABLE_API \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \

View file

@ -30,11 +30,6 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_buffer_proxy_ref
#undef gst_vaapi_buffer_proxy_unref
#undef gst_vaapi_buffer_proxy_replace
guint
from_GstVaapiBufferMemoryType (guint type)
{
@ -185,7 +180,7 @@ gst_vaapi_buffer_proxy_new (guintptr handle, guint type, gsize size,
error_unsupported_mem_type:
{
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
gst_vaapi_buffer_proxy_unref (proxy);
return NULL;
}
#else
@ -225,13 +220,13 @@ gst_vaapi_buffer_proxy_new_from_object (GstVaapiObject * object,
error_unsupported_mem_type:
{
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref_internal (proxy);
gst_vaapi_buffer_proxy_unref (proxy);
return NULL;
}
error_acquire_handle:
{
GST_ERROR ("failed to acquire the underlying VA buffer handle");
gst_vaapi_buffer_proxy_unref_internal (proxy);
gst_vaapi_buffer_proxy_unref (proxy);
return NULL;
}
#else
@ -252,7 +247,8 @@ gst_vaapi_buffer_proxy_ref (GstVaapiBufferProxy * proxy)
{
g_return_val_if_fail (proxy != NULL, NULL);
return gst_vaapi_buffer_proxy_ref_internal (proxy);
return (GstVaapiBufferProxy *)
gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (proxy));
}
/**
@ -267,7 +263,7 @@ gst_vaapi_buffer_proxy_unref (GstVaapiBufferProxy * proxy)
{
g_return_if_fail (proxy != NULL);
gst_vaapi_buffer_proxy_unref_internal (proxy);
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (proxy));
}
/**
@ -285,7 +281,8 @@ gst_vaapi_buffer_proxy_replace (GstVaapiBufferProxy ** old_proxy_ptr,
{
g_return_if_fail (old_proxy_ptr != NULL);
gst_vaapi_buffer_proxy_replace_internal (old_proxy_ptr, new_proxy);
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) (old_proxy_ptr),
GST_VAAPI_MINI_OBJECT (new_proxy));
}
/**

View file

@ -87,31 +87,6 @@ G_GNUC_INTERNAL
guint
to_GstVaapiBufferMemoryType (guint va_type);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
#define gst_vaapi_buffer_proxy_ref_internal(proxy) \
((gpointer) gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (proxy)))
#define gst_vaapi_buffer_proxy_unref_internal(proxy) \
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (proxy))
#define gst_vaapi_buffer_proxy_replace_internal(old_proxy_ptr, new_proxy) \
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **)(old_proxy_ptr), \
GST_VAAPI_MINI_OBJECT (new_proxy))
#undef gst_vaapi_buffer_proxy_ref
#define gst_vaapi_buffer_proxy_ref(proxy) \
gst_vaapi_buffer_proxy_ref_internal ((proxy))
#undef gst_vaapi_buffer_proxy_unref
#define gst_vaapi_buffer_proxy_unref(proxy) \
gst_vaapi_buffer_proxy_unref_internal ((proxy))
#undef gst_vaapi_buffer_proxy_replace
#define gst_vaapi_buffer_proxy_replace(old_proxy_ptr, new_proxy) \
gst_vaapi_buffer_proxy_replace_internal ((old_proxy_ptr), (new_proxy))
#endif
G_END_DECLS
#endif /* GST_VAAPI_BUFFER_PROXY_PRIV_H */

View file

@ -23,12 +23,7 @@
#include <string.h>
#include "gstvaapiminiobject.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_mini_object_ref
#undef gst_vaapi_mini_object_unref
#undef gst_vaapi_mini_object_replace
void
static void
gst_vaapi_mini_object_free (GstVaapiMiniObject * object)
{
const GstVaapiMiniObjectClass *const klass = object->object_class;
@ -108,6 +103,22 @@ gst_vaapi_mini_object_new0 (const GstVaapiMiniObjectClass * object_class)
return object;
}
/**
* gst_vaapi_mini_object_ref_internal:
* @object: a #GstVaapiMiniObject
*
* Atomically increases the reference count of the given @object by one.
* This is an internal function that does not do any run-time type check.
*
* Returns: The same @object argument
*/
static inline GstVaapiMiniObject *
gst_vaapi_mini_object_ref_internal (GstVaapiMiniObject * object)
{
g_atomic_int_inc (&object->ref_count);
return object;
}
/**
* gst_vaapi_mini_object_ref:
* @object: a #GstVaapiMiniObject
@ -124,6 +135,22 @@ gst_vaapi_mini_object_ref (GstVaapiMiniObject * object)
return gst_vaapi_mini_object_ref_internal (object);
}
/**
* gst_vaapi_mini_object_unref_internal:
* @object: a #GstVaapiMiniObject
*
* Atomically decreases the reference count of the @object by one. If
* the reference count reaches zero, the object will be free'd.
*
* This is an internal function that does not do any run-time type check.
*/
static inline void
gst_vaapi_mini_object_unref_internal (GstVaapiMiniObject * object)
{
if (g_atomic_int_dec_and_test (&object->ref_count))
gst_vaapi_mini_object_free (object);
}
/**
* gst_vaapi_mini_object_unref:
* @object: a #GstVaapiMiniObject

View file

@ -157,52 +157,6 @@ void
gst_vaapi_mini_object_replace (GstVaapiMiniObject ** old_object_ptr,
GstVaapiMiniObject * new_object);
#ifdef IN_LIBGSTVAAPI_CORE
#undef gst_vaapi_mini_object_ref
#define gst_vaapi_mini_object_ref(object) \
gst_vaapi_mini_object_ref_internal (object)
#undef gst_vaapi_mini_object_unref
#define gst_vaapi_mini_object_unref(object) \
gst_vaapi_mini_object_unref_internal (object)
G_GNUC_INTERNAL
void
gst_vaapi_mini_object_free (GstVaapiMiniObject * object);
/**
* gst_vaapi_mini_object_ref_internal:
* @object: a #GstVaapiMiniObject
*
* Atomically increases the reference count of the given @object by one.
* This is an internal function that does not do any run-time type check.
*
* Returns: The same @object argument
*/
static inline GstVaapiMiniObject *
gst_vaapi_mini_object_ref_internal (GstVaapiMiniObject * object)
{
g_atomic_int_inc (&object->ref_count);
return object;
}
/**
* gst_vaapi_mini_object_unref_internal:
* @object: a #GstVaapiMiniObject
*
* Atomically decreases the reference count of the @object by one. If
* the reference count reaches zero, the object will be free'd.
*
* This is an internal function that does not do any run-time type check.
*/
static inline void
gst_vaapi_mini_object_unref_internal (GstVaapiMiniObject * object)
{
if (g_atomic_int_dec_and_test (&object->ref_count))
gst_vaapi_mini_object_free (object);
}
#endif
G_END_DECLS
#endif /* GST_VAAPI_MINI_OBJECT_H */

View file

@ -36,11 +36,6 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_object_ref
#undef gst_vaapi_object_unref
#undef gst_vaapi_object_replace
static void
gst_vaapi_object_finalize (GstVaapiObject * object)
{
@ -114,7 +109,7 @@ gst_vaapi_object_new (const GstVaapiObjectClass * klass,
gpointer
gst_vaapi_object_ref (gpointer object)
{
return gst_vaapi_object_ref_internal (object);
return gst_vaapi_mini_object_ref (object);
}
/**
@ -127,7 +122,7 @@ gst_vaapi_object_ref (gpointer object)
void
gst_vaapi_object_unref (gpointer object)
{
gst_vaapi_object_unref_internal (object);
gst_vaapi_mini_object_unref (object);
}
/**
@ -142,7 +137,8 @@ gst_vaapi_object_unref (gpointer object)
void
gst_vaapi_object_replace (gpointer old_object_ptr, gpointer new_object)
{
gst_vaapi_object_replace_internal (old_object_ptr, new_object);
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) old_object_ptr,
new_object);
}
/**

View file

@ -195,40 +195,6 @@ gpointer
gst_vaapi_object_new (const GstVaapiObjectClass * klass,
GstVaapiDisplay * display);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
static inline gpointer
gst_vaapi_object_ref_internal (gpointer object)
{
return gst_vaapi_mini_object_ref (object);
}
static inline void
gst_vaapi_object_unref_internal (gpointer object)
{
gst_vaapi_mini_object_unref (object);
}
static inline void
gst_vaapi_object_replace_internal (gpointer old_object_ptr, gpointer new_object)
{
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) old_object_ptr,
new_object);
}
#undef gst_vaapi_object_ref
#define gst_vaapi_object_ref(object) \
gst_vaapi_object_ref_internal ((object))
#undef gst_vaapi_object_unref
#define gst_vaapi_object_unref(object) \
gst_vaapi_object_unref_internal ((object))
#undef gst_vaapi_object_replace
#define gst_vaapi_object_replace(old_object_ptr, new_object) \
gst_vaapi_object_replace_internal ((old_object_ptr), (new_object))
#endif
G_END_DECLS
#endif /* GST_VAAPI_OBJECT_PRIV_H */

View file

@ -33,11 +33,6 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_pixmap_ref
#undef gst_vaapi_pixmap_unref
#undef gst_vaapi_pixmap_replace
static inline GstVaapiPixmap *
gst_vaapi_pixmap_new_internal (const GstVaapiPixmapClass * pixmap_class,
GstVaapiDisplay * display)
@ -73,7 +68,7 @@ gst_vaapi_pixmap_new (const GstVaapiPixmapClass * pixmap_class,
/* ERRORS */
error:
{
gst_vaapi_pixmap_unref_internal (pixmap);
gst_vaapi_pixmap_unref (pixmap);
return NULL;
}
}
@ -97,7 +92,7 @@ gst_vaapi_pixmap_new_from_native (const GstVaapiPixmapClass * pixmap_class,
/* ERRORS */
error:
{
gst_vaapi_pixmap_unref_internal (pixmap);
gst_vaapi_pixmap_unref (pixmap);
return NULL;
}
}
@ -113,7 +108,7 @@ error:
GstVaapiPixmap *
gst_vaapi_pixmap_ref (GstVaapiPixmap * pixmap)
{
return gst_vaapi_pixmap_ref_internal (pixmap);
return gst_vaapi_object_ref (GST_VAAPI_OBJECT (pixmap));
}
/**
@ -126,7 +121,7 @@ gst_vaapi_pixmap_ref (GstVaapiPixmap * pixmap)
void
gst_vaapi_pixmap_unref (GstVaapiPixmap * pixmap)
{
gst_vaapi_pixmap_unref_internal (pixmap);
gst_vaapi_object_unref (GST_VAAPI_OBJECT (pixmap));
}
/**
@ -142,7 +137,8 @@ void
gst_vaapi_pixmap_replace (GstVaapiPixmap ** old_pixmap_ptr,
GstVaapiPixmap * new_pixmap)
{
gst_vaapi_pixmap_replace_internal (old_pixmap_ptr, new_pixmap);
gst_vaapi_object_replace ((GstVaapiObject **) (old_pixmap_ptr),
GST_VAAPI_OBJECT (new_pixmap));
}
/**

View file

@ -108,31 +108,6 @@ GstVaapiPixmap *
gst_vaapi_pixmap_new_from_native(const GstVaapiPixmapClass *pixmap_class,
GstVaapiDisplay *display, gpointer native_pixmap);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
#define gst_vaapi_pixmap_ref_internal(pixmap) \
((gpointer)gst_vaapi_object_ref(GST_VAAPI_OBJECT(pixmap)))
#define gst_vaapi_pixmap_unref_internal(pixmap) \
gst_vaapi_object_unref(GST_VAAPI_OBJECT(pixmap))
#define gst_vaapi_pixmap_replace_internal(old_pixmap_ptr, new_pixmap) \
gst_vaapi_object_replace((GstVaapiObject **)(old_pixmap_ptr), \
GST_VAAPI_OBJECT(new_pixmap))
#undef gst_vaapi_pixmap_ref
#define gst_vaapi_pixmap_ref(pixmap) \
gst_vaapi_pixmap_ref_internal((pixmap))
#undef gst_vaapi_pixmap_unref
#define gst_vaapi_pixmap_unref(pixmap) \
gst_vaapi_pixmap_unref_internal((pixmap))
#undef gst_vaapi_pixmap_replace
#define gst_vaapi_pixmap_replace(old_pixmap_ptr, new_pixmap) \
gst_vaapi_pixmap_replace_internal((old_pixmap_ptr), (new_pixmap))
#endif
G_END_DECLS
#endif /* GST_VAAPI_PIXMAP_PRIV_H */

View file

@ -34,11 +34,6 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_texture_ref
#undef gst_vaapi_texture_unref
#undef gst_vaapi_texture_replace
#define GST_VAAPI_TEXTURE_ORIENTATION_FLAGS \
(GST_VAAPI_TEXTURE_ORIENTATION_FLAG_X_INVERTED | \
GST_VAAPI_TEXTURE_ORIENTATION_FLAG_Y_INVERTED)
@ -171,7 +166,7 @@ gst_vaapi_texture_new_wrapped (GstVaapiDisplay * display, guint id,
GstVaapiTexture *
gst_vaapi_texture_ref (GstVaapiTexture * texture)
{
return gst_vaapi_texture_ref_internal (texture);
return gst_vaapi_object_ref (GST_VAAPI_OBJECT (texture));
}
/**
@ -184,7 +179,7 @@ gst_vaapi_texture_ref (GstVaapiTexture * texture)
void
gst_vaapi_texture_unref (GstVaapiTexture * texture)
{
gst_vaapi_texture_unref_internal (texture);
gst_vaapi_object_unref (GST_VAAPI_OBJECT (texture));
}
/**
@ -200,7 +195,8 @@ void
gst_vaapi_texture_replace (GstVaapiTexture ** old_texture_ptr,
GstVaapiTexture * new_texture)
{
gst_vaapi_texture_replace_internal (old_texture_ptr, new_texture);
gst_vaapi_object_replace ((GstVaapiObject **) (old_texture_ptr),
GST_VAAPI_OBJECT (new_texture));
}
/**

View file

@ -135,31 +135,6 @@ gst_vaapi_texture_new_internal (const GstVaapiTextureClass * klass,
GstVaapiDisplay * display, GstVaapiID id, guint target, guint format,
guint width, guint height);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
#define gst_vaapi_texture_ref_internal(texture) \
((gpointer)gst_vaapi_object_ref (GST_VAAPI_OBJECT (texture)))
#define gst_vaapi_texture_unref_internal(texture) \
gst_vaapi_object_unref (GST_VAAPI_OBJECT (texture))
#define gst_vaapi_texture_replace_internal(old_texture_ptr, new_texture) \
gst_vaapi_object_replace ((GstVaapiObject **)(old_texture_ptr), \
GST_VAAPI_OBJECT (new_texture))
#undef gst_vaapi_texture_ref
#define gst_vaapi_texture_ref(texture) \
gst_vaapi_texture_ref_internal ((texture))
#undef gst_vaapi_texture_unref
#define gst_vaapi_texture_unref(texture) \
gst_vaapi_texture_unref_internal ((texture))
#undef gst_vaapi_texture_replace
#define gst_vaapi_texture_replace(old_texture_ptr, new_texture) \
gst_vaapi_texture_replace_internal ((old_texture_ptr), (new_texture))
#endif
G_END_DECLS
#endif /* GST_VAAPI_TEXTURE_PRIV_H */

View file

@ -36,11 +36,6 @@
#define DEBUG 1
#include "gstvaapidebug.h"
/* Ensure those symbols are actually defined in the resulting libraries */
#undef gst_vaapi_window_ref
#undef gst_vaapi_window_unref
#undef gst_vaapi_window_replace
static void
gst_vaapi_window_ensure_size (GstVaapiWindow * window)
{
@ -175,7 +170,7 @@ gst_vaapi_window_new_internal (const GstVaapiWindowClass * window_class,
/* ERRORS */
error:
{
gst_vaapi_window_unref_internal (window);
gst_vaapi_window_unref (window);
return NULL;
}
}
@ -259,7 +254,7 @@ gst_vaapi_window_new (GstVaapiDisplay * display, guint width, guint height)
GstVaapiWindow *
gst_vaapi_window_ref (GstVaapiWindow * window)
{
return gst_vaapi_window_ref_internal (window);
return (GstVaapiWindow *) gst_vaapi_object_ref (GST_VAAPI_OBJECT (window));
}
/**
@ -272,7 +267,7 @@ gst_vaapi_window_ref (GstVaapiWindow * window)
void
gst_vaapi_window_unref (GstVaapiWindow * window)
{
gst_vaapi_window_unref_internal (window);
gst_vaapi_object_unref (GST_VAAPI_OBJECT (window));
}
/**
@ -288,7 +283,8 @@ void
gst_vaapi_window_replace (GstVaapiWindow ** old_window_ptr,
GstVaapiWindow * new_window)
{
gst_vaapi_window_replace_internal (old_window_ptr, new_window);
gst_vaapi_object_replace ((GstVaapiObject **) (old_window_ptr),
GST_VAAPI_OBJECT (new_window));
}
/**

View file

@ -135,31 +135,6 @@ gst_vaapi_window_vpp_convert_internal (GstVaapiWindow * window,
void
gst_vaapi_window_class_init (GstVaapiWindowClass * klass);
/* Inline reference counting for core libgstvaapi library */
#ifdef IN_LIBGSTVAAPI_CORE
#define gst_vaapi_window_ref_internal(window) \
((gpointer)gst_vaapi_object_ref(GST_VAAPI_OBJECT(window)))
#define gst_vaapi_window_unref_internal(window) \
gst_vaapi_object_unref(GST_VAAPI_OBJECT(window))
#define gst_vaapi_window_replace_internal(old_window_ptr, new_window) \
gst_vaapi_object_replace((GstVaapiObject **)(old_window_ptr), \
GST_VAAPI_OBJECT(new_window))
#undef gst_vaapi_window_ref
#define gst_vaapi_window_ref(window) \
gst_vaapi_window_ref_internal((window))
#undef gst_vaapi_window_unref
#define gst_vaapi_window_unref(window) \
gst_vaapi_window_unref_internal((window))
#undef gst_vaapi_window_replace
#define gst_vaapi_window_replace(old_window_ptr, new_window) \
gst_vaapi_window_replace_internal((old_window_ptr), (new_window))
#endif
G_END_DECLS
#endif /* GST_VAAPI_WINDOW_PRIV_H */

View file

@ -221,7 +221,7 @@ endif
gstlibvaapi = static_library('gstlibvaapi-@0@'.format(api_version),
gstlibvaapi_sources,
c_args : gstreamer_vaapi_args + ['-DIN_LIBGSTVAAPI_CORE', '-DGST_USE_UNSTABLE_API', '-DGST_VAAPI_VERSION_ID="@0@"'.format(gst_version)],
c_args : gstreamer_vaapi_args + [ '-DGST_USE_UNSTABLE_API', '-DGST_VAAPI_VERSION_ID="@0@"'.format(gst_version)],
include_directories: [configinc, libsinc],
dependencies : gstlibvaapi_deps,
)