matroskamux: add streamheaders
[platform/upstream/gst-plugins-good.git] / gst / matroska / ebml-write.h
index a0739c0..72ac2e1 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <glib.h>
 #include <gst/gst.h>
+#include <gst/base/gstbytewriter.h>
 
 G_BEGIN_DECLS
 
@@ -36,7 +37,7 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_EBML_WRITE, GstEbmlWriteClass))
 #define GST_IS_EBML_WRITE(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_EBML_WRITE))
-#define GST_IS_EBML_WRITE_CLASS(obj) \
+#define GST_IS_EBML_WRITE_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_EBML_WRITE))
 #define GST_EBML_WRITE_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_EBML_WRITE, GstEbmlWriteClass))
@@ -48,21 +49,20 @@ typedef struct _GstEbmlWrite {
   guint64 pos;
   GstClockTime timestamp;
 
-  GstBuffer *cache;
-  guint cache_size;
-  guint handled;
+  GstByteWriter *cache;
+  guint64 cache_pos;
 
   GstFlowReturn last_write_result;
 
-  /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
+  gboolean need_newsegment;
+
+  gboolean writing_streamheader;
+  GstByteWriter *streamheader;
+  guint64 streamheader_pos;
 } GstEbmlWrite;
 
 typedef struct _GstEbmlWriteClass {
   GstObjectClass parent;
-
-  /*< private >*/
-  gpointer _gst_reserved[GST_PADDING];
 } GstEbmlWriteClass;
 
 GType   gst_ebml_write_get_type      (void);
@@ -72,6 +72,10 @@ void    gst_ebml_write_reset         (GstEbmlWrite *ebml);
 
 GstFlowReturn gst_ebml_last_write_result (GstEbmlWrite *ebml);
 
+/* Used to create streamheaders */
+void    gst_ebml_start_streamheader  (GstEbmlWrite *ebml);
+GstBuffer*    gst_ebml_stop_streamheader   (GstEbmlWrite *ebml);
+
 /*
  * Caching means that we do not push one buffer for
  * each element, but fill this one until a flush.
@@ -111,12 +115,15 @@ guint64 gst_ebml_write_master_start  (GstEbmlWrite *ebml,
                                       guint32       id);
 void    gst_ebml_write_master_finish (GstEbmlWrite *ebml,
                                       guint64       startpos);
+void    gst_ebml_write_master_finish_full (GstEbmlWrite * ebml,
+                                      guint64 startpos,
+                                      guint64 extra_size);
 void    gst_ebml_write_binary        (GstEbmlWrite *ebml,
                                       guint32       id,
                                       guchar       *binary,
                                       guint64       length);
 void    gst_ebml_write_header        (GstEbmlWrite *ebml,
-                                      gchar        *doctype,
+                                      const gchar  *doctype,
                                       guint         version);
 
 /*