diff options
author | Edgard Lima <edgard.lima@indt.org.br> | 2007-12-13 12:45:06 +0000 |
---|---|---|
committer | Edgard Lima <edgard.lima@indt.org.br> | 2007-12-13 12:45:06 +0000 |
commit | 334b512629cc91ea21b0ae32f0b9b6d980059c18 (patch) | |
tree | 956efa64741b9b5b4a3e25071dc1f8326c1f46b3 /ext/metadata/gstmetadataparse.c | |
parent | 9adb4f78700ae4a55416fd024d9ca5fea3f5ccbe (diff) | |
download | gst-plugins-bad-334b512629cc91ea21b0ae32f0b9b6d980059c18.tar.gz gst-plugins-bad-334b512629cc91ea21b0ae32f0b9b6d980059c18.tar.bz2 gst-plugins-bad-334b512629cc91ea21b0ae32f0b9b6d980059c18.zip |
Added a test application. Added some EXIF tags. Fixed a muxer bug.
Original commit message from CVS:
Added a test application. Added some EXIF tags. Fixed a muxer bug.
Diffstat (limited to 'ext/metadata/gstmetadataparse.c')
-rw-r--r-- | ext/metadata/gstmetadataparse.c | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/ext/metadata/gstmetadataparse.c b/ext/metadata/gstmetadataparse.c index 3dd07cb2..a8ded250 100644 --- a/ext/metadata/gstmetadataparse.c +++ b/ext/metadata/gstmetadataparse.c @@ -1312,6 +1312,7 @@ gst_metadata_parse_strip_push_buffer (GstMetadataParse * filter, MetadataChunk *inject = filter->parse_data.inject_chunks.chunk; const gsize strip_len = filter->parse_data.strip_chunks.len; const gsize inject_len = filter->parse_data.inject_chunks.len; + gboolean buffer_reallocated = FALSE; guint32 size_buf_in = GST_BUFFER_SIZE (*buf); @@ -1383,24 +1384,27 @@ gst_metadata_parse_strip_push_buffer (GstMetadataParse * filter, guint8 *data; - if (injected_bytes + prepend_size > striped_bytes) { - GstBuffer *new_buf = - gst_buffer_new_and_alloc (GST_BUFFER_SIZE (*buf) + injected_bytes + - prepend_size - striped_bytes); + if (!buffer_reallocated) { + buffer_reallocated = TRUE; + if (injected_bytes + prepend_size > striped_bytes) { + GstBuffer *new_buf = + gst_buffer_new_and_alloc (GST_BUFFER_SIZE (*buf) + injected_bytes + + prepend_size - striped_bytes); - memcpy (GST_BUFFER_DATA (new_buf), GST_BUFFER_DATA (*buf), - GST_BUFFER_SIZE (*buf)); + memcpy (GST_BUFFER_DATA (new_buf), GST_BUFFER_DATA (*buf), + GST_BUFFER_SIZE (*buf)); - gst_buffer_unref (*buf); - *buf = new_buf; + gst_buffer_unref (*buf); + *buf = new_buf; - } else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY)) { - GstBuffer *new_buf = gst_buffer_copy (*buf); + } else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY)) { + GstBuffer *new_buf = gst_buffer_copy (*buf); - gst_buffer_unref (*buf); - *buf = new_buf; - GST_BUFFER_FLAG_UNSET (*buf, GST_BUFFER_FLAG_READONLY); - GST_BUFFER_SIZE (*buf) += injected_bytes + prepend_size - striped_bytes; + gst_buffer_unref (*buf); + *buf = new_buf; + GST_BUFFER_FLAG_UNSET (*buf, GST_BUFFER_FLAG_READONLY); + GST_BUFFER_SIZE (*buf) += injected_bytes + prepend_size - striped_bytes; + } } data = GST_BUFFER_DATA (*buf); @@ -1430,24 +1434,27 @@ inject: guint8 *data; guint32 striped_so_far; - if (injected_bytes + prepend_size > striped_bytes) { - GstBuffer *new_buf = - gst_buffer_new_and_alloc (GST_BUFFER_SIZE (*buf) + injected_bytes + - prepend_size - striped_bytes); + if (!buffer_reallocated) { + buffer_reallocated = TRUE; + if (injected_bytes + prepend_size > striped_bytes) { + GstBuffer *new_buf = + gst_buffer_new_and_alloc (GST_BUFFER_SIZE (*buf) + injected_bytes + + prepend_size - striped_bytes); - memcpy (GST_BUFFER_DATA (new_buf), GST_BUFFER_DATA (*buf), - GST_BUFFER_SIZE (*buf)); + memcpy (GST_BUFFER_DATA (new_buf), GST_BUFFER_DATA (*buf), + GST_BUFFER_SIZE (*buf)); - gst_buffer_unref (*buf); - *buf = new_buf; + gst_buffer_unref (*buf); + *buf = new_buf; - } else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY)) { - GstBuffer *new_buf = gst_buffer_copy (*buf); + } else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_READONLY)) { + GstBuffer *new_buf = gst_buffer_copy (*buf); - gst_buffer_unref (*buf); - *buf = new_buf; - GST_BUFFER_FLAG_UNSET (*buf, GST_BUFFER_FLAG_READONLY); - GST_BUFFER_SIZE (*buf) += injected_bytes + prepend_size - striped_bytes; + gst_buffer_unref (*buf); + *buf = new_buf; + GST_BUFFER_FLAG_UNSET (*buf, GST_BUFFER_FLAG_READONLY); + GST_BUFFER_SIZE (*buf) += injected_bytes + prepend_size - striped_bytes; + } } data = GST_BUFFER_DATA (*buf); @@ -1476,7 +1483,7 @@ inject: size_buf_in - buf_off); memcpy (data + buf_off, inject[i].data, inject[i].size); injected_bytes += inject[i].size; - size_buf_in += injected_bytes; + size_buf_in += inject[i].size; } else { /* segment is after size (segments are sorted) */ break; |