inter: don't use deprecated GLib threading API

This commit is contained in:
Tim-Philipp Müller 2013-02-09 20:22:09 +00:00
parent eef2324e4d
commit 632f2ac1c6
9 changed files with 20 additions and 22 deletions

View file

@ -213,9 +213,9 @@ gst_inter_audio_sink_stop (GstBaseSink * sink)
GST_DEBUG ("stop"); GST_DEBUG ("stop");
g_mutex_lock (interaudiosink->surface->mutex); g_mutex_lock (&interaudiosink->surface->mutex);
gst_adapter_clear (interaudiosink->surface->audio_adapter); gst_adapter_clear (interaudiosink->surface->audio_adapter);
g_mutex_unlock (interaudiosink->surface->mutex); g_mutex_unlock (&interaudiosink->surface->mutex);
gst_inter_surface_unref (interaudiosink->surface); gst_inter_surface_unref (interaudiosink->surface);
interaudiosink->surface = NULL; interaudiosink->surface = NULL;
@ -231,7 +231,7 @@ gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
GST_DEBUG ("render %" G_GSIZE_FORMAT, gst_buffer_get_size (buffer)); GST_DEBUG ("render %" G_GSIZE_FORMAT, gst_buffer_get_size (buffer));
g_mutex_lock (interaudiosink->surface->mutex); g_mutex_lock (&interaudiosink->surface->mutex);
n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4; n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4;
#define SIZE 1600 #define SIZE 1600
if (n > (SIZE * 3)) { if (n > (SIZE * 3)) {
@ -241,7 +241,7 @@ gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
} }
gst_adapter_push (interaudiosink->surface->audio_adapter, gst_adapter_push (interaudiosink->surface->audio_adapter,
gst_buffer_ref (buffer)); gst_buffer_ref (buffer));
g_mutex_unlock (interaudiosink->surface->mutex); g_mutex_unlock (&interaudiosink->surface->mutex);
return GST_FLOW_OK; return GST_FLOW_OK;
} }

View file

@ -272,7 +272,7 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
buffer = NULL; buffer = NULL;
g_mutex_lock (interaudiosrc->surface->mutex); g_mutex_lock (&interaudiosrc->surface->mutex);
n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4; n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4;
if (n > SIZE * 3) { if (n > SIZE * 3) {
GST_WARNING ("flushing %d samples", SIZE / 2); GST_WARNING ("flushing %d samples", SIZE / 2);
@ -285,7 +285,7 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
buffer = gst_adapter_take_buffer (interaudiosrc->surface->audio_adapter, buffer = gst_adapter_take_buffer (interaudiosrc->surface->audio_adapter,
n * 4); n * 4);
} }
g_mutex_unlock (interaudiosrc->surface->mutex); g_mutex_unlock (&interaudiosrc->surface->mutex);
if (n < SIZE) { if (n < SIZE) {
GstBuffer *newbuf = gst_buffer_new_and_alloc ((SIZE - n) * 4); GstBuffer *newbuf = gst_buffer_new_and_alloc ((SIZE - n) * 4);

View file

@ -194,12 +194,12 @@ gst_inter_sub_sink_stop (GstBaseSink * sink)
{ {
GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (sink); GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (sink);
g_mutex_lock (intersubsink->surface->mutex); g_mutex_lock (&intersubsink->surface->mutex);
if (intersubsink->surface->sub_buffer) { if (intersubsink->surface->sub_buffer) {
gst_buffer_unref (intersubsink->surface->sub_buffer); gst_buffer_unref (intersubsink->surface->sub_buffer);
} }
intersubsink->surface->sub_buffer = NULL; intersubsink->surface->sub_buffer = NULL;
g_mutex_unlock (intersubsink->surface->mutex); g_mutex_unlock (&intersubsink->surface->mutex);
gst_inter_surface_unref (intersubsink->surface); gst_inter_surface_unref (intersubsink->surface);
intersubsink->surface = NULL; intersubsink->surface = NULL;
@ -212,13 +212,13 @@ gst_inter_sub_sink_render (GstBaseSink * sink, GstBuffer * buffer)
{ {
GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (sink); GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (sink);
g_mutex_lock (intersubsink->surface->mutex); g_mutex_lock (&intersubsink->surface->mutex);
if (intersubsink->surface->sub_buffer) { if (intersubsink->surface->sub_buffer) {
gst_buffer_unref (intersubsink->surface->sub_buffer); gst_buffer_unref (intersubsink->surface->sub_buffer);
} }
intersubsink->surface->sub_buffer = gst_buffer_ref (buffer); intersubsink->surface->sub_buffer = gst_buffer_ref (buffer);
//intersubsink->surface->sub_buffer_count = 0; //intersubsink->surface->sub_buffer_count = 0;
g_mutex_unlock (intersubsink->surface->mutex); g_mutex_unlock (&intersubsink->surface->mutex);
return GST_FLOW_OK; return GST_FLOW_OK;
} }

View file

@ -227,7 +227,7 @@ gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
buffer = NULL; buffer = NULL;
g_mutex_lock (intersubsrc->surface->mutex); g_mutex_lock (&intersubsrc->surface->mutex);
if (intersubsrc->surface->sub_buffer) { if (intersubsrc->surface->sub_buffer) {
buffer = gst_buffer_ref (intersubsrc->surface->sub_buffer); buffer = gst_buffer_ref (intersubsrc->surface->sub_buffer);
//intersubsrc->surface->sub_buffer_count++; //intersubsrc->surface->sub_buffer_count++;
@ -236,7 +236,7 @@ gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
intersubsrc->surface->sub_buffer = NULL; intersubsrc->surface->sub_buffer = NULL;
//} //}
} }
g_mutex_unlock (intersubsrc->surface->mutex); g_mutex_unlock (&intersubsrc->surface->mutex);
if (buffer == NULL) { if (buffer == NULL) {
GstMapInfo map; GstMapInfo map;

View file

@ -23,7 +23,6 @@
#include <string.h> #include <string.h>
#include <gst/glib-compat-private.h>
#include "gstintersurface.h" #include "gstintersurface.h"
static GList *list; static GList *list;
@ -48,7 +47,7 @@ gst_inter_surface_get (const char *name)
surface = g_malloc0 (sizeof (GstInterSurface)); surface = g_malloc0 (sizeof (GstInterSurface));
surface->name = g_strdup (name); surface->name = g_strdup (name);
surface->mutex = g_mutex_new (); g_mutex_init (&surface->mutex);
surface->audio_adapter = gst_adapter_new (); surface->audio_adapter = gst_adapter_new ();
list = g_list_append (list, surface); list = g_list_append (list, surface);

View file

@ -29,7 +29,7 @@ typedef struct _GstInterSurface GstInterSurface;
struct _GstInterSurface struct _GstInterSurface
{ {
GMutex *mutex; GMutex mutex;
char *name; char *name;
/* video */ /* video */

View file

@ -29,7 +29,6 @@
#endif #endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/glib-compat-private.h>
#include <stdlib.h> #include <stdlib.h>
//#define GETTEXT_PACKAGE "intertest" //#define GETTEXT_PACKAGE "intertest"

View file

@ -206,12 +206,12 @@ gst_inter_video_sink_stop (GstBaseSink * sink)
{ {
GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink);
g_mutex_lock (intervideosink->surface->mutex); g_mutex_lock (&intervideosink->surface->mutex);
if (intervideosink->surface->video_buffer) { if (intervideosink->surface->video_buffer) {
gst_buffer_unref (intervideosink->surface->video_buffer); gst_buffer_unref (intervideosink->surface->video_buffer);
} }
intervideosink->surface->video_buffer = NULL; intervideosink->surface->video_buffer = NULL;
g_mutex_unlock (intervideosink->surface->mutex); g_mutex_unlock (&intervideosink->surface->mutex);
gst_inter_surface_unref (intervideosink->surface); gst_inter_surface_unref (intervideosink->surface);
intervideosink->surface = NULL; intervideosink->surface = NULL;
@ -224,13 +224,13 @@ gst_inter_video_sink_render (GstBaseSink * sink, GstBuffer * buffer)
{ {
GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink); GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (sink);
g_mutex_lock (intervideosink->surface->mutex); g_mutex_lock (&intervideosink->surface->mutex);
if (intervideosink->surface->video_buffer) { if (intervideosink->surface->video_buffer) {
gst_buffer_unref (intervideosink->surface->video_buffer); gst_buffer_unref (intervideosink->surface->video_buffer);
} }
intervideosink->surface->video_buffer = gst_buffer_ref (buffer); intervideosink->surface->video_buffer = gst_buffer_ref (buffer);
intervideosink->surface->video_buffer_count = 0; intervideosink->surface->video_buffer_count = 0;
g_mutex_unlock (intervideosink->surface->mutex); g_mutex_unlock (&intervideosink->surface->mutex);
return GST_FLOW_OK; return GST_FLOW_OK;
} }

View file

@ -256,7 +256,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
buffer = NULL; buffer = NULL;
g_mutex_lock (intervideosrc->surface->mutex); g_mutex_lock (&intervideosrc->surface->mutex);
if (intervideosrc->surface->video_buffer) { if (intervideosrc->surface->video_buffer) {
buffer = gst_buffer_ref (intervideosrc->surface->video_buffer); buffer = gst_buffer_ref (intervideosrc->surface->video_buffer);
intervideosrc->surface->video_buffer_count++; intervideosrc->surface->video_buffer_count++;
@ -265,7 +265,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
intervideosrc->surface->video_buffer = NULL; intervideosrc->surface->video_buffer = NULL;
} }
} }
g_mutex_unlock (intervideosrc->surface->mutex); g_mutex_unlock (&intervideosrc->surface->mutex);
if (buffer == NULL) { if (buffer == NULL) {
GstMapInfo map; GstMapInfo map;