From 7d9dd13c6e11c0e8be2906b41d23103bf6a83200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 1 Nov 2005 12:35:39 +0000 Subject: [PATCH] gst/matroska/: Set timestamps on outgoing ebml headers as well, so that the element after matroskamux can get the tim... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Reviewed by: Tim-Philipp Müller * gst/matroska/ebml-write.c: (gst_ebml_write_new), (gst_ebml_write_reset), (gst_ebml_write_element_new): * gst/matroska/ebml-write.h: * gst/matroska/matroska-mux.c: (gst_matroska_mux_write_data): Set timestamps on outgoing ebml headers as well, so that the element after matroskamux can get the timestamp already when reading the first ebml element and doesn't have to wait for the actual data buffer for that (#320308). --- ChangeLog | 13 +++++++++++++ gst/matroska/ebml-write.c | 3 +++ gst/matroska/ebml-write.h | 1 + gst/matroska/matroska-mux.c | 3 +++ 4 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 31dac8fb61..4ff99774e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-11-01 Josef Zlomek + + Reviewed by: Tim-Philipp Müller + + * gst/matroska/ebml-write.c: (gst_ebml_write_new), + (gst_ebml_write_reset), (gst_ebml_write_element_new): + * gst/matroska/ebml-write.h: + * gst/matroska/matroska-mux.c: (gst_matroska_mux_write_data): + Set timestamps on outgoing ebml headers as well, so that the + element after matroskamux can get the timestamp already when + reading the first ebml element and doesn't have to wait for + the actual data buffer for that (#320308). + 2005-10-31 Andy Wingo * gst/videomixer/videomixer.c (gst_videomixer_pad_unlink) diff --git a/gst/matroska/ebml-write.c b/gst/matroska/ebml-write.c index 27bc6b55fc..46c83842ea 100644 --- a/gst/matroska/ebml-write.c +++ b/gst/matroska/ebml-write.c @@ -89,6 +89,7 @@ gst_ebml_write_new (GstPad * srcpad) GST_EBML_WRITE (g_object_new (GST_TYPE_EBML_WRITE, NULL)); ebml->srcpad = gst_object_ref (srcpad); + ebml->timestamp = GST_CLOCK_TIME_NONE; gst_ebml_write_reset (ebml); @@ -113,6 +114,7 @@ gst_ebml_write_reset (GstEbmlWrite * ebml) } ebml->cache_size = 0; ebml->last_write_result = GST_FLOW_OK; + ebml->timestamp = GST_CLOCK_TIME_NONE; } @@ -220,6 +222,7 @@ gst_ebml_write_element_new (GstEbmlWrite * ebml, guint size) /* else, use a one-element buffer. This is slower */ buf = gst_buffer_new_and_alloc (size); GST_BUFFER_SIZE (buf) = 0; + GST_BUFFER_TIMESTAMP (buf) = ebml->timestamp; return buf; } diff --git a/gst/matroska/ebml-write.h b/gst/matroska/ebml-write.h index 01a9992929..b579d8b2b3 100644 --- a/gst/matroska/ebml-write.h +++ b/gst/matroska/ebml-write.h @@ -46,6 +46,7 @@ typedef struct _GstEbmlWrite { GstPad *srcpad; guint64 pos; + GstClockTime timestamp; GstBuffer *cache; guint cache_size; diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index ee19fa3813..ca8ab86ead 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -1338,6 +1338,9 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux) buf = best->buffer; best->buffer = NULL; + /* set the timestamp for outgoing buffers */ + ebml->timestamp = GST_BUFFER_TIMESTAMP (buf); + if (mux->cluster) { /* start a new cluster every two seconds */ if (mux->cluster_time + GST_SECOND * 2 < GST_BUFFER_TIMESTAMP (buf)) {