Permalink
Browse files

Update to new GLib mutex API

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information...
1 parent 9229857 commit 3c30e6416935db1f9969fd00a5241ab1133ac6d6 @felipec committed Apr 11, 2013
Showing with 16 additions and 16 deletions.
  1. +9 −9 gstav_adec.c
  2. +6 −6 gstav_vdec.c
  3. +1 −1 gstav_vdec.h
View
18 gstav_adec.c
@@ -50,7 +50,7 @@ struct obj {
int (*header_func)(struct obj *self, GstBuffer *buf);
uint64_t next_timestamp;
int bps;
- GMutex *mutex;
+ GMutex mutex;
};
struct obj_class {
@@ -285,9 +285,9 @@ pad_chain(GstPad *pad, GstBuffer *buf)
buffer_data = self->buffer_data + self->ring.in;
buffer_size = self->buffer_size - self->ring.in;
#if LIBAVCODEC_VERSION_MAJOR < 54 && !(LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR >= 25)
- g_mutex_lock(self->mutex);
+ g_mutex_lock(&self->mutex);
read = avcodec_decode_audio3(av_ctx, buffer_data, &buffer_size, &pkt);
- g_mutex_unlock(self->mutex);
+ g_mutex_unlock(&self->mutex);
if (read < 0) {
GST_WARNING_OBJECT(self, "error: %i", read);
break;
@@ -296,9 +296,9 @@ pad_chain(GstPad *pad, GstBuffer *buf)
AVFrame frame;
int got_frame = 0, planar, plane_size;
- g_mutex_lock(self->mutex);
+ g_mutex_lock(&self->mutex);
read = avcodec_decode_audio4(av_ctx, &frame, &got_frame, &pkt);
- g_mutex_unlock(self->mutex);
+ g_mutex_unlock(&self->mutex);
if (read < 0) {
GST_WARNING_OBJECT(self, "error: %i", read);
break;
@@ -418,9 +418,9 @@ sink_event(GstPad *pad, GstEvent *event)
switch (event->type) {
case GST_EVENT_FLUSH_START:
self->timestamp = GST_CLOCK_TIME_NONE;
- g_mutex_lock(self->mutex);
+ g_mutex_lock(&self->mutex);
avcodec_flush_buffers(self->av_ctx);
- g_mutex_unlock(self->mutex);
+ g_mutex_unlock(&self->mutex);
break;
case GST_EVENT_EOS: {
/* flush current buffer */
@@ -622,14 +622,14 @@ instance_init(GTypeInstance *instance, void *g_class)
self->header_func = default_header;
self->timestamp = GST_CLOCK_TIME_NONE;
- self->mutex = g_mutex_new();
+ g_mutex_init(&self->mutex);
}
static void
finalize(GObject *obj)
{
struct obj *self = (struct obj *)obj;
- g_mutex_free(self->mutex);
+ g_mutex_clear(&self->mutex);
((GObjectClass *)parent_class)->finalize(obj);
}
View
12 gstav_vdec.c
@@ -226,9 +226,9 @@ pad_chain(GstPad *pad, GstBuffer *buf)
ctx->reordered_opaque = pkt.dts;
#endif
- g_mutex_lock(self->mutex);
+ g_mutex_lock(&self->mutex);
read = avcodec_decode_video2(ctx, frame, &got_pic, &pkt);
- g_mutex_unlock(self->mutex);
+ g_mutex_unlock(&self->mutex);
av_free_packet(&pkt);
if (read < 0) {
GST_WARNING_OBJECT(self, "error: %i", read);
@@ -589,9 +589,9 @@ static gboolean sink_event(GstPad *pad, GstEvent *event)
get_delayed(self);
break;
case GST_EVENT_FLUSH_START:
- g_mutex_lock(self->mutex);
+ g_mutex_lock(&self->mutex);
avcodec_flush_buffers(self->av_ctx);
- g_mutex_unlock(self->mutex);
+ g_mutex_unlock(&self->mutex);
break;
default:
break;
@@ -625,14 +625,14 @@ instance_init(GTypeInstance *instance, void *g_class)
gst_element_add_pad((GstElement *)self, self->srcpad);
gst_pad_set_setcaps_function(self->sinkpad, sink_setcaps);
- self->mutex = g_mutex_new();
+ g_mutex_init(&self->mutex);
}
static void
finalize(GObject *obj)
{
struct obj *self = (struct obj *)obj;
- g_mutex_free(self->mutex);
+ g_mutex_clear(&self->mutex);
((GObjectClass *)parent_class)->finalize(obj);
}
View
2 gstav_vdec.h
@@ -25,7 +25,7 @@ struct gst_av_vdec {
AVCodecContext *av_ctx;
bool initialized;
bool (*parse_func)(struct gst_av_vdec *vdec, GstBuffer *buf);
- GMutex *mutex;
+ GMutex mutex;
/* thank you GStreamer */
bool is_dts;

0 comments on commit 3c30e64

Please sign in to comment.