summaryrefslogtreecommitdiffstats
path: root/ext/metadata/gstmetadatamux.c
diff options
context:
space:
mode:
authorEdgard Lima <edgard.lima@indt.org.br>2007-12-13 12:45:06 +0000
committerEdgard Lima <edgard.lima@indt.org.br>2007-12-13 12:45:06 +0000
commit334b512629cc91ea21b0ae32f0b9b6d980059c18 (patch)
tree956efa64741b9b5b4a3e25071dc1f8326c1f46b3 /ext/metadata/gstmetadatamux.c
parent9adb4f78700ae4a55416fd024d9ca5fea3f5ccbe (diff)
downloadgst-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/gstmetadatamux.c')
-rw-r--r--ext/metadata/gstmetadatamux.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/ext/metadata/gstmetadatamux.c b/ext/metadata/gstmetadatamux.c
index 51fef2fb..953f9cdb 100644
--- a/ext/metadata/gstmetadatamux.c
+++ b/ext/metadata/gstmetadatamux.c
@@ -776,7 +776,6 @@ gst_metadata_update_segment (GstMetadataMux * filter, guint8 ** buf,
if (*size == 0)
goto done;
- /* calculate the new position off injected chunks */
for (i = 0; i < inject_len; ++i) {
if (inject[i].type == type) {
inject[i].size = *size;
@@ -1351,6 +1350,7 @@ gst_metadata_mux_strip_push_buffer (GstMetadataMux * filter,
MetadataChunk *inject = filter->mux_data.inject_chunks.chunk;
const gsize strip_len = filter->mux_data.strip_chunks.len;
const gsize inject_len = filter->mux_data.inject_chunks.len;
+ gboolean buffer_reallocated = FALSE;
guint32 size_buf_in = GST_BUFFER_SIZE (*buf);
@@ -1422,24 +1422,27 @@ gst_metadata_mux_strip_push_buffer (GstMetadataMux * 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);
@@ -1469,24 +1472,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);
@@ -1515,7 +1521,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;