mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
matroskamux: set offsets on outgoing buffers
This commit is contained in:
parent
b37845dac0
commit
f012ab67cc
2 changed files with 7 additions and 1 deletions
|
@ -65,7 +65,7 @@ gst_ebml_write_init (GstEbmlWrite * ebml, GstEbmlWriteClass * klass)
|
||||||
ebml->streamheader = NULL;
|
ebml->streamheader = NULL;
|
||||||
ebml->streamheader_pos = 0;
|
ebml->streamheader_pos = 0;
|
||||||
ebml->writing_streamheader = FALSE;
|
ebml->writing_streamheader = FALSE;
|
||||||
|
ebml->current_offset = 0;
|
||||||
ebml->caps = NULL;
|
ebml->caps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ gst_ebml_write_reset (GstEbmlWrite * ebml)
|
||||||
ebml->last_write_result = GST_FLOW_OK;
|
ebml->last_write_result = GST_FLOW_OK;
|
||||||
ebml->timestamp = GST_CLOCK_TIME_NONE;
|
ebml->timestamp = GST_CLOCK_TIME_NONE;
|
||||||
ebml->need_newsegment = TRUE;
|
ebml->need_newsegment = TRUE;
|
||||||
|
ebml->current_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,6 +224,8 @@ gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe)
|
||||||
ebml->cache = NULL;
|
ebml->cache = NULL;
|
||||||
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
|
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
|
||||||
gst_buffer_set_caps (buffer, ebml->caps);
|
gst_buffer_set_caps (buffer, ebml->caps);
|
||||||
|
GST_BUFFER_OFFSET (buffer) = ebml->current_offset++;
|
||||||
|
GST_BUFFER_OFFSET_END (buffer) = ebml->current_offset;
|
||||||
if (ebml->last_write_result == GST_FLOW_OK) {
|
if (ebml->last_write_result == GST_FLOW_OK) {
|
||||||
if (ebml->need_newsegment) {
|
if (ebml->need_newsegment) {
|
||||||
GstEvent *ev;
|
GstEvent *ev;
|
||||||
|
@ -402,6 +405,8 @@ gst_ebml_write_element_push (GstEbmlWrite * ebml, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
buf = gst_buffer_make_metadata_writable (buf);
|
buf = gst_buffer_make_metadata_writable (buf);
|
||||||
gst_buffer_set_caps (buf, ebml->caps);
|
gst_buffer_set_caps (buf, ebml->caps);
|
||||||
|
GST_BUFFER_OFFSET (buf) = ebml->current_offset++;
|
||||||
|
GST_BUFFER_OFFSET_END (buf) = ebml->current_offset;
|
||||||
if (ebml->writing_streamheader) {
|
if (ebml->writing_streamheader) {
|
||||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef struct _GstEbmlWrite {
|
||||||
gboolean writing_streamheader;
|
gboolean writing_streamheader;
|
||||||
GstByteWriter *streamheader;
|
GstByteWriter *streamheader;
|
||||||
guint64 streamheader_pos;
|
guint64 streamheader_pos;
|
||||||
|
guint64 current_offset;
|
||||||
|
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
} GstEbmlWrite;
|
} GstEbmlWrite;
|
||||||
|
|
Loading…
Reference in a new issue