matroskamux: set offsets on outgoing buffers

This commit is contained in:
Zaheer Abbas Merali 2010-10-10 14:43:58 +01:00
parent b37845dac0
commit f012ab67cc
2 changed files with 7 additions and 1 deletions

View file

@ -65,7 +65,7 @@ gst_ebml_write_init (GstEbmlWrite * ebml, GstEbmlWriteClass * klass)
ebml->streamheader = NULL;
ebml->streamheader_pos = 0;
ebml->writing_streamheader = FALSE;
ebml->current_offset = 0;
ebml->caps = NULL;
}
@ -135,6 +135,7 @@ gst_ebml_write_reset (GstEbmlWrite * ebml)
ebml->last_write_result = GST_FLOW_OK;
ebml->timestamp = GST_CLOCK_TIME_NONE;
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;
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
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->need_newsegment) {
GstEvent *ev;
@ -402,6 +405,8 @@ gst_ebml_write_element_push (GstEbmlWrite * ebml, GstBuffer * buf)
}
buf = gst_buffer_make_metadata_writable (buf);
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) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
}

View file

@ -59,6 +59,7 @@ typedef struct _GstEbmlWrite {
gboolean writing_streamheader;
GstByteWriter *streamheader;
guint64 streamheader_pos;
guint64 current_offset;
GstCaps *caps;
} GstEbmlWrite;