return base_text_overlay_line_align_type;
}
-#define GST_BASE_TEXT_OVERLAY_GET_COND(ov) (((GstBaseTextOverlay *)ov)->cond)
-#define GST_BASE_TEXT_OVERLAY_WAIT(ov) (g_cond_wait (&GST_BASE_TEXT_OVERLAY_GET_COND (ov), GST_OBJECT_GET_LOCK (ov)))
-#define GST_BASE_TEXT_OVERLAY_SIGNAL(ov) (g_cond_signal (&GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
-#define GST_BASE_TEXT_OVERLAY_BROADCAST(ov)(g_cond_broadcast (&GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
+#define GST_BASE_TEXT_OVERLAY_GET_LOCK(ov) (&GST_BASE_TEXT_OVERLAY (ov)->lock)
+#define GST_BASE_TEXT_OVERLAY_GET_COND(ov) (&GST_BASE_TEXT_OVERLAY (ov)->cond)
+#define GST_BASE_TEXT_OVERLAY_LOCK(ov) (g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_LOCK (ov)))
+#define GST_BASE_TEXT_OVERLAY_UNLOCK(ov) (g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_LOCK (ov)))
+#define GST_BASE_TEXT_OVERLAY_WAIT(ov) (g_cond_wait (GST_BASE_TEXT_OVERLAY_GET_COND (ov), GST_BASE_TEXT_OVERLAY_GET_LOCK (ov)))
+#define GST_BASE_TEXT_OVERLAY_SIGNAL(ov) (g_cond_signal (GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
+#define GST_BASE_TEXT_OVERLAY_BROADCAST(ov)(g_cond_broadcast (GST_BASE_TEXT_OVERLAY_GET_COND (ov)))
static GstElementClass *parent_class = NULL;
static void gst_base_text_overlay_base_init (gpointer g_class);
overlay->text_buffer = NULL;
}
+ g_mutex_clear (&overlay->lock);
g_cond_clear (&overlay->cond);
G_OBJECT_CLASS (parent_class)->finalize (object);
overlay->text_buffer = NULL;
overlay->text_linked = FALSE;
+ g_mutex_init (&overlay->lock);
g_cond_init (&overlay->cond);
gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
ret = gst_pad_push_event (overlay->srcpad, gst_event_new_caps (caps));
if (ret) {
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
g_mutex_lock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
gst_base_text_overlay_update_wrap_mode (overlay);
g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
}
return ret;
{
GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (object);
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
switch (prop_id) {
case PROP_TEXT:
g_free (overlay->default_text);
}
overlay->need_render = TRUE;
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
}
static void
{
GstBaseTextOverlay *overlay = GST_BASE_TEXT_OVERLAY (object);
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
switch (prop_id) {
case PROP_TEXT:
g_value_set_string (value, overlay->default_text);
}
overlay->need_render = TRUE;
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
}
static gboolean
gst_pad_push_event (overlay->srcpad, gst_event_new_flush_start ());
/* Mark ourself as flushing, unblock chains */
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
overlay->video_flushing = TRUE;
overlay->text_flushing = TRUE;
gst_base_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
/* Seek on each sink pad */
gst_event_ref (event);
gst_event_parse_segment (event, &segment);
if (segment->format == GST_FORMAT_TIME) {
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
gst_segment_copy_into (segment, &overlay->text_segment);
GST_DEBUG_OBJECT (overlay, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT,
&overlay->text_segment);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
} else {
GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL),
("received non-TIME newsegment event on text input"));
/* wake up the video chain, it might be waiting for a text buffer or
* a text segment update */
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
break;
}
case GST_EVENT_FLUSH_STOP:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_INFO_OBJECT (overlay, "text flush stop");
overlay->text_flushing = FALSE;
overlay->text_eos = FALSE;
gst_base_text_overlay_pop_text (overlay);
gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
gst_event_unref (event);
ret = TRUE;
break;
case GST_EVENT_FLUSH_START:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_INFO_OBJECT (overlay, "text flush start");
overlay->text_flushing = TRUE;
GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
gst_event_unref (event);
ret = TRUE;
break;
case GST_EVENT_EOS:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
overlay->text_eos = TRUE;
GST_INFO_OBJECT (overlay, "text EOS");
/* wake up the video chain, it might be waiting for a text buffer or
* a text segment update */
GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
gst_event_unref (event);
ret = TRUE;
break;
break;
}
case GST_EVENT_EOS:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_INFO_OBJECT (overlay, "video EOS");
overlay->video_eos = TRUE;
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = gst_pad_event_default (pad, parent, event);
break;
case GST_EVENT_FLUSH_START:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_INFO_OBJECT (overlay, "video flush start");
overlay->video_flushing = TRUE;
GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = gst_pad_event_default (pad, parent, event);
break;
case GST_EVENT_FLUSH_STOP:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
GST_INFO_OBJECT (overlay, "video flush stop");
overlay->video_flushing = FALSE;
overlay->video_eos = FALSE;
gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = gst_pad_event_default (pad, parent, event);
break;
default:
overlay = GST_BASE_TEXT_OVERLAY (parent);
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
if (overlay->text_flushing) {
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = GST_FLOW_FLUSHING;
GST_LOG_OBJECT (overlay, "text flushing");
goto beach;
}
if (overlay->text_eos) {
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = GST_FLOW_EOS;
GST_LOG_OBJECT (overlay, "text EOS");
goto beach;
GST_BASE_TEXT_OVERLAY_WAIT (overlay);
GST_DEBUG ("Pad %s:%s resuming", GST_DEBUG_PAD_NAME (pad));
if (overlay->text_flushing) {
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = GST_FLOW_FLUSHING;
goto beach;
}
GST_BASE_TEXT_OVERLAY_BROADCAST (overlay);
}
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
beach:
wait_for_text_buf:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
if (overlay->video_flushing)
goto flushing;
goto have_eos;
if (overlay->silent) {
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = gst_pad_push (overlay->srcpad, buffer);
/* Update position */
GST_LOG_OBJECT (overlay, "Text pad not linked, rendering default "
"text: '%s'", GST_STR_NULL (text));
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
if (text != NULL && *text != '\0') {
/* Render and push */
GST_LOG_OBJECT (overlay, "text buffer too old, popping");
pop_text = FALSE;
gst_base_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
goto wait_for_text_buf;
} else if (valid_text_time && vid_running_time_end <= text_running_time) {
GST_LOG_OBJECT (overlay, "text in future, pushing video buf");
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
/* Push the video frame */
ret = gst_pad_push (overlay->srcpad, buffer);
} else {
gst_buffer_unmap (overlay->text_buffer, &map);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
ret = gst_base_text_overlay_push_frame (overlay, buffer);
if (valid_text_time && text_running_time_end <= vid_running_time_end) {
}
}
if (pop_text) {
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
gst_base_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
}
} else {
gboolean wait_for_text_buf = TRUE;
GST_DEBUG_OBJECT (overlay, "no text buffer, need to wait for one");
GST_BASE_TEXT_OVERLAY_WAIT (overlay);
GST_DEBUG_OBJECT (overlay, "resuming");
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
goto wait_for_text_buf;
} else {
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
GST_LOG_OBJECT (overlay, "no need to wait for a text buffer");
ret = gst_pad_push (overlay->srcpad, buffer);
}
flushing:
{
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
GST_DEBUG_OBJECT (overlay, "flushing, discarding buffer");
gst_buffer_unref (buffer);
return GST_FLOW_FLUSHING;
}
have_eos:
{
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
GST_DEBUG_OBJECT (overlay, "eos, discarding buffer");
gst_buffer_unref (buffer);
return GST_FLOW_EOS;
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
overlay->text_flushing = TRUE;
overlay->video_flushing = TRUE;
/* pop_text will broadcast on the GCond and thus also make the video
* chain exit if it's waiting for a text buffer */
gst_base_text_overlay_pop_text (overlay);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
break;
default:
break;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
- GST_OBJECT_LOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_LOCK (overlay);
overlay->text_flushing = FALSE;
overlay->video_flushing = FALSE;
overlay->video_eos = FALSE;
overlay->text_eos = FALSE;
gst_segment_init (&overlay->segment, GST_FORMAT_TIME);
gst_segment_init (&overlay->text_segment, GST_FORMAT_TIME);
- GST_OBJECT_UNLOCK (overlay);
+ GST_BASE_TEXT_OVERLAY_UNLOCK (overlay);
break;
default:
break;