Commit d3daa124 authored by Zaheer Abbas Merali's avatar Zaheer Abbas Merali

matroskamux: store caps and set on buffers rather than using pad caps

parent b4e6fcd0
......@@ -65,6 +65,8 @@ gst_ebml_write_init (GstEbmlWrite * ebml, GstEbmlWriteClass * klass)
ebml->streamheader = NULL;
ebml->streamheader_pos = 0;
ebml->writing_streamheader = FALSE;
ebml->caps = NULL;
}
static void
......@@ -84,6 +86,10 @@ gst_ebml_write_finalize (GObject * object)
ebml->streamheader = NULL;
}
if (ebml->caps) {
gst_caps_unref (ebml->caps);
ebml->caps = NULL;
}
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
......@@ -216,7 +222,7 @@ gst_ebml_write_flush_cache (GstEbmlWrite * ebml)
buffer = gst_byte_writer_free_and_get_buffer (ebml->cache);
ebml->cache = NULL;
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
gst_buffer_set_caps (buffer, ebml->caps);
if (ebml->last_write_result == GST_FLOW_OK) {
if (ebml->need_newsegment) {
GstEvent *ev;
......@@ -225,6 +231,9 @@ gst_ebml_write_flush_cache (GstEbmlWrite * ebml)
if (gst_pad_push_event (ebml->srcpad, ev))
ebml->need_newsegment = FALSE;
}
if (ebml->writing_streamheader) {
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
}
ebml->last_write_result = gst_pad_push (ebml->srcpad, buffer);
} else {
gst_buffer_unref (buffer);
......@@ -390,7 +399,10 @@ gst_ebml_write_element_push (GstEbmlWrite * ebml, GstBuffer * buf)
ebml->need_newsegment = FALSE;
}
buf = gst_buffer_make_metadata_writable (buf);
gst_buffer_set_caps (buf, GST_PAD_CAPS (ebml->srcpad));
gst_buffer_set_caps (buf, ebml->caps);
if (ebml->writing_streamheader) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
}
ebml->last_write_result = gst_pad_push (ebml->srcpad, buf);
} else {
gst_buffer_unref (buf);
......
......@@ -59,6 +59,8 @@ typedef struct _GstEbmlWrite {
gboolean writing_streamheader;
GstByteWriter *streamheader;
guint64 streamheader_pos;
GstCaps *caps;
} GstEbmlWrite;
typedef struct _GstEbmlWriteClass {
......
......@@ -2007,16 +2007,10 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
GTimeVal time = { 0, 0 };
GstBuffer *streamheader_buffer;
/* set initial pad caps */
{
GstCaps *caps;
if (!strcmp (mux->doctype, GST_MATROSKA_DOCTYPE_WEBM)) {
caps = gst_caps_from_string ("video/webm");
} else {
caps = gst_caps_from_string ("video/x-matroska");
}
gst_pad_set_caps (mux->srcpad, caps);
gst_caps_unref (caps);
if (!strcmp (mux->doctype, GST_MATROSKA_DOCTYPE_WEBM)) {
ebml->caps = gst_caps_from_string ("video/webm");
} else {
ebml->caps = gst_caps_from_string ("video/x-matroska");
}
/* we start with a EBML header */
doctype = mux->doctype;
......@@ -2135,8 +2129,8 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
g_value_unset (&bufval);
gst_structure_set_value (s, "streamheader", &streamheader);
g_value_unset (&streamheader);
gst_pad_set_caps (mux->srcpad, caps);
gst_caps_unref (caps);
gst_caps_unref (ebml->caps);
ebml->caps = caps;
}
}
......
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