Commit 50bc831c authored by Stefan Sauer's avatar Stefan Sauer

Merge branch '0.10'

Conflicts:
	gst/matroska/matroska-demux.c
	gst/matroska/matroska-mux.c
	gst/matroska/matroska-read-common.c
	gst/matroska/matroska-read-common.h
parents 766d3bc6 113ba4ac
......@@ -419,6 +419,7 @@ gst_matroska_demux_reset (GstElement * element)
demux->tracks_parsed = FALSE;
demux->common.segmentinfo_parsed = FALSE;
demux->common.attachments_parsed = FALSE;
demux->common.chapters_parsed = FALSE;
g_list_foreach (demux->common.tags_parsed,
(GFunc) gst_matroska_demux_free_parsed_el, NULL);
......@@ -477,6 +478,12 @@ gst_matroska_demux_reset (GstElement * element)
demux->common.cached_buffer = NULL;
}
/* free chapters TOC if any */
if (demux->common.toc) {
gst_toc_free (demux->common.toc);
demux->common.toc = NULL;
}
demux->invalid_duration = FALSE;
}
......@@ -1422,6 +1429,23 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad,
GST_OBJECT_UNLOCK (demux);
break;
}
case GST_QUERY_TOC:
{
GstToc *toc;
GST_OBJECT_LOCK (demux);
if (demux->common.toc)
toc = demux->common.toc;
else
toc = gst_toc_new ();
gst_query_set_toc (query, toc, 0);
res = TRUE;
if (!demux->common.toc)
gst_toc_free (toc);
GST_OBJECT_UNLOCK (demux);
break;
}
default:
res = gst_pad_query_default (pad, (GstObject *) demux, query);
break;
......@@ -2213,6 +2237,45 @@ gst_matroska_demux_handle_src_event (GstPad * pad, GstObject * parent,
break;
}
case GST_EVENT_TOC_SELECT:
{
char *uid = NULL;
GstTocEntry *entry = NULL;
GstEvent *seek_event;
gint64 start_pos;
if (!demux->common.toc) {
GST_DEBUG_OBJECT (demux, "no TOC to select");
return FALSE;
} else {
gst_event_parse_toc_select (event, &uid);
if (uid != NULL) {
GST_OBJECT_LOCK (demux);
entry = gst_toc_find_entry (demux->common.toc, uid);
if (entry == NULL) {
GST_OBJECT_UNLOCK (demux);
GST_WARNING_OBJECT (demux, "no TOC entry with given UID: %s", uid);
res = FALSE;
} else {
gst_toc_entry_get_start_stop (entry, &start_pos, NULL);
GST_OBJECT_UNLOCK (demux);
seek_event = gst_event_new_seek (1.0,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_SET, start_pos, GST_SEEK_TYPE_SET, -1);
res = gst_matroska_demux_handle_seek_event (demux, pad, seek_event);
gst_event_unref (seek_event);
}
g_free (uid);
} else {
GST_WARNING_OBJECT (demux, "received empty TOC select event");
res = FALSE;
}
}
gst_event_unref (event);
break;
}
/* events we don't need to handle */
case GST_EVENT_NAVIGATION:
gst_event_unref (event);
......@@ -4281,8 +4344,20 @@ gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
GST_ELEMENT_CAST (demux), &ebml);
break;
case GST_MATROSKA_ID_CHAPTERS:
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
ret = gst_matroska_read_common_parse_chapters (&demux->common, &ebml);
if (!demux->common.chapters_parsed) {
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
ret =
gst_matroska_read_common_parse_chapters (&demux->common, &ebml);
if (demux->common.toc) {
gst_matroska_demux_send_event (demux,
gst_event_new_toc (demux->common.toc, FALSE));
gst_element_post_message (GST_ELEMENT_CAST (demux),
gst_message_new_toc (GST_OBJECT_CAST (demux),
demux->common.toc, FALSE));
}
} else
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
break;
case GST_MATROSKA_ID_SEEKHEAD:
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
......
This diff is collapsed.
......@@ -113,6 +113,7 @@ typedef struct _GstMatroskaMux {
guint64 segment_pos,
seekhead_pos,
cues_pos,
chapters_pos,
tags_pos,
info_pos,
tracks_pos,
......@@ -128,7 +129,6 @@ typedef struct _GstMatroskaMux {
/* GstForceKeyUnit event */
GstEvent *force_key_unit_event;
} GstMatroskaMux;
typedef struct _GstMatroskaMuxClass {
......
This diff is collapsed.
......@@ -61,12 +61,18 @@ typedef struct _GstMatroskaReadCommon {
/* state */
GstMatroskaReadState state;
/* did we parse cues/tracks/segmentinfo already? */
gboolean index_parsed;
gboolean segmentinfo_parsed;
gboolean attachments_parsed;
gboolean chapters_parsed;
GList *tags_parsed;
/* chapters stuff */
GstToc *toc;
gboolean toc_updated;
/* start-of-segment */
guint64 ebml_segment_start;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment