summaryrefslogtreecommitdiff
path: root/gst/dataurisrc
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2014-09-07 01:30:16 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2014-09-07 01:30:16 -0300
commite03e6c157152a488eb412ec425fc49f32b55a5d8 (patch)
treeb6baf6a5febcd9afa53ab975f0ccc4a73af75e9a /gst/dataurisrc
parent288efd4f99fe0df4b6656828c147c994a92f26c4 (diff)
Revert "dataurisrc: Remove unnecessary else if condition"
This reverts commit 3024ae9c38490817a76c83feab3c8472989cafad. The *buf can be NULL or not depending if the caller of gst_pad_get_range function provided or not a buffer.
Diffstat (limited to 'gst/dataurisrc')
-rw-r--r--gst/dataurisrc/gstdataurisrc.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gst/dataurisrc/gstdataurisrc.c b/gst/dataurisrc/gstdataurisrc.c
index f18fae76d1..1fde36d786 100644
--- a/gst/dataurisrc/gstdataurisrc.c
+++ b/gst/dataurisrc/gstdataurisrc.c
@@ -227,13 +227,21 @@ gst_data_uri_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
* larger than the max. available size if a segment at the end is requested */
if (offset + size > gst_buffer_get_size (src->buffer)) {
ret = GST_FLOW_EOS;
+ } else if (*buf != NULL) {
+ GstMapInfo src_info;
+ GstMapInfo dest_info;
+ gsize fill_size;
+
+ gst_buffer_map (src->buffer, &src_info, GST_MAP_READ);
+ gst_buffer_map (*buf, &dest_info, GST_MAP_WRITE);
+
+ fill_size = gst_buffer_fill (*buf, 0, src_info.data + offset, size);
+
+ gst_buffer_unmap (*buf, &dest_info);
+ gst_buffer_unmap (src->buffer, &src_info);
+ gst_buffer_set_size (*buf, fill_size);
+ ret = GST_FLOW_OK;
} else {
- /* Adding a check to unreference the buffer if *buf != NULL,
- * just in case a buffer is provided*/
- if (*buf != NULL) {
- gst_buffer_unref (*buf);
- GST_FIXME_OBJECT (src, "Buffer is not supposed to be provided here");
- }
*buf =
gst_buffer_copy_region (src->buffer, GST_BUFFER_COPY_ALL, offset, size);
ret = GST_FLOW_OK;