Merge remote-tracking branch 'origin/master' into 0.11

Conflicts:
	ext/alsa/gstalsadeviceprobe.c
	ext/alsa/gstalsamixer.c
	ext/pango/gsttextoverlay.c
	ext/pango/gsttextoverlay.h
	gst-libs/gst/audio/gstaudiobasesink.c
	gst-libs/gst/audio/gstaudioringbuffer.c
	gst-libs/gst/audio/gstaudiosrc.c
	gst-libs/gst/video/Makefile.am
	gst-libs/gst/video/video.c
	gst/encoding/gststreamcombiner.c
	gst/encoding/gststreamsplitter.c
	gst/playback/gstplaybasebin.c
	gst/playback/gststreamsynchronizer.c
	gst/playback/gstsubtitleoverlay.c
	gst/playback/gsturidecodebin.c
	sys/xvimage/xvimagesink.c
	tests/examples/Makefile.am
	win32/common/libgstvideo.def

Video overlay composition disabled for now, needs
porting to buffer meta.
This commit is contained in:
Tim-Philipp Müller 2011-12-08 01:19:03 +00:00
commit fb6d09055a
58 changed files with 10447 additions and 210 deletions

View file

@ -185,7 +185,7 @@ CPPFLAGS="$ac_cppflags_save"
AM_CONDITIONAL(HAVE_LIBXML_HTML, test "x$HAVE_LIBXML_HTML" = "xyes")
dnl used in gst/tcp
AC_CHECK_HEADERS([sys/socket.h],
AC_CHECK_HEADERS([sys/socket.h],
HAVE_SYS_SOCKET_H="yes", HAVE_SYS_SOCKET_H="no")
AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes")
@ -537,7 +537,7 @@ AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
CFLAGS="$ac_cflags_save"
CPPFLAGS="$ac_cppflags_save"
])
dnl Check for Xv extension
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
@ -549,24 +549,24 @@ dnl check for X Shm
translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
AG_GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], , [
if test x$HAVE_X = xyes; then
AC_CHECK_LIB(Xext, XShmAttach,
AC_CHECK_LIB(Xext, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
$X_LIBS)
$X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext"
else
dnl On AIX, it is in XextSam instead, but we still need -lXext
AC_CHECK_LIB(XextSam, XShmAttach,
AC_CHECK_LIB(XextSam, XShmAttach,
HAVE_XSHM="yes", HAVE_XSHM="no",
$X_LIBS)
$X_LIBS)
if test "x$HAVE_XSHM" = "xyes"; then
XSHM_LIBS="-lXext -lXextSam"
fi
fi
fi
], , [
AC_SUBST(HAVE_XSHM)
AC_SUBST(XSHM_LIBS)
], , [
AC_SUBST(HAVE_XSHM)
AC_SUBST(XSHM_LIBS)
])
dnl *** ext plug-ins ***
@ -597,17 +597,17 @@ AG_GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
PKG_CHECK_MODULES(CDPARANOIA, cdparanoia-3 >= 10.2, [
HAVE_CDPARANOIA="yes"
], [
AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
cdda_open, -lm,
cdda_interface.h,
AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
cdda_open, -lm,
cdda_interface.h,
CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
HEADER_DIR="no"
FOUND_CDPARANOIA="yes")
if test "x$FOUND_CDPARANOIA" != "xyes";
then
AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
cdda_open, -lm,
cdda/cdda_interface.h,
AG_GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface,
cdda_open, -lm,
cdda/cdda_interface.h,
CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
HEADER_DIR="yes"
FOUND_CDPARANOIA="yes")
@ -934,6 +934,7 @@ tests/examples/app/Makefile
tests/examples/audio/Makefile
tests/examples/dynamic/Makefile
tests/examples/encoding/Makefile
tests/examples/fft/Makefile
tests/examples/gio/Makefile
tests/examples/overlay/Makefile
tests/examples/seek/Makefile

View file

@ -195,6 +195,7 @@
<filename>-lgstvideo-&GST_MAJORMINOR;</filename> to the library flags.
</para>
<xi:include href="xml/gstvideo.xml" />
<xi:include href="xml/gstvideooverlaycomposition.xml" />
<xi:include href="xml/gstvideofilter.xml" />
<xi:include href="xml/gstvideosink.xml" />
</chapter>

View file

@ -2117,6 +2117,56 @@ gst_video_format_get_type
GST_TYPE_VIDEO_FORMAT
</SECTION>
<SECTION>
<FILE>gstvideooverlaycomposition</FILE>
<INCLUDE>gst/video/video-overlay-composition.h</INCLUDE>
<SUBSECTION composition>
GstVideoOverlayComposition
GstVideoOverlayCompositionClass
gst_video_overlay_composition_new
gst_video_overlay_composition_ref
gst_video_overlay_composition_unref
gst_video_overlay_composition_add_rectangle
gst_video_overlay_composition_n_rectangles
gst_video_overlay_composition_get_rectangle
gst_video_overlay_composition_get_seqnum
gst_video_overlay_composition_copy
gst_video_overlay_composition_make_writable
gst_video_overlay_composition_blend
<SUBSECTION composition-set-get>
gst_video_buffer_get_overlay_composition
gst_video_buffer_set_overlay_composition
<SUBSECTION rectangle>
GstVideoOverlayFormatFlags
GstVideoOverlayRectangle
GstVideoOverlayRectangleClass
gst_video_overlay_rectangle_new_argb
gst_video_overlay_rectangle_ref
gst_video_overlay_rectangle_unref
gst_video_overlay_rectangle_get_pixels_argb
gst_video_overlay_rectangle_get_pixels_unscaled_argb
gst_video_overlay_rectangle_get_render_rectangle
gst_video_overlay_rectangle_get_seqnum
gst_video_overlay_rectangle_set_render_rectangle
gst_video_overlay_rectangle_copy
<SUBSECTION Standard>
GST_TYPE_VIDEO_OVERLAY_COMPOSITION
GST_VIDEO_OVERLAY_COMPOSITION
GST_VIDEO_OVERLAY_COMPOSITION_CLASS
GST_VIDEO_OVERLAY_COMPOSITION_GET_CLASS
GST_IS_VIDEO_OVERLAY_COMPOSITION
GST_IS_VIDEO_VIDEO_OVERLAY_COMPOSITION_CLASS
gst_video_overlay_composition_get_type
GST_TYPE_VIDEO_OVERLAY_RECTANGLE
GST_VIDEO_OVERLAY_RECTANGLE
GST_VIDEO_OVERLAY_RECTANGLE_CLASS
GST_VIDEO_OVERLAY_RECTANGLE_GET_CLASS
GST_IS_VIDEO_OVERLAY_RECTANGLE
GST_IS_VIDEO_VIDEO_OVERLAY_RECTANGLE_CLASS
gst_video_overlay_rectangle_get_type
</SECTION>
<SECTION>
<FILE>gstvideofilter</FILE>
<INCLUDE>gst/video/gstvideofilter.h</INCLUDE>

View file

@ -34,7 +34,12 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstalsamixer.h"
#include "gst/glib-compat-private.h"
#include <errno.h>
static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
@ -130,14 +135,14 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
count = snd_mixer_get_count (handle);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
/* Check if we have a playback mixer labelled as 'Master' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -148,7 +153,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -159,7 +164,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -170,7 +175,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Speaker") == 0) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -183,7 +188,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element) &&
!snd_mixer_selem_is_playback_mono (element)) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -194,7 +199,7 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element)) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
@ -204,13 +209,13 @@ gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element)) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
/* Looks like we're out of luck ... */
return NULL;
}
@ -222,7 +227,7 @@ gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
g_return_if_fail (mixer != NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
for (item = mixer->tracklist; item != NULL; item = item->next) {
if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
@ -238,7 +243,7 @@ gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
}
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
static int
@ -287,7 +292,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
if (mixer->tracklist)
return;
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
master = gst_alsa_mixer_find_master_mixer (mixer, mixer->handle);
@ -409,7 +414,7 @@ gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
snd_mixer_elem_set_callback_private (temp, mixer);
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
static void
@ -421,13 +426,13 @@ task_monitor_alsa (gpointer data)
GstAlsaMixer *mixer = (GstAlsaMixer *) data;
gint ret;
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
nfds = snd_mixer_poll_descriptors_count (mixer->handle);
if (nfds <= 0) {
GST_ERROR ("snd_mixer_poll_descriptors_count <= 0: %d", nfds);
/* FIXME: sleep ? stop monitoring ? */
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@ -439,7 +444,7 @@ task_monitor_alsa (gpointer data)
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), ("alsa error: %s",
snd_strerror (rnfds)));
gst_task_pause (mixer->task);
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@ -447,7 +452,7 @@ task_monitor_alsa (gpointer data)
pfds[rnfds].events = POLLIN | POLLPRI | POLLHUP | POLLERR;
pfds[rnfds].revents = 0;
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
GST_LOG ("task loop");
ret = poll (pfds, rnfds + 1, -1);
@ -458,7 +463,7 @@ task_monitor_alsa (gpointer data)
return;
}
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
ret =
snd_mixer_poll_descriptors_revents (mixer->handle, pfds, nfds, &revents);
@ -474,7 +479,7 @@ task_monitor_alsa (gpointer data)
gst_task_pause (mixer->task);
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
/* API */
@ -491,14 +496,15 @@ gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir)
if (pipe (ret->pfd) == -1)
goto error;
ret->rec_mutex = g_new (GStaticRecMutex, 1);
g_static_rec_mutex_init (ret->rec_mutex);
ret->task_mutex = g_new (GStaticRecMutex, 1);
g_static_rec_mutex_init (ret->task_mutex);
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_rec_mutex_init (&ret->rec_mutex);
#else
g_rec_mutex_init (&ret->rec_mutex);
#endif
g_static_rec_mutex_init (&ret->task_mutex);
ret->task = gst_task_new (task_monitor_alsa, ret);
gst_task_set_lock (ret->task, ret->task_mutex);
gst_task_set_lock (ret->task, &ret->task_mutex);
ret->device = g_strdup (device);
ret->dir = dir;
@ -540,9 +546,7 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer)
mixer->task = NULL;
}
g_static_rec_mutex_free (mixer->task_mutex);
g_free (mixer->task_mutex);
mixer->task_mutex = NULL;
g_static_rec_mutex_free (&mixer->task_mutex);
if (mixer->pfd[0] > 0) {
close (mixer->pfd[0]);
@ -579,10 +583,11 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer)
snd_mixer_close (mixer->handle);
mixer->handle = NULL;
}
g_static_rec_mutex_free (mixer->rec_mutex);
g_free (mixer->rec_mutex);
mixer->rec_mutex = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_rec_mutex_free (&mixer->rec_mutex);
#else
g_rec_mutex_clear (&mixer->rec_mutex);
#endif
g_free (mixer);
}
@ -606,7 +611,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
@ -642,7 +647,7 @@ gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
volumes[i] = alsa_track->volumes[i];
}
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
static gboolean
@ -670,7 +675,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
@ -718,7 +723,7 @@ gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
alsa_track->volumes[i] = volumes[i];
}
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@ -729,12 +734,12 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
g_return_if_fail (mixer->handle != NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(mute) == ! !(track->flags & GST_MIXER_TRACK_MUTE)) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
if (mute) {
@ -765,12 +770,12 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) {
long vol =
mute ? ((GstMixerTrack *) ctrl_track)->
min_volume : ctrl_track->volumes[i];
mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track->
volumes[i];
snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
}
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@ -781,12 +786,12 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
g_return_if_fail (mixer->handle != NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(record) == ! !(track->flags & GST_MIXER_TRACK_RECORD)) {
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
@ -826,7 +831,7 @@ gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
}
}
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
@ -848,9 +853,9 @@ gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
if (idx == -1)
return;
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
}
const gchar *
@ -861,9 +866,9 @@ gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
g_return_val_if_fail (mixer->handle != NULL, NULL);
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0)
return g_list_nth_data (opts->values, idx);
else
@ -890,9 +895,9 @@ gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
GST_WARNING ("Cannot send update notifications, no GstMixer * given");
return;
}
g_static_rec_mutex_lock (mixer->rec_mutex);
GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
g_static_rec_mutex_unlock (mixer->rec_mutex);
GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0) {
option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx);
gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts),

View file

@ -53,8 +53,13 @@ struct _GstAlsaMixer
snd_mixer_t * handle;
GstTask * task;
GStaticRecMutex * task_mutex;
GStaticRecMutex * rec_mutex;
GStaticRecMutex task_mutex;
#if !GLIB_CHECK_VERSION (2, 31, 0)
GStaticRecMutex rec_mutex;
#else
GRecMutex rec_mutex;
#endif
int pfd[2];
@ -65,6 +70,13 @@ struct _GstAlsaMixer
GstAlsaMixerDirection dir;
};
#if !GLIB_CHECK_VERSION (2, 31, 0)
#define GST_ALSA_MIXER_LOCK(mixer) g_static_rec_mutex_lock (&mixer->rec_mutex)
#define GST_ALSA_MIXER_UNLOCK(mixer) g_static_rec_mutex_unlock (&mixer->rec_mutex)
#else
#define GST_ALSA_MIXER_LOCK(mixer) g_rec_mutex_lock (&mixer->rec_mutex)
#define GST_ALSA_MIXER_UNLOCK(mixer) g_rec_mutex_unlock (&mixer->rec_mutex)
#endif
GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
GstAlsaMixerDirection dir);

View file

@ -52,6 +52,7 @@
#include "gstalsadeviceprobe.h"
#include <gst/gst-i18n-plugin.h>
#include "gst/glib-compat-private.h"
#define DEFAULT_DEVICE "default"
#define DEFAULT_DEVICE_NAME ""

View file

@ -48,6 +48,7 @@
#include "gstalsasrc.h"
#include "gstalsadeviceprobe.h"
#include "gst/glib-compat-private.h"
#include <gst/gst-i18n-plugin.h>

View file

@ -39,12 +39,19 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include <gst/gst-i18n-plugin.h>
#include <gst/tag/tag.h>
#include "gstoggdemux.h"
#include "gst/glib-compat-private.h"
#define CHUNKSIZE (8500) /* this is out of vorbisfile */
/* we hope we get a granpos within this many bytes off the end */

View file

@ -14,7 +14,7 @@ SUBDIRS = \
riff \
app
noinst_HEADERS = gettext.h gst-i18n-plugin.h
noinst_HEADERS = gettext.h gst-i18n-plugin.h glib-compat-private.h
# dependencies:
audio: interfaces tag

View file

@ -76,6 +76,8 @@
#include "gstapp-marshal.h"
#include "gstappsink.h"
#include "gst/glib-compat-private.h"
struct _GstAppSinkPrivate
{
GstCaps *caps;

View file

@ -102,6 +102,8 @@
#include "gstapp-marshal.h"
#include "gstappsrc.h"
#include "gst/glib-compat-private.h"
struct _GstAppSrcPrivate
{
GCond *cond;

View file

@ -34,6 +34,9 @@
#include <string.h>
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstaudiobasesink.h"
GST_DEBUG_CATEGORY_STATIC (gst_audio_base_sink_debug);

View file

@ -149,6 +149,10 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstaudiodecoder.h"
#include <gst/pbutils/descriptions.h>

View file

@ -151,6 +151,10 @@
# include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstaudioencoder.h"
#include <gst/base/gstadapter.h>
#include <gst/audio/audio.h>

View file

@ -43,6 +43,8 @@
#include "gstaudioringbuffer.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_audio_ring_buffer_debug);
#define GST_CAT_DEFAULT gst_audio_ring_buffer_debug

View file

@ -71,6 +71,8 @@
#include "gstaudiosink.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
#define GST_CAT_DEFAULT gst_audio_sink_debug
@ -435,9 +437,16 @@ gst_audio_sink_ring_buffer_activate (GstAudioRingBuffer * buf, gboolean active)
abuf->running = TRUE;
GST_DEBUG_OBJECT (sink, "starting thread");
#if !GLIB_CHECK_VERSION (2, 31, 0)
sink->thread =
g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
&error);
#else
sink->thread = g_thread_try_new ("audiosink-ringbuffer",
(GThreadFunc) audioringbuffer_thread_func, buf, &error);
#endif
if (!sink->thread || error != NULL)
goto thread_failed;

View file

@ -71,6 +71,8 @@
#include "gstaudiosrc.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_audio_src_debug);
#define GST_CAT_DEFAULT gst_audio_src_debug
@ -395,10 +397,17 @@ gst_audio_src_ring_buffer_acquire (GstAudioRingBuffer * buf,
abuf = GST_AUDIO_SRC_RING_BUFFER (buf);
abuf->running = TRUE;
/* FIXME: handle thread creation failure */
#if !GLIB_CHECK_VERSION (2, 31, 0)
src->thread =
g_thread_create ((GThreadFunc) audioringbuffer_thread_func, buf, TRUE,
NULL);
GST_AUDIO_SRC_RING_BUFFER_WAIT (buf);
#else
src->thread = g_thread_try_new ("audiosrc-ringbuffer",
(GThreadFunc) audioringbuffer_thread_func, buf, NULL);
#endif
GST_AUDIO_RING_BUFFER_WAIT (buf);
return result;

View file

@ -0,0 +1,120 @@
/*
* glib-compat.c
* Functions copied from glib 2.10
*
* Copyright 2005 David Schleef <ds@schleef.org>
*/
#ifndef __GLIB_COMPAT_PRIVATE_H__
#define __GLIB_COMPAT_PRIVATE_H__
#include <glib.h>
G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2,25,0)
#if defined (_MSC_VER) && !defined(_WIN64)
typedef struct _stat32 GStatBuf;
#else
typedef struct stat GStatBuf;
#endif
#endif
#if GLIB_CHECK_VERSION(2,26,0)
#define GLIB_HAS_GDATETIME
#endif
/* See bug #651514 */
#if GLIB_CHECK_VERSION(2,29,5)
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_pointer_compare_and_exchange ((a),(b),(c))
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_int_compare_and_exchange ((a),(b),(c))
#else
#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c))
#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c))
#endif
/* See bug #651514 */
#if GLIB_CHECK_VERSION(2,29,5)
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b))
#else
#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b))
#endif
/* copies */
#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_mutex_new gst_g_mutex_new
static inline GMutex *
gst_g_mutex_new (void)
{
GMutex *mutex = g_slice_new (GMutex);
g_mutex_init (mutex);
return mutex;
}
#define g_mutex_free gst_g_mutex_free
static inline void
gst_g_mutex_free (GMutex *mutex)
{
g_mutex_clear (mutex);
g_slice_free (GMutex, mutex);
}
#define g_static_rec_mutex_init gst_g_static_rec_mutex_init
static inline void
gst_g_static_rec_mutex_init (GStaticRecMutex *mutex)
{
static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
*mutex = init_mutex;
}
#define g_cond_new gst_g_cond_new
static inline GCond *
gst_g_cond_new (void)
{
GCond *cond = g_slice_new (GCond);
g_cond_init (cond);
return cond;
}
#define g_cond_free gst_g_cond_free
static inline void
gst_g_cond_free (GCond *cond)
{
g_cond_clear (cond);
g_slice_free (GCond, cond);
}
#define g_cond_timed_wait gst_g_cond_timed_wait
static inline gboolean
gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
{
gint64 end_time;
if (abs_time == NULL) {
g_cond_wait (cond, mutex);
return TRUE;
}
end_time = abs_time->tv_sec;
end_time *= 1000000;
end_time += abs_time->tv_usec;
/* would be nice if we had clock_rtoffset, but that didn't seem to
* make it into the kernel yet...
*/
/* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
* g_get_real_time() are returning the same clock and we'd add ~0
*/
end_time += g_get_monotonic_time () - g_get_real_time ();
return g_cond_wait_until (cond, mutex, end_time);
}
#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
/* adaptations */
G_END_DECLS
#endif

View file

@ -50,6 +50,8 @@
#include "pbutils-marshal.h"
#include "pbutils-private.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (discoverer_debug);
#define GST_CAT_DEFAULT discoverer_debug

View file

@ -92,6 +92,8 @@
#include "gstrtspconnection.h"
#include "gst/glib-compat-private.h"
union gst_sockaddr
{
struct sockaddr sa;

View file

@ -47,9 +47,21 @@ static GQuark tag_xmp_writer_key;
typedef struct
{
GSList *schemas;
#if !GLIB_CHECK_VERSION (2, 31, 0)
GStaticMutex lock;
#else
GMutex lock;
#endif
} GstTagXmpWriterData;
#if !GLIB_CHECK_VERSION (2, 31, 0)
#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_static_mutex_lock(&data->lock)
#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_static_mutex_unlock(&data->lock)
#else
#define GST_TAG_XMP_WRITER_DATA_LOCK(data) g_mutex_lock(&data->lock)
#define GST_TAG_XMP_WRITER_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
#endif
GType
gst_tag_xmp_writer_get_type (void)
{
@ -116,8 +128,11 @@ gst_tag_xmp_writer_data_free (gpointer p)
}
g_slist_free (data->schemas);
}
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_free (&data->lock);
#else
g_mutex_clear (&data->lock);
#endif
g_slice_free (GstTagXmpWriterData, data);
}
@ -129,22 +144,37 @@ gst_tag_xmp_writer_get_data (GstTagXmpWriter * xmpconfig)
data = g_object_get_qdata (G_OBJECT (xmpconfig), tag_xmp_writer_key);
if (!data) {
/* make sure no other thread is creating a GstTagData at the same time */
#if !GLIB_CHECK_VERSION (2, 31, 0)
static GStaticMutex create_mutex = G_STATIC_MUTEX_INIT;
/* make sure no other thread is creating a GstTagXmpWriterData at the same time */
g_static_mutex_lock (&create_mutex);
#else
static GMutex create_mutex; /* no initialisation required */
g_mutex_lock (&create_mutex);
#endif
data = g_object_get_qdata (G_OBJECT (xmpconfig), tag_xmp_writer_key);
if (!data) {
data = g_slice_new (GstTagXmpWriterData);
g_static_mutex_init (&data->lock);
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_init (&data->lock);
#else
g_mutex_init (&data->lock);
#endif
data->schemas = NULL;
gst_tag_xmp_writer_data_add_all_schemas_unlocked (data);
g_object_set_qdata_full (G_OBJECT (xmpconfig), tag_xmp_writer_key, data,
gst_tag_xmp_writer_data_free);
}
#if !GLIB_CHECK_VERSION (2, 31, 0)
g_static_mutex_unlock (&create_mutex);
#else
g_mutex_unlock (&create_mutex);
#endif
}
return data;
@ -168,9 +198,9 @@ gst_tag_xmp_writer_add_all_schemas (GstTagXmpWriter * config)
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
gst_tag_xmp_writer_data_add_all_schemas_unlocked (data);
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@ -191,9 +221,9 @@ gst_tag_xmp_writer_add_schema (GstTagXmpWriter * config, const gchar * schema)
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
gst_tag_xmp_writer_data_add_schema_unlocked (data, schema);
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@ -217,14 +247,14 @@ gst_tag_xmp_writer_has_schema (GstTagXmpWriter * config, const gchar * schema)
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
if (strcmp ((const gchar *) iter->data, schema) == 0) {
ret = TRUE;
break;
}
}
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
return ret;
}
@ -250,7 +280,7 @@ gst_tag_xmp_writer_remove_schema (GstTagXmpWriter * config,
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
if (strcmp ((const gchar *) iter->data, schema) == 0) {
g_free (iter->data);
@ -258,7 +288,7 @@ gst_tag_xmp_writer_remove_schema (GstTagXmpWriter * config,
break;
}
}
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
/**
@ -280,7 +310,7 @@ gst_tag_xmp_writer_remove_all_schemas (GstTagXmpWriter * config)
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
if (data->schemas) {
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
g_free (iter->data);
@ -288,7 +318,7 @@ gst_tag_xmp_writer_remove_all_schemas (GstTagXmpWriter * config)
g_slist_free (data->schemas);
}
data->schemas = NULL;
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
}
GstBuffer *
@ -304,7 +334,7 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
data = gst_tag_xmp_writer_get_data (config);
g_static_mutex_lock (&data->lock);
GST_TAG_XMP_WRITER_DATA_LOCK (data);
if (data->schemas) {
gchar **array = g_new0 (gchar *, g_slist_length (data->schemas) + 1);
if (array) {
@ -316,7 +346,7 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
g_free (array);
}
}
g_static_mutex_unlock (&data->lock);
GST_TAG_XMP_WRITER_DATA_UNLOCK (data);
return buf;
}

View file

@ -1,2 +1,3 @@
video-enumtypes.c
video-enumtypes.h
videoblendorc.h

View file

@ -22,6 +22,8 @@
#include <string.h>
#include "video.h"
#include "gst/glib-compat-private.h"
static gboolean
caps_are_raw (const GstCaps * caps)
{

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
/* Gstreamer video blending utility functions
*
* Copyright (C) <2011> Intel Corporation
* Copyright (C) <2011> Collabora Ltd.
* Copyright (C) <2011> Thibault Saunier <thibault.saunier@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_VIDEO_BLEND__
#define __GST_VIDEO_BLEND__
#include <gst/gst.h>
#include <gst/video/video.h>
#define MAX_VIDEO_PLANES 4
typedef struct _GstBlendVideoFormatInfo GstBlendVideoFormatInfo;
/* GstBlendVideoFormatInfo:
* @fmt: The #GstVideoFormat describing the video format
* @width: The width of the video
* @height: The height of the video
* @pixels: The buffer containing the pixels of the video
* @size: The size in byte of @pixels
* @offset: The offsets of the different component of the video
* @stride: The stride of the different component of the video
*
* Information describing image properties containing necessary
* fields to do video blending.
*/
struct _GstBlendVideoFormatInfo
{
GstVideoFormat fmt;
gint width;
gint height;
guint8 * pixels;
gsize size;
/* YUV components: Y=0, U=1, V=2, A=3
* RGB components: R=0, G=1, B=2, A=3 */
gint offset[MAX_VIDEO_PLANES];
gint stride[MAX_VIDEO_PLANES];
};
void video_blend_format_info_init (GstBlendVideoFormatInfo * info,
guint8 *pixels, guint height,
guint width, GstVideoFormat fmt);
void video_blend_scale_linear_RGBA (GstBlendVideoFormatInfo * src,
gint dest_height, gint dest_width);
gboolean video_blend (GstBlendVideoFormatInfo * dest,
GstBlendVideoFormatInfo * src,
guint x, guint y);
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,235 @@
/* GStreamer Video Overlay Composition
* Copyright (C) 2011 Intel Corporation
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_VIDEO_OVERLAY_COMPOSITION_H__
#define __GST_VIDEO_OVERLAY_COMPOSITION_H__
#include <gst/gst.h>
#include <gst/video/video.h>
G_BEGIN_DECLS
/**
* GstVideoOverlayRectangle:
*
* An opaque video overlay rectangle object. A rectangle contains a single
* overlay rectangle which can be added to a composition.
*
* Since: 0.10.36
*/
#define GST_TYPE_VIDEO_OVERLAY_RECTANGLE \
(gst_video_overlay_rectangle_get_type ())
#define GST_VIDEO_OVERLAY_RECTANGLE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_OVERLAY_RECTANGLE, GstVideoOverlayRectangle))
#define GST_IS_VIDEO_OVERLAY_RECTANGLE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_OVERLAY_RECTANGLE))
typedef struct _GstVideoOverlayRectangle GstVideoOverlayRectangle;
typedef struct _GstVideoOverlayRectangleClass GstVideoOverlayRectangleClass;
/**
* gst_video_overlay_rectangle_ref:
* @comp: a a #GstVideoOverlayRectangle.
*
* Increases the refcount of the given rectangle by one.
*
* Note that the refcount affects the writeability
* of @comp, use gst_video_overlay_rectangle_copy() to ensure a rectangle can
* be modified (there is no gst_video_overlay_rectangle_make_writable() because
* it is unlikely that someone will hold the single reference to the rectangle
* and not know that that's the case).
*
* Returns: (transfer full): @comp
*
* Since: 0.10.36
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstVideoOverlayRectangle *
gst_video_overlay_rectangle_ref (GstVideoOverlayRectangle * comp);
#endif
static inline GstVideoOverlayRectangle *
gst_video_overlay_rectangle_ref (GstVideoOverlayRectangle * comp)
{
return (GstVideoOverlayRectangle *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
}
/**
* gst_video_overlay_rectangle_unref:
* @comp: (transfer full): a #GstVideoOverlayRectangle.
*
* Decreases the refcount of the rectangle. If the refcount reaches 0, the
* rectangle will be freed.
*
* Since: 0.10.36
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void
gst_video_overlay_rectangle_unref (GstVideoOverlayRectangle * comp);
#endif
static inline void
gst_video_overlay_rectangle_unref (GstVideoOverlayRectangle * comp)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
}
/**
* GstVideoOverlayFormatFlags:
* @GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE: no flags
*
* Overlay format flags.
*
* Since: 0.10.36
*/
typedef enum {
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE = 0
} GstVideoOverlayFormatFlags;
GType gst_video_overlay_rectangle_get_type (void);
GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer * pixels,
guint width, guint height, guint stride,
gint render_x, gint render_y,
guint render_width, guint render_height,
GstVideoOverlayFormatFlags flags);
GstVideoOverlayRectangle * gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle);
guint gst_video_overlay_rectangle_get_seqnum (GstVideoOverlayRectangle * rectangle);
void gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle,
gint render_x,
gint render_y,
guint render_width,
guint render_height);
gboolean gst_video_overlay_rectangle_get_render_rectangle (GstVideoOverlayRectangle * rectangle,
gint * render_x,
gint * render_y,
guint * render_width,
guint * render_height);
GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * rectangle,
guint * stride,
GstVideoOverlayFormatFlags flags);
GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle * rectangle,
guint * width,
guint * height,
guint * stride,
GstVideoOverlayFormatFlags flags);
/**
* GstVideoOverlayComposition:
*
* An opaque video overlay composition object. A composition contains
* multiple overlay rectangles.
*
* Since: 0.10.36
*/
#define GST_TYPE_VIDEO_OVERLAY_COMPOSITION \
(gst_video_overlay_composition_get_type ())
#define GST_VIDEO_OVERLAY_COMPOSITION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_OVERLAY_COMPOSITION, GstVideoOverlayComposition))
#define GST_IS_VIDEO_OVERLAY_COMPOSITION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_OVERLAY_COMPOSITION))
typedef struct _GstVideoOverlayComposition GstVideoOverlayComposition;
typedef struct _GstVideoOverlayCompositionClass GstVideoOverlayCompositionClass;
/**
* gst_video_overlay_composition_ref:
* @comp: a a #GstVideoOverlayComposition.
*
* Increases the refcount of the given composition by one.
*
* Note that the refcount affects the writeability
* of @comp, use gst_video_overlay_composition_make_writable() to ensure
* a composition and its rectangles can be modified.
*
* Returns: (transfer full): @comp
*
* Since: 0.10.36
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC GstVideoOverlayComposition *
gst_video_overlay_composition_ref (GstVideoOverlayComposition * comp);
#endif
static inline GstVideoOverlayComposition *
gst_video_overlay_composition_ref (GstVideoOverlayComposition * comp)
{
return (GstVideoOverlayComposition *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
}
/**
* gst_video_overlay_composition_unref:
* @comp: (transfer full): a #GstVideoOverlayComposition.
*
* Decreases the refcount of the composition. If the refcount reaches 0, the
* composition will be freed.
*
* Since: 0.10.36
*/
#ifdef _FOOL_GTK_DOC_
G_INLINE_FUNC void
gst_video_overlay_composition_unref (GstVideoOverlayComposition * comp);
#endif
static inline void
gst_video_overlay_composition_unref (GstVideoOverlayComposition * comp)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
}
GType gst_video_overlay_composition_get_type (void);
GstVideoOverlayComposition * gst_video_overlay_composition_copy (GstVideoOverlayComposition * comp);
GstVideoOverlayComposition * gst_video_overlay_composition_make_writable (GstVideoOverlayComposition * comp);
GstVideoOverlayComposition * gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle);
void gst_video_overlay_composition_add_rectangle (GstVideoOverlayComposition * comp,
GstVideoOverlayRectangle * rectangle);
guint gst_video_overlay_composition_n_rectangles (GstVideoOverlayComposition * comp);
GstVideoOverlayRectangle * gst_video_overlay_composition_get_rectangle (GstVideoOverlayComposition * comp, guint n);
guint gst_video_overlay_composition_get_seqnum (GstVideoOverlayComposition * comp);
/* blend composition onto raw video buffer */
gboolean gst_video_overlay_composition_blend (GstVideoOverlayComposition * comp,
GstBuffer * video_buf);
/* attach/retrieve composition from buffers */
void gst_video_buffer_set_overlay_composition (GstBuffer * buf,
GstVideoOverlayComposition * comp);
GstVideoOverlayComposition * gst_video_buffer_get_overlay_composition (GstBuffer * buf);
G_END_DECLS
#endif /* __GST_VIDEO_OVERLAY_COMPOSITION_H__ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,107 @@
/* autogenerated from videoblendorc.orc */
#ifndef _VIDEOBLENDORC_H_
#define _VIDEOBLENDORC_H_
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ORC_INTEGER_TYPEDEFS_
#define _ORC_INTEGER_TYPEDEFS_
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <stdint.h>
typedef int8_t orc_int8;
typedef int16_t orc_int16;
typedef int32_t orc_int32;
typedef int64_t orc_int64;
typedef uint8_t orc_uint8;
typedef uint16_t orc_uint16;
typedef uint32_t orc_uint32;
typedef uint64_t orc_uint64;
#define ORC_UINT64_C(x) UINT64_C(x)
#elif defined(_MSC_VER)
typedef signed __int8 orc_int8;
typedef signed __int16 orc_int16;
typedef signed __int32 orc_int32;
typedef signed __int64 orc_int64;
typedef unsigned __int8 orc_uint8;
typedef unsigned __int16 orc_uint16;
typedef unsigned __int32 orc_uint32;
typedef unsigned __int64 orc_uint64;
#define ORC_UINT64_C(x) (x##Ui64)
#define inline __inline
#else
#include <limits.h>
typedef signed char orc_int8;
typedef short orc_int16;
typedef int orc_int32;
typedef unsigned char orc_uint8;
typedef unsigned short orc_uint16;
typedef unsigned int orc_uint32;
#if INT_MAX == LONG_MAX
typedef long long orc_int64;
typedef unsigned long long orc_uint64;
#define ORC_UINT64_C(x) (x##ULL)
#else
typedef long orc_int64;
typedef unsigned long orc_uint64;
#define ORC_UINT64_C(x) (x##UL)
#endif
#endif
typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
#endif
#ifndef ORC_RESTRICT
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define ORC_RESTRICT restrict
#elif defined(__GNUC__) && __GNUC__ >= 4
#define ORC_RESTRICT __restrict__
#else
#define ORC_RESTRICT
#endif
#endif
void orc_blend_little (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void orc_blend_big (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n);
void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n);
void orc_resample_bilinear_u32 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int p1, int p2, int n);
void orc_merge_linear_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int n);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,498 @@
.function orc_blend_little
.flags 1d
.dest 4 d guint8
.source 4 s guint8
.temp 4 t
.temp 2 tw
.temp 1 tb
.temp 4 a
.temp 8 d_wide
.temp 8 s_wide
.temp 8 a_wide
.const 4 a_alpha 0x000000ff
loadl t, s
convlw tw, t
convwb tb, tw
splatbl a, tb
x4 convubw a_wide, a
x4 shruw a_wide, a_wide, 8
x4 convubw s_wide, t
loadl t, d
x4 convubw d_wide, t
x4 subw s_wide, s_wide, d_wide
x4 mullw s_wide, s_wide, a_wide
x4 div255w s_wide, s_wide
x4 addw d_wide, d_wide, s_wide
x4 convwb t, d_wide
orl t, t, a_alpha
storel d, t
.function orc_blend_big
.flags 1d
.dest 4 d guint8
.source 4 s guint8
.temp 4 t
.temp 4 t2
.temp 2 tw
.temp 1 tb
.temp 4 a
.temp 8 d_wide
.temp 8 s_wide
.temp 8 a_wide
.const 4 a_alpha 0xff000000
loadl t, s
shrul t2, t, 24
convlw tw, t2
convwb tb, tw
splatbl a, tb
x4 convubw a_wide, a
x4 shruw a_wide, a_wide, 8
x4 convubw s_wide, t
loadl t, d
x4 convubw d_wide, t
x4 subw s_wide, s_wide, d_wide
x4 mullw s_wide, s_wide, a_wide
x4 div255w s_wide, s_wide
x4 addw d_wide, d_wide, s_wide
x4 convwb t, d_wide
orl t, t, a_alpha
storel d, t
.function cogorc_getline_I420
.dest 4 d guint8
.source 1 y guint8
.source 1 u guint8
.source 1 v guint8
.const 1 c255 255
.temp 2 uv
.temp 2 ay
.temp 1 tu
.temp 1 tv
loadupdb tu, u
loadupdb tv, v
mergebw uv, tu, tv
mergebw ay, c255, y
mergewl d, ay, uv
.function cogorc_putline_I420
.dest 2 y guint8
.dest 1 u guint8
.dest 1 v guint8
.source 8 ayuv guint8
.temp 4 ay
.temp 4 uv
.temp 2 uu
.temp 2 vv
.temp 1 t1
.temp 1 t2
x2 splitlw uv, ay, ayuv
x2 select1wb y, ay
x2 splitwb vv, uu, uv
splitwb t1, t2, uu
avgub u, t1, t2
splitwb t1, t2, vv
avgub v, t1, t2
.function cogorc_getline_YUY2
.dest 8 ayuv guint8
.source 4 yuy2 guint8
.const 2 c255 0xff
.temp 2 yy
.temp 2 uv
.temp 4 ayay
.temp 4 uvuv
x2 splitwb uv, yy, yuy2
x2 mergebw ayay, c255, yy
mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv
.function cogorc_putline_YUY2
.dest 4 yuy2 guint8
.source 8 ayuv guint8
.temp 2 yy
.temp 2 uv1
.temp 2 uv2
.temp 4 ayay
.temp 4 uvuv
x2 splitlw uvuv, ayay, ayuv
splitlw uv1, uv2, uvuv
x2 avgub uv1, uv1, uv2
x2 select1wb yy, ayay
x2 mergebw yuy2, yy, uv1
.function cogorc_putline_UYVY
.dest 4 yuy2 guint8
.source 8 ayuv guint8
.temp 2 yy
.temp 2 uv1
.temp 2 uv2
.temp 4 ayay
.temp 4 uvuv
x2 splitlw uvuv, ayay, ayuv
splitlw uv1, uv2, uvuv
x2 avgub uv1, uv1, uv2
x2 select1wb yy, ayay
x2 mergebw yuy2, uv1, yy
.function cogorc_getline_UYVY
.dest 8 ayuv guint8
.source 4 uyvy guint8
.const 2 c255 0xff
.temp 2 yy
.temp 2 uv
.temp 4 ayay
.temp 4 uvuv
x2 splitwb yy, uv, uyvy
x2 mergebw ayay, c255, yy
mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv
.function cogorc_getline_YUV9
.dest 8 d guint8
.source 2 y guint8
.source 1 u guint8
.source 1 v guint8
.const 1 c255 255
.temp 2 tuv
.temp 4 ay
.temp 4 uv
.temp 1 tu
.temp 1 tv
loadupdb tu, u
loadupdb tv, v
mergebw tuv, tu, tv
mergewl uv, tuv, tuv
x2 mergebw ay, c255, y
x2 mergewl d, ay, uv
.function cogorc_getline_Y42B
.dest 8 ayuv guint8
.source 2 yy guint8
.source 1 u guint8
.source 1 v guint8
.const 1 c255 255
.temp 2 uv
.temp 2 ay
.temp 4 uvuv
.temp 4 ayay
mergebw uv, u, v
x2 mergebw ayay, c255, yy
mergewl uvuv, uv, uv
x2 mergewl ayuv, ayay, uvuv
.function cogorc_putline_Y42B
.dest 2 y guint8
.dest 1 u guint8
.dest 1 v guint8
.source 8 ayuv guint8
.temp 4 ayay
.temp 4 uvuv
.temp 2 uv1
.temp 2 uv2
x2 splitlw uvuv, ayay, ayuv
splitlw uv1, uv2, uvuv
x2 avgub uv1, uv1, uv2
splitwb v, u, uv1
x2 select1wb y, ayay
.function cogorc_getline_Y444
.dest 4 ayuv guint8
.source 1 y guint8
.source 1 u guint8
.source 1 v guint8
.const 1 c255 255
.temp 2 uv
.temp 2 ay
mergebw uv, u, v
mergebw ay, c255, y
mergewl ayuv, ay, uv
.function cogorc_putline_Y444
.dest 1 y guint8
.dest 1 u guint8
.dest 1 v guint8
.source 4 ayuv guint8
.temp 2 ay
.temp 2 uv
splitlw uv, ay, ayuv
splitwb v, u, uv
select1wb y, ay
.function cogorc_getline_Y800
.dest 4 ayuv guint8
.source 1 y guint8
.const 1 c255 255
.const 2 c0x8080 0x8080
.temp 2 ay
mergebw ay, c255, y
mergewl ayuv, ay, c0x8080
.function cogorc_putline_Y800
.dest 1 y guint8
.source 4 ayuv guint8
.temp 2 ay
select0lw ay, ayuv
select1wb y, ay
.function cogorc_putline_Y16
.dest 2 y guint8
.source 4 ayuv guint8
.temp 2 ay
.temp 1 yb
select0lw ay, ayuv
select1wb yb, ay
convubw ay, yb
shlw y, ay, 8
.function cogorc_getline_Y16
.dest 4 ayuv guint8
.source 2 y guint8
.const 1 c255 255
.const 2 c0x8080 0x8080
.temp 2 ay
.temp 1 yb
convhwb yb, y
mergebw ay, c255, yb
mergewl ayuv, ay, c0x8080
.function cogorc_getline_BGRA
.dest 4 argb guint8
.source 4 bgra guint8
swapl argb, bgra
.function cogorc_putline_BGRA
.dest 4 bgra guint8
.source 4 argb guint8
swapl bgra, argb
.function cogorc_putline_RGBA
.dest 4 rgba guint8
.source 4 argb guint8
.temp 1 a
.temp 1 r
.temp 1 g
.temp 1 b
.temp 2 rg
.temp 2 ba
.temp 2 ar
.temp 2 gb
splitlw gb, ar, argb
splitwb b, g, gb
splitwb r, a, ar
mergebw ba, b, a
mergebw rg, r, g
mergewl rgba, rg, ba
.function cogorc_getline_RGBA
.dest 4 argb guint8
.source 4 rgba guint8
.temp 1 a
.temp 1 r
.temp 1 g
.temp 1 b
.temp 2 rg
.temp 2 ba
.temp 2 ar
.temp 2 gb
splitlw ba, rg, rgba
splitwb g, r, rg
splitwb a, b, ba
mergebw ar, a, r
mergebw gb, g, b
mergewl argb, ar, gb
.function cogorc_getline_ABGR
.dest 4 argb guint8
.source 4 abgr guint8
.temp 1 a
.temp 1 r
.temp 1 g
.temp 1 b
.temp 2 gr
.temp 2 ab
.temp 2 ar
.temp 2 gb
splitlw gr, ab, abgr
splitwb r, g, gr
splitwb b, a, ab
mergebw ar, a, r
mergebw gb, g, b
mergewl argb, ar, gb
.function cogorc_putline_ABGR
.dest 4 abgr guint8
.source 4 argb guint8
.temp 1 a
.temp 1 r
.temp 1 g
.temp 1 b
.temp 2 gr
.temp 2 ab
.temp 2 ar
.temp 2 gb
splitlw gb, ar, argb
splitwb b, g, gb
splitwb r, a, ar
mergebw ab, a, b
mergebw gr, g, r
mergewl abgr, ab, gr
.function cogorc_getline_NV12
.dest 8 d guint8
.source 2 y guint8
.source 2 uv guint8
.const 1 c255 255
.temp 4 ay
.temp 4 uvuv
mergewl uvuv, uv, uv
x2 mergebw ay, c255, y
x2 mergewl d, ay, uvuv
.function cogorc_putline_NV12
.dest 2 y guint8
.dest 2 uv guint8
.source 8 ayuv guint8
.temp 4 ay
.temp 4 uvuv
.temp 2 uv1
.temp 2 uv2
x2 splitlw uvuv, ay, ayuv
x2 select1wb y, ay
splitlw uv1, uv2, uvuv
x2 avgub uv, uv1, uv2
.function cogorc_getline_NV21
.dest 8 d guint8
.source 2 y guint8
.source 2 vu guint8
.const 1 c255 255
.temp 2 uv
.temp 4 ay
.temp 4 uvuv
swapw uv, vu
mergewl uvuv, uv, uv
x2 mergebw ay, c255, y
x2 mergewl d, ay, uvuv
.function cogorc_putline_NV21
.dest 2 y guint8
.dest 2 vu guint8
.source 8 ayuv guint8
.temp 4 ay
.temp 4 uvuv
.temp 2 uv1
.temp 2 uv2
.temp 2 uv
x2 splitlw uvuv, ay, ayuv
x2 select1wb y, ay
splitlw uv1, uv2, uvuv
x2 avgub uv, uv1, uv2
swapw vu, uv
.function cogorc_getline_A420
.dest 4 d guint8
.source 1 y guint8
.source 1 u guint8
.source 1 v guint8
.source 1 a guint8
.temp 2 uv
.temp 2 ay
.temp 1 tu
.temp 1 tv
loadupdb tu, u
loadupdb tv, v
mergebw uv, tu, tv
mergebw ay, a, y
mergewl d, ay, uv
.function cogorc_putline_A420
.dest 2 y guint8
.dest 1 u guint8
.dest 1 v guint8
.dest 2 a guint8
.source 8 ayuv guint8
.temp 4 ay
.temp 4 uv
.temp 2 uu
.temp 2 vv
.temp 1 t1
.temp 1 t2
x2 splitlw uv, ay, ayuv
x2 select1wb y, ay
x2 select0wb a, ay
x2 splitwb vv, uu, uv
splitwb t1, t2, uu
avgub u, t1, t2
splitwb t1, t2, vv
avgub v, t1, t2
.function orc_resample_bilinear_u32
.dest 4 d1 guint8
.source 4 s1 guint8
.param 4 p1
.param 4 p2
ldreslinl d1, s1, p1, p2
.function orc_merge_linear_u8
.dest 1 d1
.source 1 s1
.source 1 s2
.param 1 p1
.temp 2 t1
.temp 2 t2
.temp 1 a
.temp 1 t
loadb a, s1
convubw t1, s1
convubw t2, s2
subw t2, t2, t1
mullw t2, t2, p1
addw t2, t2, 128
convhwb t, t2
addb d1, t, a

View file

@ -140,6 +140,7 @@
* <title>GstVideoOverlay and Gtk+</title>
* <para>
* |[
* #include &lt;gst/interfaces/xoverlay.h&gt;
* #include &lt;gtk/gtk.h&gt;
* #ifdef GDK_WINDOWING_X11
* #include &lt;gdk/gdkx.h&gt; // for GDK_WINDOW_XID
@ -179,7 +180,7 @@
* #endif
*
* #ifdef GDK_WINDOWING_X11
* video_window_xid = GDK_WINDOW_XID (video_window->window);
* video_window_xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window));
* #endif
* }
* ...
@ -207,7 +208,7 @@
* // realize window now so that the video window gets created and we can
* // obtain its XID before the pipeline is started up and the videosink
* // asks for the XID of the window to render onto
* gtk_widget_realize (window);
* gtk_widget_realize (video_window);
*
* // we should have the XID now
* g_assert (video_window_xid != 0);

View file

@ -40,11 +40,16 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst-i18n-plugin.h>
#include <string.h>
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
#include "gst/glib-compat-private.h"
#include "gstplay-marshal.h"

View file

@ -85,6 +85,10 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst-i18n-plugin.h>
#include <string.h>
@ -96,6 +100,8 @@
#include "gstplayback.h"
#include "gstrawcaps.h"
#include "gst/glib-compat-private.h"
/* generic templates */
static GstStaticPadTemplate decoder_bin_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",

View file

@ -217,6 +217,10 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include <gst/gst.h>
@ -230,6 +234,8 @@
#include "gstplaysink.h"
#include "gstsubtitleoverlay.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_play_bin_debug);
#define GST_CAT_DEFAULT gst_play_bin_debug

View file

@ -22,6 +22,10 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include <gst/gst.h>

View file

@ -26,6 +26,7 @@
#include <gst/pbutils/pbutils.h>
#include <gst/gst-i18n-plugin.h>
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (gst_play_sink_convert_bin_debug);
#define GST_CAT_DEFAULT gst_play_sink_convert_bin_debug

View file

@ -21,7 +21,12 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gststreamsynchronizer.h"
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (stream_synchronizer_debug);
#define GST_CAT_DEFAULT stream_synchronizer_debug

View file

@ -44,6 +44,8 @@
#include <gst/video/video.h>
#include <string.h>
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_STATIC (subtitle_overlay_debug);
#define GST_CAT_DEFAULT subtitle_overlay_debug
@ -236,16 +238,32 @@ _is_raw_video (GstStructure * s)
}
static gboolean
_is_raw_video_pad (GstPad * pad)
_is_video_pad (GstPad * pad, gboolean * hw_accelerated)
{
GstCaps *caps = gst_pad_get_current_caps (pad);
gboolean raw;
gboolean ret;
const gchar *name;
raw = _is_raw_video (gst_caps_get_structure (caps, 0));
name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
if (g_str_has_prefix (name, "video/x-raw-")) {
ret = TRUE;
if (hw_accelerated)
*hw_accelerated = FALSE;
} else if (g_str_has_prefix (name, "video/x-surface")) {
ret = TRUE;
if (hw_accelerated)
*hw_accelerated = TRUE;
} else {
ret = FALSE;
if (hw_accelerated)
*hw_accelerated = FALSE;
}
gst_caps_unref (caps);
return raw;
return ret;
}
static GstCaps *
@ -856,7 +874,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
for (l = factories; l; l = l->next) {
GstElementFactory *factory = l->data;
gboolean is_renderer = _is_renderer (factory);
gboolean is_video, is_hw, is_renderer = _is_renderer (factory);
GstElement *element;
GstPad *sink, *src;
@ -887,6 +905,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
element = is_renderer ? self->renderer : self->parser;
is_video = _is_video_pad (self->video_sinkpad, &is_hw);
/* If this is a parser, create textoverlay and link video and the parser to it
* Else link the renderer to the output colorspace */
if (!is_renderer) {
@ -967,84 +986,113 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
gst_object_unref (sink);
gst_object_unref (src);
if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
COLORSPACE, NULL, "post-colorspace", FALSE))) {
continue;
}
/* If we are working with video/x-surface, we do not add
* colorspace conversion elements */
if (is_video && !is_hw) {
if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
COLORSPACE, NULL, "post-colorspace", FALSE))) {
continue;
}
src = gst_element_get_static_pad (overlay, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from overlay");
continue;
}
src = gst_element_get_static_pad (overlay, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from overlay");
continue;
}
sink = gst_element_get_static_pad (self->post_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
gst_object_unref (src);
continue;
}
sink = gst_element_get_static_pad (self->post_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
gst_object_unref (src);
continue;
}
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link overlay with " COLORSPACE);
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link overlay with " COLORSPACE);
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
COLORSPACE, NULL, "pre-colorspace", FALSE))) {
continue;
}
if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
"identity", NULL, "pre-colorspace", FALSE))) {
continue;
}
sink = gst_element_get_static_pad (overlay, "video_sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from textoverlay");
continue;
}
sink = gst_element_get_static_pad (overlay, "video_sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from textoverlay");
continue;
}
src = gst_element_get_static_pad (self->pre_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
gst_object_unref (sink);
continue;
}
src = gst_element_get_static_pad (self->pre_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
gst_object_unref (sink);
continue;
}
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to textoverlay");
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to textoverlay");
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
/* Set src ghostpad target */
src = gst_element_get_static_pad (self->post_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
continue;
}
/* Set src ghostpad target */
src = gst_element_get_static_pad (self->post_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
continue;
}
if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
(self->srcpad), src))) {
GST_WARNING_OBJECT (self, "Can't set srcpad target");
if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
(self->srcpad), src))) {
GST_WARNING_OBJECT (self, "Can't set srcpad target");
gst_object_unref (src);
continue;
}
gst_object_unref (src);
} else if (is_hw) {
GST_DEBUG_OBJECT (self,
"Is Hardware, not adding colorspace converters, ");
/* Set src ghostpad target */
src = gst_element_get_static_pad (self->overlay, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from textoverlay");
continue;
}
if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
(self->srcpad), src))) {
GST_WARNING_OBJECT (self, "Can't set srcpad target");
gst_object_unref (src);
continue;
}
gst_object_unref (src);
continue;
}
gst_object_unref (src);
/* Send segments to the parser/overlay if necessary. These are not sent
* outside this element because of the proxy pad event function */
if (self->video_segment.format != GST_FORMAT_UNDEFINED) {
GstEvent *event1;
sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
continue;
if (is_video) {
sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
continue;
}
} else {
sink = gst_element_get_static_pad (self->overlay, "video_sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from textoverlay");
continue;
}
}
_generate_update_segment_event (&self->video_segment, &event1);
@ -1073,10 +1121,19 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
}
/* Set the sink ghostpad targets */
sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
continue;
if (is_video && !is_hw) {
sink = gst_element_get_static_pad (self->pre_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
continue;
}
} else if (is_video && is_hw) {
GST_DEBUG_OBJECT (self, "Setting ghostpad to overlay video sink");
sink = gst_element_get_static_pad (self->overlay, "video_sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from overlay");
continue;
}
}
if (G_UNLIKELY (!gst_ghost_pad_set_target (GST_GHOST_PAD_CAST
@ -1104,7 +1161,6 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
} else {
const gchar *name =
gst_plugin_feature_get_name (GST_PLUGIN_FEATURE_CAST (factory));
gboolean is_raw_video = _is_raw_video_pad (self->video_sinkpad);
if (strcmp (name, "textoverlay") == 0) {
/* Set some textoverlay specific properties */
@ -1124,82 +1180,96 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
g_object_set (self->renderer, "font-desc", self->font_desc, NULL);
}
if (is_raw_video) {
/* First check that renderer also supports raw video */
if (is_video) {
gboolean render_is_hw;
/* First check that renderer also supports the video format */
sink = _get_video_pad (element);
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
continue;
}
if (G_UNLIKELY (!_is_raw_video_pad (sink))) {
GST_DEBUG_OBJECT (self, "Renderer doesn't support raw video");
if (is_video != _is_video_pad (sink, &render_is_hw) ||
is_hw != render_is_hw) {
GST_DEBUG_OBJECT (self, "Renderer doesn't support %s video",
is_hw ? "surface" : "raw");
gst_object_unref (sink);
continue;
}
gst_object_unref (sink);
/* First link everything internally */
if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
COLORSPACE, NULL, "post-colorspace", FALSE))) {
continue;
}
src = gst_element_get_static_pad (element, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
continue;
}
if (!is_hw) {
/* First link everything internally */
if (G_UNLIKELY (!_create_element (self, &self->post_colorspace,
COLORSPACE, NULL, "post-colorspace", FALSE))) {
continue;
}
src = gst_element_get_static_pad (element, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
continue;
}
sink = gst_element_get_static_pad (self->post_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
gst_object_unref (src);
continue;
}
sink = gst_element_get_static_pad (self->post_colorspace, "sink");
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get sink pad from " COLORSPACE);
gst_object_unref (src);
continue;
}
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link renderer with " COLORSPACE);
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link renderer with " COLORSPACE);
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
COLORSPACE, NULL, "pre-colorspace", FALSE))) {
continue;
}
if (G_UNLIKELY (!_create_element (self, &self->pre_colorspace,
COLORSPACE, NULL, "pre-colorspace", FALSE))) {
continue;
}
sink = _get_video_pad (element);
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
continue;
}
sink = _get_video_pad (element);
if (G_UNLIKELY (!sink)) {
GST_WARNING_OBJECT (self, "Can't get video sink from renderer");
continue;
}
src = gst_element_get_static_pad (self->pre_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
gst_object_unref (sink);
continue;
}
src = gst_element_get_static_pad (self->pre_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get srcpad from " COLORSPACE);
gst_object_unref (sink);
continue;
}
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to renderer");
if (G_UNLIKELY (gst_pad_link (src, sink) != GST_PAD_LINK_OK)) {
GST_WARNING_OBJECT (self, "Can't link " COLORSPACE " to renderer");
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
continue;
}
gst_object_unref (src);
gst_object_unref (sink);
/* Set src ghostpad target */
src = gst_element_get_static_pad (self->post_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
continue;
/* Set src ghostpad target */
src = gst_element_get_static_pad (self->post_colorspace, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from " COLORSPACE);
continue;
}
} else {
/* Set src ghostpad target in the harware accelerated case */
src = gst_element_get_static_pad (self->renderer, "src");
if (G_UNLIKELY (!src)) {
GST_WARNING_OBJECT (self, "Can't get src pad from renderer");
continue;
}
}
} else { /* No raw video pad */
} else { /* No video pad */
GstCaps *allowed_caps, *video_caps = NULL;
GstPad *video_peer;
gboolean can_intersect = FALSE;

View file

@ -39,6 +39,8 @@
#include "gstrawcaps.h"
#include "gstplayback.h"
#include "gst/glib-compat-private.h"
#define GST_TYPE_URI_DECODE_BIN \
(gst_uri_decode_bin_get_type())
#define GST_URI_DECODE_BIN(obj) \

View file

@ -101,6 +101,11 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst-i18n-plugin.h>
#include <sys/ioctl.h>
@ -2762,8 +2767,14 @@ gst_multi_fd_sink_start (GstBaseSink * bsink)
}
this->running = TRUE;
#if !GLIB_CHECK_VERSION (2, 31, 0)
this->thread = g_thread_create ((GThreadFunc) gst_multi_fd_sink_thread,
this, TRUE, NULL);
#else
this->thread = g_thread_new ("multifdsink",
(GThreadFunc) gst_multi_fd_sink_thread, this);
#endif
GST_OBJECT_FLAG_SET (this, GST_MULTI_FD_SINK_OPEN);

View file

@ -139,6 +139,7 @@ static GstFlowReturn gst_video_rate_transform_ip (GstBaseTransform * trans,
GstBuffer * buf);
static gboolean gst_video_rate_start (GstBaseTransform * trans);
static gboolean gst_video_rate_stop (GstBaseTransform * trans);
static void gst_video_rate_set_property (GObject * object,
@ -168,6 +169,7 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
base_class->transform_ip = GST_DEBUG_FUNCPTR (gst_video_rate_transform_ip);
base_class->sink_event = GST_DEBUG_FUNCPTR (gst_video_rate_sink_event);
base_class->start = GST_DEBUG_FUNCPTR (gst_video_rate_start);
base_class->stop = GST_DEBUG_FUNCPTR (gst_video_rate_stop);
base_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_rate_fixate_caps);
base_class->query = GST_DEBUG_FUNCPTR (gst_video_rate_query);
@ -1114,6 +1116,13 @@ gst_video_rate_start (GstBaseTransform * trans)
return TRUE;
}
static gboolean
gst_video_rate_stop (GstBaseTransform * trans)
{
gst_video_rate_reset (GST_VIDEO_RATE (trans));
return TRUE;
}
static void
gst_video_rate_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)

View file

@ -115,6 +115,8 @@
/* Debugging category */
#include <gst/gstinfo.h>
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagesink);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_ximagesink
@ -738,8 +740,13 @@ gst_ximagesink_manage_event_thread (GstXImageSink * ximagesink)
GST_DEBUG_OBJECT (ximagesink, "run xevent thread, expose %d, events %d",
ximagesink->handle_expose, ximagesink->handle_events);
ximagesink->running = TRUE;
#if !GLIB_CHECK_VERSION (2, 31, 0)
ximagesink->event_thread = g_thread_create (
(GThreadFunc) gst_ximagesink_event_thread, ximagesink, TRUE, NULL);
#else
ximagesink->event_thread = g_thread_try_new ("ximagesink-events",
(GThreadFunc) gst_ximagesink_event_thread, ximagesink, NULL);
#endif
}
} else {
if (ximagesink->event_thread) {

View file

@ -127,6 +127,8 @@
/* Debugging category */
#include <gst/gstinfo.h>
#include "gst/glib-compat-private.h"
GST_DEBUG_CATEGORY_EXTERN (gst_debug_xvimagesink);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_xvimagesink
@ -1175,8 +1177,13 @@ gst_xvimagesink_manage_event_thread (GstXvImageSink * xvimagesink)
GST_DEBUG_OBJECT (xvimagesink, "run xevent thread, expose %d, events %d",
xvimagesink->handle_expose, xvimagesink->handle_events);
xvimagesink->running = TRUE;
#if !GLIB_CHECK_VERSION (2, 31, 0)
xvimagesink->event_thread = g_thread_create (
(GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, TRUE, NULL);
#else
xvimagesink->event_thread = g_thread_try_new ("xvimagesink-events",
(GThreadFunc) gst_xvimagesink_event_thread, xvimagesink, NULL);
#endif
}
} else {
if (xvimagesink->event_thread) {

View file

@ -2,7 +2,7 @@
*
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
* Copyright (C) <2006> Jan Schmidt <thaytan@mad.scientist.com>
* Copyright (C) <2008> Tim-Philipp Müller <tim centricular net>
* Copyright (C) <2008,2011> Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -29,6 +29,7 @@
#include <gst/check/gstcheck.h>
#include <gst/video/video.h>
#include <gst/video/video-overlay-composition.h>
#include <string.h>
/* These are from the current/old videotestsrc; we check our new public API
@ -845,6 +846,151 @@ GST_START_TEST (test_video_size_from_caps)
GST_END_TEST;
#undef ASSERT_CRITICAL
#define ASSERT_CRITICAL(code) while(0){} /* nothing */
GST_START_TEST (test_overlay_composition)
{
GstVideoOverlayComposition *comp1, *comp2;
GstVideoOverlayRectangle *rect1, *rect2;
GstBuffer *pix1, *pix2, *buf;
guint seq1, seq2;
guint w, h, stride;
gint x, y;
pix1 = gst_buffer_new_and_alloc (200 * sizeof (guint32) * 50);
memset (GST_BUFFER_DATA (pix1), 0, GST_BUFFER_SIZE (pix1));
rect1 = gst_video_overlay_rectangle_new_argb (pix1, 200, 50, 200 * 4,
600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
gst_buffer_unref (pix1);
pix1 = NULL;
comp1 = gst_video_overlay_composition_new (rect1);
fail_unless (gst_video_overlay_composition_n_rectangles (comp1) == 1);
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 0) == rect1);
fail_unless (gst_video_overlay_composition_get_rectangle (comp1, 1) == NULL);
/* rectangle was created first, sequence number should be smaller */
seq1 = gst_video_overlay_rectangle_get_seqnum (rect1);
seq2 = gst_video_overlay_composition_get_seqnum (comp1);
fail_unless (seq1 < seq2);
/* composition took own ref, so refcount is 2 now, so this should fail */
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 50,
600, 300, 50));
/* drop our ref, so refcount is 1 (we know it will continue to be valid) */
gst_video_overlay_rectangle_unref (rect1);
gst_video_overlay_rectangle_set_render_rectangle (rect1, 50, 600, 300, 50);
comp2 = gst_video_overlay_composition_new (rect1);
fail_unless (gst_video_overlay_composition_n_rectangles (comp2) == 1);
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect1);
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
fail_unless (seq1 < gst_video_overlay_composition_get_seqnum (comp2));
fail_unless (seq2 < gst_video_overlay_composition_get_seqnum (comp2));
/* now refcount is 2 again because comp2 has also taken a ref, so must fail */
ASSERT_CRITICAL (gst_video_overlay_rectangle_set_render_rectangle (rect1, 0,
0, 1, 1));
/* this should make a copy of the rectangles so drop the original
* second ref on rect1 */
comp2 = gst_video_overlay_composition_make_writable (comp2);
gst_video_overlay_rectangle_set_render_rectangle (rect1, 51, 601, 301, 51);
rect2 = gst_video_overlay_composition_get_rectangle (comp2, 0);
fail_unless (gst_video_overlay_composition_n_rectangles (comp2) == 1);
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 0) == rect2);
fail_unless (gst_video_overlay_composition_get_rectangle (comp2, 1) == NULL);
fail_unless (rect1 != rect2);
gst_video_overlay_composition_add_rectangle (comp1, rect2);
gst_video_overlay_composition_ref (comp1);
ASSERT_CRITICAL (gst_video_overlay_composition_add_rectangle (comp1, rect2));
gst_video_overlay_composition_unref (comp1);
/* make sure the copy really worked */
gst_video_overlay_rectangle_get_render_rectangle (rect1, &x, &y, &w, &h);
fail_unless_equals_int (x, 51);
fail_unless_equals_int (y, 601);
fail_unless_equals_int (w, 301);
fail_unless_equals_int (h, 51);
/* get scaled pixbuf and touch last byte */
pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1, &stride,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1),
"size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
((h - 1) * stride + (w * 4) - 1));
fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride +
(w * 4) - 1)), 0);
gst_video_overlay_rectangle_get_render_rectangle (rect2, &x, &y, &w, &h);
fail_unless_equals_int (x, 50);
fail_unless_equals_int (y, 600);
fail_unless_equals_int (w, 300);
fail_unless_equals_int (h, 50);
/* get scaled pixbuf and touch last byte */
pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (GST_BUFFER_SIZE (pix2) > ((h - 1) * stride + (w * 4) - 1),
"size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
((h - 1) * stride + (w * 4) - 1));
fail_unless_equals_int (*(GST_BUFFER_DATA (pix2) + ((h - 1) * stride +
(w * 4) - 1)), 0);
/* get scaled pixbuf again, should be the same buffer as before (caching) */
pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2, &stride,
GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
fail_unless (pix1 == pix2);
/* now compare the original unscaled ones */
pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, &w, &h,
&stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect2, &w, &h,
&stride, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
/* the original pixel buffers should be identical */
fail_unless (pix1 == pix2);
fail_unless_equals_int (w, 200);
fail_unless_equals_int (h, 50);
/* touch last byte */
fail_unless (GST_BUFFER_SIZE (pix1) > ((h - 1) * stride + (w * 4) - 1),
"size %u vs. last pixel offset %u", GST_BUFFER_SIZE (pix1),
((h - 1) * stride + (w * 4) - 1));
fail_unless_equals_int (*(GST_BUFFER_DATA (pix1) + ((h - 1) * stride +
(w * 4) - 1)), 0);
/* test attaching and retrieving of compositions to/from buffers */
buf = gst_buffer_new ();
fail_unless (gst_video_buffer_get_overlay_composition (buf) == NULL);
gst_buffer_ref (buf);
ASSERT_CRITICAL (gst_video_buffer_set_overlay_composition (buf, comp1));
gst_buffer_unref (buf);
gst_video_buffer_set_overlay_composition (buf, comp1);
fail_unless (gst_video_buffer_get_overlay_composition (buf) == comp1);
gst_video_buffer_set_overlay_composition (buf, comp2);
fail_unless (gst_video_buffer_get_overlay_composition (buf) == comp2);
gst_video_buffer_set_overlay_composition (buf, NULL);
fail_unless (gst_video_buffer_get_overlay_composition (buf) == NULL);
/* make sure the buffer cleans up its composition ref when unreffed */
gst_video_buffer_set_overlay_composition (buf, comp2);
gst_buffer_unref (buf);
gst_video_overlay_composition_unref (comp2);
gst_video_overlay_composition_unref (comp1);
}
GST_END_TEST;
static Suite *
video_suite (void)
{
@ -861,6 +1007,7 @@ video_suite (void)
tcase_add_test (tc_chain, test_convert_frame);
tcase_add_test (tc_chain, test_convert_frame_async);
tcase_add_test (tc_chain, test_video_size_from_caps);
tcase_add_test (tc_chain, test_overlay_composition);
return s;
}

View file

@ -8,9 +8,8 @@ if USE_GIO
GIO_SUBDIRS = gio
endif
SUBDIRS = app audio dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec encoding
DIST_SUBDIRS = app audio dynamic gio overlay seek snapshot playrec encoding
SUBDIRS = app audio dynamic fft $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec encoding
DIST_SUBDIRS = app audio dynamic fft gio overlay seek snapshot playrec encoding
include $(top_srcdir)/common/parallel-subdirs.mak

View file

@ -395,8 +395,10 @@ main (int argc, char **argv)
GstEncodingProfile *prof;
gchar *inputuri;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("- encode URIs with GstProfile and encodebin");
g_option_context_add_main_entries (ctx, options, NULL);

2
tests/examples/fft/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
fftrange

View file

@ -0,0 +1,8 @@
noinst_PROGRAMS = fftrange
fftrange_SOURCES = fftrange.c
fftrange_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
fftrange_LDADD = \
$(top_builddir)/gst-libs/gst/fft/libgstfft-$(GST_MAJORMINOR).la \
$(GST_LIBS)

View file

@ -0,0 +1,184 @@
/* GStreamer
* (c) 2011 Stefan Kost <ensonic@users.sf.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <gst/fft/gstffts16.h>
#include <gst/fft/gstffts32.h>
#include <gst/fft/gstfftf32.h>
#include <gst/fft/gstfftf64.h>
/* effectively max range seems to be 1/4 of what it should be */
#define MAKE_I_TEST(_g_,_G_,_t_,_T_,_f_) \
static void \
test_##_t_ (const gchar *test_name, gint num_freq, gint window) \
{ \
GstFFT ##_T_ *ctx; \
GstFFT ##_T_ ##Complex *fdata; \
_g_ *adata; \
_g_ maxfr = 0, maxfi = 0; \
gint num_samples = num_freq * 2 - 2; \
gint s, f; \
\
ctx = gst_fft_ ##_t_ ##_new (num_samples, FALSE); \
fdata = g_new (GstFFT ##_T_ ##Complex, num_freq); \
adata = g_new (_g_, num_samples); \
\
for (s = 0; s < num_samples;) { \
adata[s++]=G_MIN##_G_; \
adata[s++]=G_MAX##_G_; \
} \
\
gst_fft_ ##_t_ ##_window (ctx, adata, window); \
gst_fft_ ##_t_ ##_fft (ctx, adata, fdata); \
\
for (f = 0; f < num_freq; f++) { \
if (fdata[1+f].r > maxfr) \
maxfr = fdata[1+f].r; \
if (fdata[1+f].i > maxfi) \
maxfi = fdata[1+f].i; \
} \
\
printf (#_t_" %-15s: maxfr: %"_f_" %10.5f maxfi: %"_f_" %10.5f\n",\
test_name, \
maxfr, (gfloat)G_MAX##_G_/maxfr, \
maxfi, (gfloat)G_MAX##_G_/maxfi); \
\
gst_fft_ ##_t_ ##_free (ctx); \
g_free (fdata); \
g_free (adata); \
}
MAKE_I_TEST (gint16, INT16, s16, S16, "6d");
MAKE_I_TEST (gint32, INT32, s32, S32, "9d");
#define MAKE_F_TEST(_g_,_G_,_t_,_T_,_f_) \
static void \
test_##_t_ (const gchar *test_name, gint num_freq, gint window) \
{ \
GstFFT ##_T_ *ctx; \
GstFFT ##_T_ ##Complex *fdata; \
_g_ *adata; \
_g_ maxfr = 0, maxfi = 0; \
gint num_samples = num_freq * 2 - 2; \
gint s, f; \
\
ctx = gst_fft_ ##_t_ ##_new (num_samples, FALSE); \
fdata = g_new (GstFFT ##_T_ ##Complex, num_freq); \
adata = g_new (_g_, num_samples); \
\
for (s = 0; s < num_samples;) { \
adata[s++]=-1.0; \
adata[s++]=+1.0; \
} \
\
gst_fft_ ##_t_ ##_window (ctx, adata, window); \
gst_fft_ ##_t_ ##_fft (ctx, adata, fdata); \
\
for (f = 0; f < num_freq; f++) { \
if (fdata[1+f].r > maxfr) \
maxfr = fdata[1+f].r; \
if (fdata[1+f].i > maxfi) \
maxfi = fdata[1+f].i; \
} \
\
printf (#_t_" %-15s: maxfr: %"_f_" %10.5f maxfi: %"_f_" %10.5f\n",\
test_name, \
maxfr, (gfloat)1.0/maxfr, \
maxfi, (gfloat)1.0/maxfi); \
\
gst_fft_ ##_t_ ##_free (ctx); \
g_free (fdata); \
g_free (adata); \
}
MAKE_F_TEST (gfloat, FLOAT, f32, F32, "10.5f");
MAKE_F_TEST (gdouble, DOUBLE, f64, F64, "10.5f");
gint
main (gint argc, gchar * argv[])
{
gint num_bands;
gst_init (&argc, &argv);
num_bands = 200;
test_s16 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_s16 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_s16 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
test_s16 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_s16 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("");
num_bands = 300;
test_s16 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_s16 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_s16 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
test_s16 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_s16 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("\n");
num_bands = 200;
test_s32 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_s32 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_s32 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
test_s32 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_s32 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("");
num_bands = 300;
test_s32 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_s32 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_s32 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
test_s32 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_s32 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("\n");
num_bands = 200;
test_f32 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_f32 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_f32 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
test_f32 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_f32 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("");
num_bands = 300;
test_f32 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_f32 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_f32 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
test_f32 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_f32 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("\n");
num_bands = 200;
test_f64 ("200, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_f64 ("200, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_f64 ("200, hann", num_bands, GST_FFT_WINDOW_HANN);
test_f64 ("200, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_f64 ("200, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("");
num_bands = 300;
test_f64 ("300, none", num_bands, GST_FFT_WINDOW_RECTANGULAR);
test_f64 ("300, hamming", num_bands, GST_FFT_WINDOW_HAMMING);
test_f64 ("300, hann", num_bands, GST_FFT_WINDOW_HANN);
test_f64 ("300, bartlett", num_bands, GST_FFT_WINDOW_BARTLETT);
test_f64 ("300, blackman", num_bands, GST_FFT_WINDOW_BLACKMAN);
puts ("\n");
}

View file

@ -98,8 +98,10 @@ main (int argc, char **argv)
gulong embed_xid;
GstStateChangeReturn sret;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);

View file

@ -80,8 +80,10 @@ find_video_sink (void)
int main(int argc, char *argv[])
{
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
gst_init (&argc, &argv);
QApplication app(argc, argv);

View file

@ -2676,8 +2676,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);

View file

@ -458,8 +458,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("seek");
g_option_context_add_main_entries (ctx, options, NULL);

View file

@ -1809,8 +1809,10 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *err = NULL;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("- test seeking in gsteamer");
g_option_context_add_main_entries (ctx, options, NULL);

View file

@ -100,8 +100,10 @@ main (int argc, char **argv)
};
GTimer *timer;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx = g_option_context_new ("FILES OR DIRECTORIES WITH AUDIO FILES");
g_option_context_add_main_entries (ctx, options, NULL);

View file

@ -172,8 +172,10 @@ main (int argc, char **argv)
GstPropertyProbe *probe;
GValueArray *arr;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);

View file

@ -144,8 +144,10 @@ main (gint argc, gchar ** argv)
gulong embed_xid = 0;
gboolean force_aspect = FALSE, draw_borders = FALSE;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
gst_init (&argc, &argv);
gtk_init (&argc, &argv);

View file

@ -499,8 +499,10 @@ main (int argc, char **argv)
};
GOptionContext *ctx;
#if !GLIB_CHECK_VERSION (2, 31, 0)
if (!g_thread_supported ())
g_thread_init (NULL);
#endif
ctx =
g_option_context_new