+ 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;
+ }
+