gst_video_info_init (&render->info);
- render->subtitle_mutex = g_mutex_new ();
- render->subtitle_cond = g_cond_new ();
+ g_mutex_init (&render->subtitle_mutex);
+ g_cond_init (&render->subtitle_cond);
render->renderer_init_ok = FALSE;
render->track_init_ok = FALSE;
gst_segment_init (&render->video_segment, GST_FORMAT_TIME);
gst_segment_init (&render->subtitle_segment, GST_FORMAT_TIME);
- render->ass_mutex = g_mutex_new ();
+ g_mutex_init (&render->ass_mutex);
render->ass_library = ass_library_init ();
#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00907000
ass_set_message_cb (render->ass_library, _libass_message_cb, render);
{
GstAssRender *render = GST_ASS_RENDER (object);
- if (render->subtitle_mutex)
- g_mutex_free (render->subtitle_mutex);
-
- if (render->subtitle_cond)
- g_cond_free (render->subtitle_cond);
+ g_mutex_clear (&render->subtitle_mutex);
+ g_cond_clear (&render->subtitle_cond);
if (render->ass_track) {
ass_free_track (render->ass_track);
ass_library_done (render->ass_library);
}
- if (render->ass_mutex)
- g_mutex_free (render->ass_mutex);
+ g_mutex_clear (&render->ass_mutex);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
break;
case PROP_EMBEDDEDFONTS:
render->embeddedfonts = g_value_get_boolean (value);
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
ass_set_extract_fonts (render->ass_library, render->embeddedfonts);
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
- g_mutex_lock (render->subtitle_mutex);
+ g_mutex_lock (&render->subtitle_mutex);
render->subtitle_flushing = TRUE;
if (render->subtitle_pending)
gst_buffer_unref (render->subtitle_pending);
render->subtitle_pending = NULL;
- g_cond_signal (render->subtitle_cond);
- g_mutex_unlock (render->subtitle_mutex);
+ g_cond_signal (&render->subtitle_cond);
+ g_mutex_unlock (&render->subtitle_mutex);
break;
}
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
if (render->ass_track)
ass_free_track (render->ass_track);
render->ass_track = NULL;
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
render->track_init_ok = FALSE;
render->renderer_init_ok = FALSE;
break;
gst_pad_push_event (render->srcpad, gst_event_new_flush_start ());
/* Mark subtitle as flushing, unblocks chains */
- g_mutex_lock (render->subtitle_mutex);
+ g_mutex_lock (&render->subtitle_mutex);
if (render->subtitle_pending)
gst_buffer_unref (render->subtitle_pending);
render->subtitle_pending = NULL;
render->subtitle_flushing = TRUE;
- g_cond_signal (render->subtitle_cond);
- g_mutex_unlock (render->subtitle_mutex);
+ g_cond_signal (&render->subtitle_cond);
+ g_mutex_unlock (&render->subtitle_mutex);
/* Seek on each sink pad */
gst_event_ref (event);
goto out;
}
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
ass_set_frame_size (render->ass_renderer, info.width, info.height);
dar = (((gdouble) par_n) * ((gdouble) info.width))
#endif
ass_set_margins (render->ass_renderer, 0, 0, 0, 0);
ass_set_use_margins (render->ass_renderer, 0);
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
render->renderer_init_ok = TRUE;
value = gst_structure_get_value (structure, "codec_data");
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
if (value != NULL) {
priv = gst_value_get_buffer (value);
g_return_val_if_fail (priv != NULL, FALSE);
ret = TRUE;
}
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
gst_object_unref (render);
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
ass_process_chunk (render->ass_track, data, size, pts_start, pts_end);
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
gst_buffer_unmap (buffer, data, size);
gst_buffer_unref (buffer);
render->video_segment.position = clip_start;
- g_mutex_lock (render->subtitle_mutex);
+ g_mutex_lock (&render->subtitle_mutex);
if (render->subtitle_pending) {
GstClockTime sub_running_time, vid_running_time;
GstClockTime sub_running_time_end, vid_running_time_end;
GST_TIME_FORMAT, GST_TIME_ARGS (sub_running_time_end),
GST_TIME_ARGS (vid_running_time));
render->subtitle_pending = NULL;
- g_cond_signal (render->subtitle_cond);
+ g_cond_signal (&render->subtitle_cond);
} else if (sub_running_time <= vid_running_time_end + GST_SECOND / 2) {
gst_ass_render_process_text (render, render->subtitle_pending,
sub_running_time, sub_running_time_end - sub_running_time);
render->subtitle_pending = NULL;
- g_cond_signal (render->subtitle_cond);
+ g_cond_signal (&render->subtitle_cond);
}
}
- g_mutex_unlock (render->subtitle_mutex);
+ g_mutex_unlock (&render->subtitle_mutex);
/* now start rendering subtitles, if all conditions are met */
if (render->renderer_init_ok && render->track_init_ok && render->enable) {
/* libass needs timestamps in ms */
timestamp = running_time / GST_MSECOND;
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
#ifndef GST_DISABLE_GST_DEBUG
/* only for testing right now. could possibly be used for optimizations? */
step = ass_step_sub (render->ass_track, timestamp, 1);
/* not sure what the last parameter to this call is for (detect_change) */
ass_image = ass_render_frame (render->ass_renderer, render->ass_track,
timestamp, NULL);
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
if (ass_image != NULL) {
GstVideoFrame frame;
if (sub_running_time > vid_running_time + GST_SECOND / 2) {
g_assert (render->subtitle_pending == NULL);
- g_mutex_lock (render->subtitle_mutex);
+ g_mutex_lock (&render->subtitle_mutex);
if (G_UNLIKELY (render->subtitle_flushing)) {
GST_DEBUG_OBJECT (render, "Text pad flushing");
gst_buffer_unref (buffer);
- g_mutex_unlock (render->subtitle_mutex);
+ g_mutex_unlock (&render->subtitle_mutex);
return GST_FLOW_WRONG_STATE;
}
GST_DEBUG_OBJECT (render,
GST_TIME_FORMAT, GST_TIME_ARGS (sub_running_time),
GST_TIME_ARGS (vid_running_time));
render->subtitle_pending = buffer;
- g_cond_wait (render->subtitle_cond, render->subtitle_mutex);
- g_mutex_unlock (render->subtitle_mutex);
+ g_cond_wait (&render->subtitle_cond, &render->subtitle_mutex);
+ g_mutex_unlock (&render->subtitle_mutex);
} else if (sub_running_time_end < vid_running_time) {
GST_DEBUG_OBJECT (render,
"Too late text buffer, dropping (%" GST_TIME_FORMAT " < %"
}
if (valid_mimetype || valid_extension) {
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
ass_add_font (render->ass_library, (gchar *) filename,
(gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
GST_DEBUG_OBJECT (render, "registered new font %s", filename);
- g_mutex_unlock (render->ass_mutex);
+ g_mutex_unlock (&render->ass_mutex);
}
#endif
}
break;
case GST_EVENT_FLUSH_START:
GST_DEBUG_OBJECT (render, "begin flushing");
- g_mutex_lock (render->ass_mutex);
+ g_mutex_lock (&render->ass_mutex);
if (render->ass_track) {
/* delete any events on the ass_track */
for (i = 0; i < render->ass_track->n_events; i++) {
render->ass_track->n_events = 0;
GST_DEBUG_OBJECT (render, "done flushing");
}
- g_mutex_unlock (render->ass_mutex);
- g_mutex_lock (render->subtitle_mutex);
+ g_mutex_unlock (&render->ass_mutex);
+ g_mutex_lock (&render->subtitle_mutex);
if (render->subtitle_pending)
gst_buffer_unref (render->subtitle_pending);
render->subtitle_pending = NULL;
render->subtitle_flushing = TRUE;
- g_cond_signal (render->subtitle_cond);
- g_mutex_unlock (render->subtitle_mutex);
+ g_cond_signal (&render->subtitle_cond);
+ g_mutex_unlock (&render->subtitle_mutex);
gst_event_unref (event);
ret = TRUE;
break;
GstVideoInfo info;
GstAssRenderBlitFunction blit;
- GMutex *subtitle_mutex;
- GCond *subtitle_cond;
+ GMutex subtitle_mutex;
+ GCond subtitle_cond;
GstBuffer *subtitle_pending;
gboolean subtitle_flushing;
GstSegment subtitle_segment;
- GMutex *ass_mutex;
+ GMutex ass_mutex;
ASS_Library *ass_library;
ASS_Renderer *ass_renderer;
ASS_Track *ass_track;
/* ... and of the rest */
delete mplex->job;
- g_mutex_free (mplex->tlock);
+ g_mutex_clear (&mplex->tlock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
mplex->num_apads = 0;
mplex->num_vpads = 0;
- mplex->tlock = g_mutex_new ();
+ g_mutex_init (&mplex->tlock);
gst_mplex_reset (mplex);
}
}
if (!mpad->pad) {
- g_cond_free (mpad->cond);
+ g_cond_clear (&mpad->cond);
g_object_unref (mpad->adapter);
g_free (mpad);
} else
mpad = g_new0 (GstMplexPad, 1);
mpad->adapter = gst_adapter_new ();
- mpad->cond = g_cond_new ();
+ g_cond_init (&mpad->cond);
gst_object_ref (newpad);
mpad->pad = newpad;
#define GST_MPLEX_MUTEX_LOCK(m) G_STMT_START { \
GST_LOG_OBJECT (m, "locking tlock from thread %p", g_thread_self ()); \
- g_mutex_lock ((m)->tlock); \
+ g_mutex_lock (&(m)->tlock); \
GST_LOG_OBJECT (m, "locked tlock from thread %p", g_thread_self ()); \
} G_STMT_END
#define GST_MPLEX_MUTEX_UNLOCK(m) G_STMT_START { \
GST_LOG_OBJECT (m, "unlocking tlock from thread %p", g_thread_self ()); \
- g_mutex_unlock ((m)->tlock); \
+ g_mutex_unlock (&(m)->tlock); \
} G_STMT_END
#define GST_MPLEX_WAIT(m, p) G_STMT_START { \
GST_LOG_OBJECT (m, "thread %p waiting", g_thread_self ()); \
- g_cond_wait ((p)->cond, (m)->tlock); \
+ g_cond_wait (&(p)->cond, &(m)->tlock); \
} G_STMT_END
#define GST_MPLEX_SIGNAL(m, p) G_STMT_START { \
GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ()); \
- g_cond_signal ((p)->cond); \
+ g_cond_signal (&(p)->cond); \
} G_STMT_END
#define GST_MPLEX_SIGNAL_ALL(m) G_STMT_START { \
/* no more to expect on this pad */
gboolean eos;
/* signals counterpart thread to have a look */
- GCond *cond;
+ GCond cond;
/* amount needed by mplex on this stream */
guint needed;
/* bitstream for this pad */
GstMplexJob *job;
/* lock for syncing */
- GMutex *tlock;
+ GMutex tlock;
/* with TLOCK */
/* muxer writer generated eos */
gboolean eos;
GST_DEBUG_OBJECT (src, "Starting capture");
- g_mutex_lock (src->capturing_mutex);
+ g_mutex_lock (&src->capturing_mutex);
if (src->capturing) {
GST_WARNING_OBJECT (src, "Capturing already ongoing");
- g_mutex_unlock (src->capturing_mutex);
+ g_mutex_unlock (&src->capturing_mutex);
/* post a warning to notify camerabin2 that the capture failed */
GST_ELEMENT_WARNING (src, RESOURCE, BUSY, (NULL), (NULL));
g_object_notify (G_OBJECT (src), "ready-for-capture");
GST_WARNING_OBJECT (src, "Failed to start capture");
}
- g_mutex_unlock (src->capturing_mutex);
+ g_mutex_unlock (&src->capturing_mutex);
}
static void
g_return_if_fail (klass->stop_capture != NULL);
- g_mutex_lock (src->capturing_mutex);
+ g_mutex_lock (&src->capturing_mutex);
if (!src->capturing) {
GST_DEBUG_OBJECT (src, "No ongoing capture");
- g_mutex_unlock (src->capturing_mutex);
+ g_mutex_unlock (&src->capturing_mutex);
return;
}
klass->stop_capture (src);
- g_mutex_unlock (src->capturing_mutex);
+ g_mutex_unlock (&src->capturing_mutex);
}
void
{
GstBaseCameraSrc *src = GST_BASE_CAMERA_SRC_CAST (object);
- g_mutex_free (src->capturing_mutex);
+ g_mutex_clear (&src->capturing_mutex);
if (src->preview_pipeline) {
gst_camerabin_destroy_preview_pipeline (src->preview_pipeline);
self->mode = MODE_IMAGE;
self->capturing = FALSE;
- self->capturing_mutex = g_mutex_new ();
+ g_mutex_init (&self->capturing_mutex);
self->post_preview = DEFAULT_POST_PREVIEW;
GstCameraBinMode mode;
gboolean capturing;
- GMutex *capturing_mutex;
+ GMutex capturing_mutex;
/* Preview convert pipeline */
GstCaps *preview_caps;
data->pipeline = NULL;
}
- g_cond_signal (data->processing_cond);
+ g_cond_signal (&data->processing_cond);
break;
}
"This element has no bus, therefore no message sent!");
}
- g_mutex_lock (data->processing_lock);
+ g_mutex_lock (&data->processing_lock);
data->processing--;
if (data->processing == 0)
- g_cond_signal (data->processing_cond);
+ g_cond_signal (&data->processing_cond);
- g_mutex_unlock (data->processing_lock);
+ g_mutex_unlock (&data->processing_lock);
return GST_FLOW_OK;
}
data->filter = filter;
data->vscale = vscale;
- data->processing_lock = g_mutex_new ();
- data->processing_cond = g_cond_new ();
+ g_mutex_init (&data->processing_lock);
+ g_cond_init (&data->processing_cond);
data->pending_preview_caps = NULL;
data->processing = 0;
{
g_return_if_fail (preview != NULL);
- if (preview->processing_lock) {
- g_mutex_free (preview->processing_lock);
- preview->processing_lock = NULL;
+ if (preview->processing_lock.p) {
+ g_mutex_clear (&preview->processing_lock);
+ preview->processing_lock.p = NULL;
}
- if (preview->processing_cond) {
- g_cond_free (preview->processing_cond);
- preview->processing_cond = NULL;
+ if (preview->processing_cond.p) {
+ g_cond_clear (&preview->processing_cond);
+ preview->processing_cond.p = NULL;
}
if (preview->pipeline) {
gst_element_set_state (preview->pipeline, GST_STATE_NULL);
g_return_val_if_fail (preview->pipeline != NULL, FALSE);
g_return_val_if_fail (buffer, FALSE);
- g_mutex_lock (preview->processing_lock);
+ g_mutex_lock (&preview->processing_lock);
g_return_val_if_fail (preview->pipeline != NULL, FALSE);
if (preview->pending_preview_caps) {
if (preview->processing > 0) {
- g_cond_wait (preview->processing_cond, preview->processing_lock);
+ g_cond_wait (&preview->processing_cond, &preview->processing_lock);
}
_gst_camerabin_preview_set_caps (preview, preview->pending_preview_caps);
gst_caps_replace (&preview->pending_preview_caps, NULL);
gst_app_src_push_buffer ((GstAppSrc *) preview->appsrc,
gst_buffer_ref (buffer));
- g_mutex_unlock (preview->processing_lock);
+ g_mutex_unlock (&preview->processing_lock);
return TRUE;
}
{
g_return_if_fail (preview != NULL);
- g_mutex_lock (preview->processing_lock);
+ g_mutex_lock (&preview->processing_lock);
if (preview->processing == 0) {
_gst_camerabin_preview_set_caps (preview, caps);
GST_DEBUG ("Preview pipeline busy, storing new caps as pending");
gst_caps_replace (&preview->pending_preview_caps, caps);
}
- g_mutex_unlock (preview->processing_lock);
+ g_mutex_unlock (&preview->processing_lock);
}
/**
GST_DEBUG ("Preview pipeline setting new filter %p", filter);
- g_mutex_lock (preview->processing_lock);
+ g_mutex_lock (&preview->processing_lock);
gst_element_get_state (preview->pipeline, ¤t, NULL, 0);
GST_WARNING ("Cannot change filter when pipeline is running");
ret = FALSE;
}
- g_mutex_unlock (preview->processing_lock);
+ g_mutex_unlock (&preview->processing_lock);
return ret;
}
GstCaps *pending_preview_caps;
guint processing;
- GMutex *processing_lock;
- GCond *processing_cond;
+ GMutex processing_lock;
+ GCond processing_cond;
} GstCameraBinPreviewPipelineData;
gst_segment_init (&base_video_codec->segment, GST_FORMAT_TIME);
- g_static_rec_mutex_init (&base_video_codec->stream_lock);
+ g_rec_mutex_init (&base_video_codec->stream_lock);
}
static void
{
GstBaseVideoCodec *base_video_codec = GST_BASE_VIDEO_CODEC (object);
- g_static_rec_mutex_free (&base_video_codec->stream_lock);
+ g_rec_mutex_clear (&base_video_codec->stream_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
*/
#define GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS
-#define GST_BASE_VIDEO_CODEC_STREAM_LOCK(codec) g_static_rec_mutex_lock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)
-#define GST_BASE_VIDEO_CODEC_STREAM_UNLOCK(codec) g_static_rec_mutex_unlock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)
+#define GST_BASE_VIDEO_CODEC_STREAM_LOCK(codec) g_rec_mutex_lock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)
+#define GST_BASE_VIDEO_CODEC_STREAM_UNLOCK(codec) g_rec_mutex_unlock (&GST_BASE_VIDEO_CODEC (codec)->stream_lock)
typedef struct _GstVideoState GstVideoState;
typedef struct _GstVideoFrameState GstVideoFrameState;
/* protects all data processing, i.e. is locked
* in the chain function, finish_frame and when
* processing serialized events */
- GStaticRecMutex stream_lock;
+ GRecMutex stream_lock;
guint64 system_frame_number;
scope->rate = GST_AUDIO_DEF_RATE;
scope->channels = 2;
- scope->config_lock = g_mutex_new ();
+ g_mutex_init (&scope->config_lock);
}
static void
g_free (scope->pixelbuf);
scope->pixelbuf = NULL;
}
- if (scope->config_lock) {
- g_mutex_free (scope->config_lock);
- scope->config_lock = NULL;
+ if (scope->config_lock.p) {
+ g_mutex_clear (&scope->config_lock);
+ scope->config_lock.p = NULL;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
gst_adapter_push (scope->adapter, buffer);
- g_mutex_lock (scope->config_lock);
+ g_mutex_lock (&scope->config_lock);
/* this is what we want */
sbpf = scope->req_spf * scope->channels * sizeof (gint16);
}
}
- g_mutex_unlock (scope->config_lock);
+ g_mutex_unlock (&scope->config_lock);
ret = gst_buffer_pool_acquire_buffer (scope->pool, &outbuf, NULL);
- g_mutex_lock (scope->config_lock);
+ g_mutex_lock (&scope->config_lock);
/* recheck as the value could have changed */
sbpf = scope->req_spf * scope->channels * sizeof (gint16);
gst_buffer_unmap (outbuf, vdata, scope->bpf);
- g_mutex_unlock (scope->config_lock);
+ g_mutex_unlock (&scope->config_lock);
ret = gst_pad_push (scope->srcpad, outbuf);
outbuf = NULL;
- g_mutex_lock (scope->config_lock);
+ g_mutex_lock (&scope->config_lock);
skip:
/* recheck as the value could have changed */
break;
}
- g_mutex_unlock (scope->config_lock);
+ g_mutex_unlock (&scope->config_lock);
beach:
return ret;
gint rate;
/* configuration mutex */
- GMutex *config_lock;
+ GMutex config_lock;
/* QoS stuff *//* with LOCK */
gdouble proportion;
return;
}
- g_mutex_lock (camerabin->video_capture_mutex);
+ g_mutex_lock (&camerabin->video_capture_mutex);
while (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING) {
- g_cond_wait (camerabin->video_state_cond, camerabin->video_capture_mutex);
+ g_cond_wait (&camerabin->video_state_cond,
+ &camerabin->video_capture_mutex);
}
if (camerabin->video_state != GST_CAMERA_BIN_VIDEO_IDLE) {
GST_WARNING_OBJECT (camerabin, "Another video recording is ongoing"
" (state %d), cannot start a new one", camerabin->video_state);
- g_mutex_unlock (camerabin->video_capture_mutex);
+ g_mutex_unlock (&camerabin->video_capture_mutex);
return;
}
camerabin->video_state = GST_CAMERA_BIN_VIDEO_STARTING;
}
} else {
/* store the next capture buffer filename */
- g_mutex_lock (camerabin->image_capture_mutex);
+ g_mutex_lock (&camerabin->image_capture_mutex);
camerabin->image_location_list =
g_slist_append (camerabin->image_location_list, g_strdup (location));
- g_mutex_unlock (camerabin->image_capture_mutex);
+ g_mutex_unlock (&camerabin->image_capture_mutex);
}
if (camerabin->post_previews) {
/* Count processing of preview images too */
GST_CAMERA_BIN2_PROCESSING_INC (camerabin);
/* store the next preview filename */
- g_mutex_lock (camerabin->preview_list_mutex);
+ g_mutex_lock (&camerabin->preview_list_mutex);
camerabin->preview_location_list =
g_slist_append (camerabin->preview_location_list, location);
- g_mutex_unlock (camerabin->preview_list_mutex);
+ g_mutex_unlock (&camerabin->preview_list_mutex);
} else {
g_free (location);
}
gst_element_set_state (camerabin->audio_src, GST_STATE_PLAYING);
camerabin->video_state = GST_CAMERA_BIN_VIDEO_RECORDING;
- g_mutex_unlock (camerabin->video_capture_mutex);
+ g_mutex_unlock (&camerabin->video_capture_mutex);
}
/*
if (camerabin->mode == MODE_IMAGE) {
/* Store image tags in a list and push them later, this prevents
start_capture() from blocking in pad_push_event call */
- g_mutex_lock (camerabin->image_capture_mutex);
+ g_mutex_lock (&camerabin->image_capture_mutex);
camerabin->image_tags_list =
g_slist_append (camerabin->image_tags_list,
taglist ? gst_tag_list_copy (taglist) : NULL);
- g_mutex_unlock (camerabin->image_capture_mutex);
+ g_mutex_unlock (&camerabin->image_capture_mutex);
} else if (taglist) {
GstPad *active_pad;
{
GST_DEBUG_OBJECT (camerabin, "Received stop-capture");
if (camerabin->mode == MODE_VIDEO) {
- g_mutex_lock (camerabin->video_capture_mutex);
+ g_mutex_lock (&camerabin->video_capture_mutex);
if (camerabin->video_state == GST_CAMERA_BIN_VIDEO_RECORDING) {
if (camerabin->src)
g_signal_emit_by_name (camerabin->src, "stop-capture", NULL);
gst_element_send_event (camerabin->audio_src, gst_event_new_eos ());
}
}
- g_mutex_unlock (camerabin->video_capture_mutex);
+ g_mutex_unlock (&camerabin->video_capture_mutex);
}
}
GstCameraBin2 *camerabin = GST_CAMERA_BIN2_CAST (object);
g_free (camerabin->location);
- g_mutex_free (camerabin->preview_list_mutex);
- g_mutex_free (camerabin->image_capture_mutex);
- g_mutex_free (camerabin->video_capture_mutex);
- g_cond_free (camerabin->video_state_cond);
+ g_mutex_clear (&camerabin->preview_list_mutex);
+ g_mutex_clear (&camerabin->image_capture_mutex);
+ g_mutex_clear (&camerabin->video_capture_mutex);
+ g_cond_clear (&camerabin->video_state_cond);
if (camerabin->src_capture_notify_id)
g_signal_handler_disconnect (camerabin->src,
camera->zoom = DEFAULT_ZOOM;
camera->max_zoom = MAX_ZOOM;
camera->flags = DEFAULT_FLAGS;
- camera->preview_list_mutex = g_mutex_new ();
- camera->image_capture_mutex = g_mutex_new ();
- camera->video_capture_mutex = g_mutex_new ();
- camera->video_state_cond = g_cond_new ();
+ g_mutex_init (&camera->preview_list_mutex);
+ g_mutex_init (&camera->image_capture_mutex);
+ g_mutex_init (&camera->video_capture_mutex);
+ g_cond_init (&camera->video_state_cond);
/* capsfilters are created here as we proxy their caps properties and
* this way we avoid having to store the caps while on NULL state to
{
gchar *location;
- g_mutex_lock (camerabin->preview_list_mutex);
+ g_mutex_lock (&camerabin->preview_list_mutex);
if (camerabin->preview_location_list) {
location = camerabin->preview_location_list->data;
GST_DEBUG_OBJECT (camerabin, "Skipping preview for %s", location);
} else {
GST_WARNING_OBJECT (camerabin, "No previews to skip");
}
- g_mutex_unlock (camerabin->preview_list_mutex);
+ g_mutex_unlock (&camerabin->preview_list_mutex);
}
static gpointer
GstCameraBin2 *camerabin = GST_CAMERA_BIN2_CAST (u_data);
GST_DEBUG_OBJECT (camerabin, "Resetting video elements state");
- g_mutex_lock (camerabin->video_capture_mutex);
+ g_mutex_lock (&camerabin->video_capture_mutex);
/* reset element states to clear eos/flushing pads */
gst_element_set_state (camerabin->video_encodebin, GST_STATE_READY);
GST_DEBUG_OBJECT (camerabin, "Setting video state to idle");
camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
- g_cond_signal (camerabin->video_state_cond);
- g_mutex_unlock (camerabin->video_capture_mutex);
+ g_cond_signal (&camerabin->video_state_cond);
+ g_mutex_unlock (&camerabin->video_capture_mutex);
gst_object_unref (camerabin);
return NULL;
} else if (gst_structure_has_name (structure, "preview-image")) {
gchar *location = NULL;
- g_mutex_lock (camerabin->preview_list_mutex);
+ g_mutex_lock (&camerabin->preview_list_mutex);
if (camerabin->preview_location_list) {
location = camerabin->preview_location_list->data;
camerabin->preview_location_list =
"happen if the source is posting previews while camerabin2 is "
"shutting down");
}
- g_mutex_unlock (camerabin->preview_list_mutex);
+ g_mutex_unlock (&camerabin->preview_list_mutex);
if (location) {
GValue value = { 0 };
GstElement *src = GST_ELEMENT (GST_MESSAGE_SRC (message));
if (src == GST_CAMERA_BIN2_CAST (bin)->videosink) {
- g_mutex_lock (camerabin->video_capture_mutex);
+ g_mutex_lock (&camerabin->video_capture_mutex);
GST_DEBUG_OBJECT (bin, "EOS from video branch");
g_assert (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING);
gst_video_capture_bin_post_video_done (GST_CAMERA_BIN2_CAST (bin));
dec_counter = TRUE;
- if (!g_thread_create (gst_camera_bin_video_reset_elements,
- gst_object_ref (camerabin), FALSE, NULL)) {
- GST_WARNING_OBJECT (camerabin, "Failed to create thread to "
+ if (!g_thread_try_new ("reset-element-thread",
+ gst_camera_bin_video_reset_elements, gst_object_ref (camerabin),
+ NULL)) {
+ GST_WARNING_OBJECT (camerabin,
+ "Failed to create thread to "
"reset video elements' state, video recordings may not work "
"anymore");
gst_object_unref (camerabin);
camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
}
- g_mutex_unlock (camerabin->video_capture_mutex);
+ g_mutex_unlock (&camerabin->video_capture_mutex);
}
}
break;
GstPad *peer;
GstTagList *tags;
- g_mutex_lock (camerabin->image_capture_mutex);
+ g_mutex_lock (&camerabin->image_capture_mutex);
/* Push pending image tags */
if (camerabin->image_tags_list) {
location);
} else {
GST_DEBUG_OBJECT (camerabin, "No filename location change to send");
- g_mutex_unlock (camerabin->image_capture_mutex);
+ g_mutex_unlock (&camerabin->image_capture_mutex);
return ret;
}
- g_mutex_unlock (camerabin->image_capture_mutex);
+ g_mutex_unlock (&camerabin->image_capture_mutex);
if (location) {
evt = gst_camera_bin_new_event_file_location (location);
GST_CAMERA_BIN2_RESET_PROCESSING_COUNTER (camera);
camera->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
- g_mutex_lock (camera->image_capture_mutex);
+ g_mutex_lock (&camera->image_capture_mutex);
g_slist_foreach (camera->image_location_list, (GFunc) g_free, NULL);
g_slist_free (camera->image_location_list);
camera->image_location_list = NULL;
(GFunc) _gst_tag_list_free_maybe, NULL);
g_slist_free (camera->image_tags_list);
camera->image_tags_list = NULL;
- g_mutex_unlock (camera->image_capture_mutex);
+ g_mutex_unlock (&camera->image_capture_mutex);
- g_mutex_lock (camera->preview_list_mutex);
+ g_mutex_lock (&camera->preview_list_mutex);
g_slist_foreach (camera->preview_location_list, (GFunc) g_free, NULL);
g_slist_free (camera->preview_location_list);
camera->preview_location_list = NULL;
- g_mutex_unlock (camera->preview_list_mutex);
+ g_mutex_unlock (&camera->preview_list_mutex);
/* explicitly set to READY as they might be outside of the bin */
gst_element_set_state (camera->audio_volume, GST_STATE_READY);
/* Index of the auto incrementing file index for captures */
gint capture_index;
- GMutex *image_capture_mutex;
+ GMutex image_capture_mutex;
/* stores list of image locations to be pushed to the image sink
* as file location change notifications, they are pushed before
* each buffer capture */
* list and the message handling function looking at preview names)
*/
GSList *preview_location_list;
- GMutex *preview_list_mutex;
+ GMutex preview_list_mutex;
gboolean video_profile_switch;
gboolean image_profile_switch;
gboolean audio_drop_eos;
gboolean audio_send_newseg;
- GMutex *video_capture_mutex;
- GCond *video_state_cond;
+ GMutex video_capture_mutex;
+ GCond video_state_cond;
GstCameraBinVideoState video_state;
/* properties */
GST_LOG_OBJECT (self, "Image probe, mode %d, capture count %d",
camerasrc->mode, self->image_capture_count);
- g_mutex_lock (camerasrc->capturing_mutex);
+ g_mutex_lock (&camerasrc->capturing_mutex);
if (self->image_capture_count > 0) {
ret = GST_PAD_PROBE_OK;
self->image_capture_count--;
gst_base_camera_src_finish_capture (camerasrc);
}
}
- g_mutex_unlock (camerasrc->capturing_mutex);
+ g_mutex_unlock (&camerasrc->capturing_mutex);
return ret;
}
* probe.
*/
/* TODO shouldn't access this directly */
- g_mutex_lock (camerasrc->capturing_mutex);
+ g_mutex_lock (&camerasrc->capturing_mutex);
if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) {
/* NOP */
} else if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_STARTING) {
} else {
ret = GST_PAD_PROBE_OK;
}
- g_mutex_unlock (camerasrc->capturing_mutex);
+ g_mutex_unlock (&camerasrc->capturing_mutex);
return ret;
}
(GstPhotoCapturePrepared) img_capture_prepared,
self->image_capture_caps, self);
} else {
- g_mutex_unlock (bcamsrc->capturing_mutex);
+ g_mutex_unlock (&bcamsrc->capturing_mutex);
gst_wrapper_camera_bin_reset_video_src_caps (self,
self->image_capture_caps);
- g_mutex_lock (bcamsrc->capturing_mutex);
+ g_mutex_lock (&bcamsrc->capturing_mutex);
ret = TRUE;
}
GstCaps *caps = NULL;
if (src->video_renegotiate) {
- g_mutex_unlock (camerasrc->capturing_mutex);
+ g_mutex_unlock (&camerasrc->capturing_mutex);
gst_wrapper_camera_bin_reset_video_src_caps (src, NULL);
- g_mutex_lock (camerasrc->capturing_mutex);
+ g_mutex_lock (&camerasrc->capturing_mutex);
/* clean capsfilter caps so they don't interfere here */
g_object_set (src->src_filter, "caps", NULL, NULL);
GST_DEBUG_OBJECT (src, "Video src caps %" GST_PTR_FORMAT, caps);
src->video_renegotiate = FALSE;
- g_mutex_unlock (camerasrc->capturing_mutex);
+ g_mutex_unlock (&camerasrc->capturing_mutex);
gst_wrapper_camera_bin_reset_video_src_caps (src, caps);
- g_mutex_lock (camerasrc->capturing_mutex);
+ g_mutex_lock (&camerasrc->capturing_mutex);
gst_caps_unref (caps);
}
if (src->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) {
{
DVBSubtitles *subs;
- g_mutex_lock (render->dvbsub_mutex);
+ g_mutex_lock (&render->dvbsub_mutex);
while ((subs = g_queue_pop_head (render->pending_subtitles))) {
dvb_subtitles_free (subs);
}
dvb_sub_set_callbacks (render->dvb_sub, &dvbsub_callbacks, render);
}
- g_mutex_unlock (render->dvbsub_mutex);
+ g_mutex_unlock (&render->dvbsub_mutex);
}
static void
render->enable = DEFAULT_ENABLE;
render->max_page_timeout = DEFAULT_MAX_PAGE_TIMEOUT;
- render->dvbsub_mutex = g_mutex_new ();
+ g_mutex_init (&render->dvbsub_mutex);
gst_dvbsub_overlay_flush_subtitles (render);
gst_segment_init (&render->video_segment, GST_FORMAT_TIME);
if (overlay->dvb_sub)
dvb_sub_free (overlay->dvb_sub);
- if (overlay->dvbsub_mutex)
- g_mutex_free (overlay->dvbsub_mutex);
+ g_mutex_clear (&overlay->dvbsub_mutex);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
- g_mutex_lock (overlay->dvbsub_mutex);
+ g_mutex_lock (&overlay->dvbsub_mutex);
dvb_sub_feed_with_pts (overlay->dvb_sub, pts, data, size);
- g_mutex_unlock (overlay->dvbsub_mutex);
+ g_mutex_unlock (&overlay->dvbsub_mutex);
gst_buffer_unmap (buffer, data, size);
gst_buffer_unref (buffer);
overlay->video_segment.position = GST_BUFFER_TIMESTAMP (buffer);
- g_mutex_lock (overlay->dvbsub_mutex);
+ g_mutex_lock (&overlay->dvbsub_mutex);
if (!g_queue_is_empty (overlay->pending_subtitles)) {
DVBSubtitles *tmp, *candidate = NULL;
blit_i420 (overlay, overlay->current_subtitle, &frame);
gst_video_frame_unmap (&frame);
}
- g_mutex_unlock (overlay->dvbsub_mutex);
+ g_mutex_unlock (&overlay->dvbsub_mutex);
ret = gst_pad_push (overlay->srcpad, buffer);
GQueue *pending_subtitles; /* A queue of raw subtitle region sets with
* metadata that are waiting their running time */
- GMutex *dvbsub_mutex; /* protects the queue and the DvbSub instance */
+ GMutex dvbsub_mutex; /* protects the queue and the DvbSub instance */
DvbSub *dvb_sub;
};
gst_element_add_pad (GST_ELEMENT (dvdspu), dvdspu->subpic_sinkpad);
gst_element_add_pad (GST_ELEMENT (dvdspu), dvdspu->srcpad);
- dvdspu->spu_lock = g_mutex_new ();
+ g_mutex_init (&dvdspu->spu_lock);
dvdspu->pending_spus = g_queue_new ();
gst_dvd_spu_clear (dvdspu);
}
}
g_queue_free (dvdspu->pending_spus);
- g_mutex_free (dvdspu->spu_lock);
+ g_mutex_clear (&dvdspu->spu_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
#define GST_IS_DVD_SPU_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVD_SPU))
-#define DVD_SPU_LOCK(s) g_mutex_lock ((s)->spu_lock);
-#define DVD_SPU_UNLOCK(s) g_mutex_unlock ((s)->spu_lock);
+#define DVD_SPU_LOCK(s) g_mutex_lock (&(s)->spu_lock);
+#define DVD_SPU_UNLOCK(s) g_mutex_unlock (&(s)->spu_lock);
typedef struct _GstDVDSpuClass GstDVDSpuClass;
GstPad *srcpad;
/* Mutex to protect state we access from different chain funcs */
- GMutex *spu_lock;
+ GMutex spu_lock;
GstSegment video_seg;
GstSegment subp_seg;
#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>
this = GST_MULTI_FD_SINK (object);
- CLIENTS_LOCK_FREE (this);
+ CLIENTS_LOCK_CLEAR (this);
g_hash_table_destroy (this->fd_hash);
g_array_free (this->bufqueue, TRUE);
guint64 last_buffer_ts;
} GstTCPClient;
-#define CLIENTS_LOCK_INIT(fdsink) (g_static_rec_mutex_init(&fdsink->clientslock))
-#define CLIENTS_LOCK_FREE(fdsink) (g_static_rec_mutex_free(&fdsink->clientslock))
-#define CLIENTS_LOCK(fdsink) (g_static_rec_mutex_lock(&fdsink->clientslock))
-#define CLIENTS_UNLOCK(fdsink) (g_static_rec_mutex_unlock(&fdsink->clientslock))
+#define CLIENTS_LOCK_INIT(fdsink) (g_rec_mutex_init(&fdsink->clientslock))
+#define CLIENTS_LOCK_CLEAR(fdsink) (g_rec_mutex_clear(&fdsink->clientslock))
+#define CLIENTS_LOCK(fdsink) (g_rec_mutex_lock(&fdsink->clientslock))
+#define CLIENTS_UNLOCK(fdsink) (g_rec_mutex_unlock(&fdsink->clientslock))
/**
* GstMultiFdSink:
guint64 bytes_to_serve; /* how much bytes we must serve */
guint64 bytes_served; /* how much bytes have we served */
- GStaticRecMutex clientslock; /* lock to protect the clients list */
+ GRecMutex clientslock; /* lock to protect the clients list */
GList *clients; /* list of clients we are serving */
GHashTable *fd_hash; /* index on fd to client */
guint clients_cookie; /* Cookie to detect changes to the clients list */
/* protects the streaming thread in interleaved mode or the polling
* thread in UDP mode. */
- demux->stream_rec_lock = g_new (GStaticRecMutex, 1);
- g_static_rec_mutex_init (demux->stream_rec_lock);
+ g_rec_mutex_init (&demux->stream_rec_lock);
demux->adapter = gst_adapter_new ();
}
demux = GST_SDP_DEMUX (object);
/* free locks */
- g_static_rec_mutex_free (demux->stream_rec_lock);
- g_free (demux->stream_rec_lock);
+ g_rec_mutex_clear (&demux->stream_rec_lock);
g_object_unref (demux->adapter);
typedef struct _GstSDPDemux GstSDPDemux;
typedef struct _GstSDPDemuxClass GstSDPDemuxClass;
-#define GST_SDP_STREAM_GET_LOCK(sdp) (GST_SDP_DEMUX_CAST(sdp)->stream_rec_lock)
-#define GST_SDP_STREAM_LOCK(sdp) (g_static_rec_mutex_lock (GST_SDP_STREAM_GET_LOCK(sdp)))
-#define GST_SDP_STREAM_UNLOCK(sdp) (g_static_rec_mutex_unlock (GST_SDP_STREAM_GET_LOCK(sdp)))
+#define GST_SDP_STREAM_GET_LOCK(sdp) (&GST_SDP_DEMUX_CAST(sdp)->stream_rec_lock)
+#define GST_SDP_STREAM_LOCK(sdp) (g_rec_mutex_lock (GST_SDP_STREAM_GET_LOCK(sdp)))
+#define GST_SDP_STREAM_UNLOCK(sdp) (g_rec_mutex_unlock (GST_SDP_STREAM_GET_LOCK(sdp)))
typedef struct _GstSDPStream GstSDPStream;
gboolean ignore_timeout;
gint numstreams;
- GStaticRecMutex *stream_rec_lock;
+ GRecMutex stream_rec_lock;
GList *streams;
/* properties */
object->inversion = DEFAULT_INVERSION;
object->stats_interval = DEFAULT_STATS_REPORTING_INTERVAL;
- object->tune_mutex = g_mutex_new ();
+ g_mutex_init (&object->tune_mutex);
object->timeout = DEFAULT_TIMEOUT;
}
/* if we are in paused/playing state tune now, otherwise in ready to paused state change */
if (GST_STATE (object) > GST_STATE_READY) {
- g_mutex_lock (object->tune_mutex);
+ g_mutex_lock (&object->tune_mutex);
gst_dvbsrc_tune (object);
- g_mutex_unlock (object->tune_mutex);
+ g_mutex_unlock (&object->tune_mutex);
}
break;
}
object = GST_DVBSRC (_object);
/* freeing the mutex segfaults somehow */
- g_mutex_free (object->tune_mutex);
+ g_mutex_clear (&object->tune_mutex);
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (_object);
buffer_size = DEFAULT_BUFFER_SIZE;
/* device can not be tuned during read */
- g_mutex_lock (object->tune_mutex);
+ g_mutex_lock (&object->tune_mutex);
if (object->fd_dvr > -1) {
}
}
- g_mutex_unlock (object->tune_mutex);
+ g_mutex_unlock (&object->tune_mutex);
return retval;
}
GstPushSrc element;
GstPad *srcpad;
- GMutex *tune_mutex;
+ GMutex tune_mutex;
gboolean need_tune;
int adapter_type;
GOptionContext *ctx;
GError *err = NULL;
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
ctx = g_option_context_new (NULL);
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
GOptionContext *ctx;
GError *err = NULL;
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
ctx = g_option_context_new ("\n\ncamerabin command line test application.");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
GOptionContext *ctx;
GError *err = NULL;
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
ctx = g_option_context_new ("\n\ncamerabin command line test application.");
g_option_context_add_main_entries (ctx, options, NULL);
g_option_context_add_group (ctx, gst_init_get_option_group ());
return -1;
}
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
gst_init (NULL, NULL);
gtk_init (NULL, NULL);
status_bar_printf (GTK_STATUSBAR (status_bar), 5,
"Welcome to the Scaletempo demo.");
- if (!g_thread_create ((GThreadFunc) gtk_main, NULL, FALSE, &error)) {
+ if (!g_thread_try_new ("name", (GThreadFunc) gtk_main, NULL, &error)) {
g_signal_emit (gui, demo_gui_signals[SIGNAL_ERROR], 0, error->message);
}
}
{NULL,}
};
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
ctx = g_option_context_new ("uri ...");
g_option_context_add_group (ctx, gst_init_get_option_group ());
g_option_context_add_group (ctx, gtk_get_option_group (FALSE));