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, query);
+ res = gst_pad_query_default (pad, (GstObject *) demux, query);
break;
}
static GArray *used_uids;
G_LOCK_DEFINE_STATIC (used_uids);
-static void gst_matroska_mux_add_interfaces (GType type);
-
-GST_BOILERPLATE_FULL (GstMatroskaMux, gst_matroska_mux, GstElement,
- GST_TYPE_ELEMENT, gst_matroska_mux_add_interfaces);
+#define parent_class gst_matroska_mux_parent_class
+G_DEFINE_TYPE_WITH_CODE (GstMatroskaMux, gst_matroska_mux, GST_TYPE_ELEMENT,
- G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL));
++ G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)
++ G_IMPLEMENT_INTERFACE (GST_TYPE_TOC_SETTER, NULL)
++ );
/* Matroska muxer destructor */
static void gst_matroska_mux_finalize (GObject * object);
gst_event_unref (event);
/* handled this, don't want collectpads to forward it downstream */
event = NULL;
+ ret = TRUE;
+ break;
+ }
+ case GST_EVENT_SEGMENT:{
+ const GstSegment *segment;
+
+ gst_event_parse_segment (event, &segment);
+ if (segment->format != GST_FORMAT_TIME) {
+ ret = FALSE;
+ }
+ gst_event_unref (event);
+ event = NULL;
+ ret = TRUE;
break;
}
- case GST_EVENT_NEWSEGMENT:{
- GstFormat format;
-
- gst_event_parse_new_segment (event, NULL, NULL, &format, NULL, NULL,
- NULL);
- if (format != GST_FORMAT_TIME) {
- gst_event_unref (event);
- event = NULL;
- }
- break;
- }
+ case GST_EVENT_TOC:{
+ GstToc *toc;
+
+ if (mux->chapters_pos > 0)
+ break;
+
+ GST_DEBUG_OBJECT (mux, "received toc event");
+ gst_event_parse_toc (event, &toc, NULL);
+
+ if (toc != NULL) {
+ if (gst_toc_setter_get_toc (GST_TOC_SETTER (mux)) != NULL) {
+ gst_toc_setter_reset_toc (GST_TOC_SETTER (mux));
+ GST_INFO_OBJECT (pad, "Replacing TOC with a new one");
+ }
+
+ gst_toc_setter_set_toc (GST_TOC_SETTER (mux), toc);
+ gst_toc_free (toc);
+ }
+
+ gst_event_unref (event);
+ /* handled this, don't want collectpads to forward it downstream */
+ event = NULL;
+ break;
+ }
case GST_EVENT_CUSTOM_DOWNSTREAM:{
const GstStructure *structure;
GST_DEBUG_OBJECT (common, "Parsing " element " element " \
" finished with '%s'", gst_flow_get_name (ret))
+ #define GST_MATROSKA_TOC_UID_CHAPTER "chapter"
+ #define GST_MATROSKA_TOC_UID_EDITION "edition"
+ #define GST_MATROSKA_TOC_UID_EMPTY "empty"
+
static gboolean
gst_matroska_decompress_data (GstMatroskaTrackEncoding * enc,
- guint8 ** data_out, guint * size_out,
+ gpointer * data_out, gsize * size_out,
GstMatroskaTrackCompressionAlgorithm algo)
{
guint8 *new_data = NULL;
return ret;
}
- taglist = gst_tag_list_new ();
+ taglist = gst_tag_list_new_empty ();
+ common->toc_updated = FALSE;
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)