GST_DEBUG_CATEGORY (sub_parse_debug);
+#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
+#define SUBPARSE_SEEK_GET_LOCK(elem) (&elem->seek_lock)
+#define SUBPARSE_SEEK_LOCK(elem) g_mutex_lock(SUBPARSE_SEEK_GET_LOCK(elem))
+#define SUBPARSE_SEEK_TRYLOCK(elem) g_mutex_trylock(SUBPARSE_SEEK_GET_LOCK(elem))
+#define SUBPARSE_SEEK_UNLOCK(elem) g_mutex_unlock(SUBPARSE_SEEK_GET_LOCK(elem))
+#endif
+
#define DEFAULT_ENCODING NULL
#define ATTRIBUTE_REGEX "\\s?[a-zA-Z0-9\\. \t\\(\\)]*"
static const gchar *allowed_srt_tags[] = { "i", "b", "u", NULL };
}
#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
- g_mutex_lock (&self->seek_lock);
+ SUBPARSE_SEEK_LOCK (self);
#endif
/* Convert that seek to a seeking in bytes at position 0,
FIXME: could use an index */
}
#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
- g_mutex_unlock (&self->seek_lock);
+ SUBPARSE_SEEK_UNLOCK (self);
#endif
gst_event_unref (event);
case GST_EVENT_SEGMENT:
{
const GstSegment *s;
+
+#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
+ if (!SUBPARSE_SEEK_TRYLOCK (self)) {
+ /* new seeking request is in process */
+ GST_WARNING_OBJECT (self, "ignore the old newsegment event");
+ ret = TRUE;
+ gst_event_unref (event);
+ break;
+ }
+#endif
+
gst_event_parse_segment (event, &s);
if (s->format == GST_FORMAT_TIME)
gst_event_copy_segment (event, &self->segment);
/* in either case, let's not simply discard this event;
* trigger sending of the saved requested seek segment
* or the one taken here from upstream */
-#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
- g_mutex_lock (&self->seek_lock);
- self->need_segment = TRUE; /* upstream */
- g_mutex_unlock (&self->seek_lock);
-#else
+
self->need_segment = TRUE; /* upstream */
+
+#ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION
+ SUBPARSE_SEEK_UNLOCK (self);
#endif
break;