2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstbuffer.c: Buffer operations
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-08-23 11:53:58 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstbuffer
|
|
|
|
* @short_description: Data-passing buffer type, supporting sub-buffers.
|
|
|
|
* @see_also: #GstPad, #GstMiniObject
|
|
|
|
*
|
2006-06-06 08:50:40 +00:00
|
|
|
* Buffers are the basic unit of data transfer in GStreamer. The #GstBuffer
|
|
|
|
* type provides all the state necessary to define a region of memory as part
|
|
|
|
* of a stream. Sub-buffers are also supported, allowing a smaller region of a
|
2005-08-23 11:53:58 +00:00
|
|
|
* buffer to become its own buffer, with mechanisms in place to ensure that
|
2005-10-28 17:01:14 +00:00
|
|
|
* neither memory space goes away prematurely.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
|
|
|
* Buffers are usually created with gst_buffer_new(). After a buffer has been
|
|
|
|
* created one will typically allocate memory for it and set the size of the
|
2005-08-23 11:53:58 +00:00
|
|
|
* buffer data. The following example creates a buffer that can hold a given
|
|
|
|
* video frame with a given width, height and bits per plane.
|
|
|
|
* <example>
|
|
|
|
* <title>Creating a buffer for a video frame</title>
|
|
|
|
* <programlisting>
|
|
|
|
* GstBuffer *buffer;
|
|
|
|
* gint size, width, height, bpp;
|
|
|
|
* ...
|
|
|
|
* size = width * height * bpp;
|
|
|
|
* buffer = gst_buffer_new ();
|
|
|
|
* GST_BUFFER_SIZE (buffer) = size;
|
2006-01-11 19:18:27 +00:00
|
|
|
* GST_BUFFER_MALLOCDATA (buffer) = g_malloc (size);
|
2005-08-23 11:53:58 +00:00
|
|
|
* GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
|
|
|
|
* ...
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
|
|
|
* Alternatively, use gst_buffer_new_and_alloc()
|
2005-08-23 11:53:58 +00:00
|
|
|
* to create a buffer with preallocated data of a given size.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2006-08-14 07:35:09 +00:00
|
|
|
* The data pointed to by the buffer can be retrieved with the GST_BUFFER_DATA()
|
|
|
|
* macro. The size of the data can be found with GST_BUFFER_SIZE(). For buffers
|
|
|
|
* of size 0, the data pointer is undefined (usually NULL) and should never be used.
|
|
|
|
*
|
2005-08-23 11:53:58 +00:00
|
|
|
* If an element knows what pad you will push the buffer out on, it should use
|
|
|
|
* gst_pad_alloc_buffer() instead to create a buffer. This allows downstream
|
|
|
|
* elements to provide special buffers to write in, like hardware buffers.
|
2005-09-24 14:14:03 +00:00
|
|
|
*
|
|
|
|
* A buffer has a pointer to a #GstCaps describing the media type of the data
|
|
|
|
* in the buffer. Attach caps to the buffer with gst_buffer_set_caps(); this
|
|
|
|
* is typically done before pushing out a buffer using gst_pad_push() so that
|
|
|
|
* the downstream element knows the type of the buffer.
|
2006-06-06 08:50:40 +00:00
|
|
|
*
|
2005-10-28 17:01:14 +00:00
|
|
|
* A buffer will usually have a timestamp, and a duration, but neither of these
|
2006-06-06 08:50:40 +00:00
|
|
|
* are guaranteed (they may be set to #GST_CLOCK_TIME_NONE). Whenever a
|
|
|
|
* meaningful value can be given for these, they should be set. The timestamp
|
|
|
|
* and duration are measured in nanoseconds (they are #GstClockTime values).
|
|
|
|
*
|
2005-10-28 17:01:14 +00:00
|
|
|
* A buffer can also have one or both of a start and an end offset. These are
|
|
|
|
* media-type specific. For video buffers, the start offset will generally be
|
2006-06-06 08:50:40 +00:00
|
|
|
* the frame number. For audio buffers, it will be the number of samples
|
|
|
|
* produced so far. For compressed data, it could be the byte offset in a
|
2005-10-28 17:01:14 +00:00
|
|
|
* source or destination file. Likewise, the end offset will be the offset of
|
|
|
|
* the end of the buffer. These can only be meaningfully interpreted if you
|
|
|
|
* know the media type of the buffer (the #GstCaps set on it). Either or both
|
2005-11-09 18:10:53 +00:00
|
|
|
* can be set to #GST_BUFFER_OFFSET_NONE.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-08-23 11:53:58 +00:00
|
|
|
* gst_buffer_ref() is used to increase the refcount of a buffer. This must be
|
|
|
|
* done when you want to keep a handle to the buffer after pushing it to the
|
|
|
|
* next element.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-08-23 11:53:58 +00:00
|
|
|
* To efficiently create a smaller buffer out of an existing one, you can
|
|
|
|
* use gst_buffer_create_sub().
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2006-01-17 12:14:20 +00:00
|
|
|
* If a plug-in wants to modify the buffer data in-place, it should first obtain
|
2005-08-23 11:53:58 +00:00
|
|
|
* a buffer that is safe to modify by using gst_buffer_make_writable(). This
|
|
|
|
* function is optimized so that a copy will only be made when it is necessary.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2006-06-06 08:50:40 +00:00
|
|
|
* A plugin that only wishes to modify the metadata of a buffer, such as the
|
|
|
|
* offset, timestamp or caps, should use gst_buffer_make_metadata_writable(),
|
|
|
|
* which will create a subbuffer of the original buffer to ensure the caller
|
|
|
|
* has sole ownership, and not copy the buffer data.
|
2006-01-17 12:14:20 +00:00
|
|
|
*
|
2005-10-15 16:01:57 +00:00
|
|
|
* Several flags of the buffer can be set and unset with the
|
|
|
|
* GST_BUFFER_FLAG_SET() and GST_BUFFER_FLAG_UNSET() macros. Use
|
2005-10-28 17:01:14 +00:00
|
|
|
* GST_BUFFER_FLAG_IS_SET() to test if a certain #GstBufferFlag is set.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-10-15 16:01:57 +00:00
|
|
|
* Buffers can be efficiently merged into a larger buffer with
|
|
|
|
* gst_buffer_merge() and gst_buffer_span() if the gst_buffer_is_span_fast()
|
|
|
|
* function returns TRUE.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-08-23 11:53:58 +00:00
|
|
|
* An element should either unref the buffer or push it out on a src pad
|
|
|
|
* using gst_pad_push() (see #GstPad).
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-10-28 17:01:14 +00:00
|
|
|
* Buffers are usually freed by unreffing them with gst_buffer_unref(). When
|
|
|
|
* the refcount drops to 0, any data pointed to by GST_BUFFER_MALLOCDATA() will
|
|
|
|
* also be freed.
|
2005-08-23 11:53:58 +00:00
|
|
|
*
|
2006-08-14 07:35:09 +00:00
|
|
|
* Last reviewed on August 11th, 2006 (0.10.10)
|
2005-08-23 11:53:58 +00:00
|
|
|
*/
|
2000-12-28 22:12:02 +00:00
|
|
|
#include "gst_private.h"
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gstbuffer.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gstinfo.h"
|
2005-04-24 22:49:45 +00:00
|
|
|
#include "gstutils.h"
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
#include "gstminiobject.h"
|
2010-03-03 09:31:26 +00:00
|
|
|
#include "gstversion.h"
|
2001-10-17 10:21:27 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
static void gst_buffer_finalize (GstBuffer * buffer);
|
|
|
|
static GstBuffer *_gst_buffer_copy (GstBuffer * buffer);
|
2004-04-05 18:39:01 +00:00
|
|
|
|
2006-07-26 10:39:58 +00:00
|
|
|
static GType _gst_buffer_type = 0;
|
|
|
|
|
2010-03-04 08:44:52 +00:00
|
|
|
/* buffer alignment in bytes
|
|
|
|
* an alignment of 8 would be the same as malloc() guarantees
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_POSIX_MEMALIGN
|
|
|
|
#if defined(BUFFER_ALIGNMENT_MALLOC)
|
|
|
|
static size_t _gst_buffer_data_alignment = 8;
|
|
|
|
#elif defined(BUFFER_ALIGNMENT_PAGESIZE)
|
|
|
|
static size_t _gst_buffer_data_alignment = 0;
|
|
|
|
#elif defined(BUFFER_ALIGNMENT)
|
|
|
|
static size_t _gst_buffer_data_alignment = BUFFER_ALIGNMENT;
|
|
|
|
#else
|
|
|
|
#error "No buffer alignment configured"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
aligned_malloc (gpointer * memptr, guint size)
|
|
|
|
{
|
|
|
|
gint res;
|
|
|
|
|
|
|
|
res = posix_memalign (memptr, _gst_buffer_data_alignment, size);
|
|
|
|
return (res == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_POSIX_MEMALIGN */
|
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
void
|
|
|
|
_gst_buffer_initialize (void)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
/* the GstMiniObject types need to be class_ref'd once before it can be
|
|
|
|
* done from multiple threads;
|
|
|
|
* see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
|
2007-11-01 21:50:05 +00:00
|
|
|
g_type_class_ref (gst_buffer_get_type ());
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_GETPAGESIZE
|
|
|
|
#ifdef BUFFER_ALIGNMENT_PAGESIZE
|
|
|
|
_gst_buffer_data_alignment = getpagesize ();
|
|
|
|
#endif
|
|
|
|
#endif
|
2001-12-22 21:18:17 +00:00
|
|
|
}
|
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
#define _do_init \
|
|
|
|
{ \
|
|
|
|
_gst_buffer_type = g_define_type_id; \
|
2003-03-29 11:58:15 +00:00
|
|
|
}
|
|
|
|
|
2009-04-04 08:20:36 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstBuffer, gst_buffer, GST_TYPE_MINI_OBJECT, _do_init);
|
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
static void
|
2009-04-04 08:20:36 +00:00
|
|
|
gst_buffer_class_init (GstBufferClass * klass)
|
2002-07-08 19:22:02 +00:00
|
|
|
{
|
2009-04-04 08:20:36 +00:00
|
|
|
klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_buffer_copy;
|
|
|
|
klass->mini_object_class.finalize =
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
(GstMiniObjectFinalizeFunction) gst_buffer_finalize;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
static void
|
|
|
|
gst_buffer_finalize (GstBuffer * buffer)
|
2000-08-14 10:55:35 +00:00
|
|
|
{
|
2002-11-22 23:15:14 +00:00
|
|
|
g_return_if_fail (buffer != NULL);
|
|
|
|
|
2005-10-11 09:14:59 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "finalize %p", buffer);
|
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
/* free our data */
|
2008-10-06 18:01:42 +00:00
|
|
|
if (G_LIKELY (buffer->malloc_data))
|
|
|
|
buffer->free_func (buffer->malloc_data);
|
2001-08-27 04:19:58 +00:00
|
|
|
|
gst/: Make gst_caps_replace() work like other _replace() functions.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_chain_unlocked):
* gst/base/gsttypefindhelper.c: (helper_find_suggest),
(gst_type_find_helper):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init),
(stop_typefinding), (gst_type_find_element_handle_event),
(find_suggest), (gst_type_find_element_chain),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_getrange), (do_typefind),
(gst_type_find_element_activate):
* gst/gstbuffer.c: (_gst_buffer_sub_free),
(gst_buffer_default_free), (gst_buffer_default_copy),
(gst_buffer_set_caps):
* gst/gstcaps.c: (gst_caps_ref), (gst_caps_unref),
(gst_caps_replace):
* gst/gstmessage.c: (gst_message_new),
(gst_message_new_state_changed):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_prepare_filtered), (gst_pad_relink_filtered),
(gst_pad_set_caps), (gst_pad_check_pull_range),
(gst_pad_pull_range), (gst_static_pad_template_get_caps):
* gst/gstpad.h:
* gst/gsttypefind.c: (gst_type_find_register):
Make gst_caps_replace() work like other _replace() functions.
Use _caps_replace() where possible.
Make sure _message_new() initialises its field.
Add gst_static_pad_template_get_caps()
2005-04-20 09:10:42 +00:00
|
|
|
gst_caps_replace (&GST_BUFFER_CAPS (buffer), NULL);
|
2008-02-12 12:04:43 +00:00
|
|
|
|
2009-12-02 18:47:46 +00:00
|
|
|
if (buffer->parent)
|
|
|
|
gst_buffer_unref (buffer->parent);
|
|
|
|
|
2009-06-24 08:45:52 +00:00
|
|
|
/* ((GstMiniObjectClass *) */
|
|
|
|
/* gst_buffer_parent_class)->finalize (GST_MINI_OBJECT_CAST (buffer)); */
|
2000-08-14 10:55:35 +00:00
|
|
|
}
|
|
|
|
|
2007-03-09 16:30:38 +00:00
|
|
|
/**
|
|
|
|
* gst_buffer_copy_metadata:
|
|
|
|
* @dest: a destination #GstBuffer
|
|
|
|
* @src: a source #GstBuffer
|
|
|
|
* @flags: flags indicating what metadata fields should be copied.
|
|
|
|
*
|
|
|
|
* Copies the metadata from @src into @dest. The data, size and mallocdata
|
|
|
|
* fields are not copied.
|
|
|
|
*
|
|
|
|
* @flags indicate which fields will be copied. Use #GST_BUFFER_COPY_ALL to copy
|
|
|
|
* all the metadata fields.
|
|
|
|
*
|
|
|
|
* This function is typically called from a custom buffer copy function after
|
|
|
|
* creating @dest and setting the data, size, mallocdata.
|
|
|
|
*
|
|
|
|
* Since: 0.10.13
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_buffer_copy_metadata (GstBuffer * dest, const GstBuffer * src,
|
|
|
|
GstBufferCopyFlags flags)
|
|
|
|
{
|
|
|
|
g_return_if_fail (dest != NULL);
|
|
|
|
g_return_if_fail (src != NULL);
|
|
|
|
|
2009-05-27 14:17:31 +00:00
|
|
|
/* nothing to copy if the buffers are the same */
|
|
|
|
if (G_UNLIKELY (dest == src))
|
|
|
|
return;
|
|
|
|
|
2009-08-06 16:47:32 +00:00
|
|
|
#if GST_VERSION_NANO == 1
|
|
|
|
/* we enable this extra debugging in git versions only for now */
|
2010-04-29 22:29:30 +00:00
|
|
|
g_warn_if_fail (gst_buffer_is_metadata_writable (dest));
|
2009-08-06 16:47:32 +00:00
|
|
|
#endif
|
|
|
|
|
2007-03-09 16:30:38 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "copy %p to %p", src, dest);
|
|
|
|
|
|
|
|
if (flags & GST_BUFFER_COPY_FLAGS) {
|
|
|
|
guint mask;
|
|
|
|
|
|
|
|
/* copy relevant flags */
|
|
|
|
mask = GST_BUFFER_FLAG_PREROLL | GST_BUFFER_FLAG_IN_CAPS |
|
|
|
|
GST_BUFFER_FLAG_DELTA_UNIT | GST_BUFFER_FLAG_DISCONT |
|
2009-05-11 05:49:34 +00:00
|
|
|
GST_BUFFER_FLAG_GAP | GST_BUFFER_FLAG_MEDIA1 |
|
|
|
|
GST_BUFFER_FLAG_MEDIA2 | GST_BUFFER_FLAG_MEDIA3;
|
2007-03-09 16:30:38 +00:00
|
|
|
GST_MINI_OBJECT_FLAGS (dest) |= GST_MINI_OBJECT_FLAGS (src) & mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & GST_BUFFER_COPY_TIMESTAMPS) {
|
|
|
|
GST_BUFFER_TIMESTAMP (dest) = GST_BUFFER_TIMESTAMP (src);
|
|
|
|
GST_BUFFER_DURATION (dest) = GST_BUFFER_DURATION (src);
|
|
|
|
GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET (src);
|
|
|
|
GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_END (src);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & GST_BUFFER_COPY_CAPS) {
|
2009-05-27 14:17:31 +00:00
|
|
|
gst_caps_replace (&GST_BUFFER_CAPS (dest), GST_BUFFER_CAPS (src));
|
2007-03-09 16:30:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
static GstBuffer *
|
|
|
|
_gst_buffer_copy (GstBuffer * buffer)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2002-07-08 19:22:02 +00:00
|
|
|
GstBuffer *copy;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-11-22 23:15:14 +00:00
|
|
|
g_return_val_if_fail (buffer != NULL, NULL);
|
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
/* create a fresh new buffer */
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
copy = gst_buffer_new ();
|
2003-05-06 21:03:34 +00:00
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
/* we simply copy everything from our parent */
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_POSIX_MEMALIGN
|
|
|
|
{
|
|
|
|
gpointer memptr = NULL;
|
|
|
|
|
|
|
|
if (G_LIKELY (buffer->size)) {
|
|
|
|
if (G_UNLIKELY (!aligned_malloc (&memptr, buffer->size))) {
|
|
|
|
/* terminate on error like g_memdup() would */
|
2010-03-11 09:39:23 +00:00
|
|
|
g_error ("%s: failed to allocate %u bytes", G_STRLOC, buffer->size);
|
2010-03-04 08:44:52 +00:00
|
|
|
} else {
|
|
|
|
memcpy (memptr, buffer->data, buffer->size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
copy->data = (guint8 *) memptr;
|
|
|
|
GST_BUFFER_FREE_FUNC (copy) = free;
|
|
|
|
}
|
|
|
|
#else
|
2005-07-12 17:04:41 +00:00
|
|
|
copy->data = g_memdup (buffer->data, buffer->size);
|
2010-03-04 08:44:52 +00:00
|
|
|
#endif
|
|
|
|
|
2005-07-12 17:04:41 +00:00
|
|
|
/* make sure it gets freed (even if the parent is subclassed, we return a
|
2006-07-05 17:09:18 +00:00
|
|
|
normal buffer) */
|
2005-07-12 17:04:41 +00:00
|
|
|
copy->malloc_data = copy->data;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
copy->size = buffer->size;
|
2003-12-22 01:39:35 +00:00
|
|
|
|
2007-03-09 16:30:38 +00:00
|
|
|
gst_buffer_copy_metadata (copy, buffer, GST_BUFFER_COPY_ALL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
return copy;
|
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
static void
|
2009-04-04 08:20:36 +00:00
|
|
|
gst_buffer_init (GstBuffer * buffer)
|
2004-04-05 18:39:01 +00:00
|
|
|
{
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "init %p", buffer);
|
2004-04-05 18:39:01 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
|
|
|
|
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
|
2008-10-06 18:01:42 +00:00
|
|
|
GST_BUFFER_FREE_FUNC (buffer) = g_free;
|
2004-04-05 18:39:01 +00:00
|
|
|
}
|
|
|
|
|
2000-08-14 10:55:35 +00:00
|
|
|
/**
|
2002-07-08 19:22:02 +00:00
|
|
|
* gst_buffer_new:
|
2000-08-14 10:55:35 +00:00
|
|
|
*
|
2002-07-08 19:22:02 +00:00
|
|
|
* Creates a newly allocated buffer without any data.
|
2000-08-14 10:55:35 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer full): the new #GstBuffer.
|
2000-08-14 10:55:35 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstBuffer *
|
2002-07-08 19:22:02 +00:00
|
|
|
gst_buffer_new (void)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2003-05-24 10:09:39 +00:00
|
|
|
GstBuffer *newbuf;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2006-07-26 10:39:58 +00:00
|
|
|
newbuf = (GstBuffer *) gst_mini_object_new (_gst_buffer_type);
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "new %p", newbuf);
|
2000-08-14 10:55:35 +00:00
|
|
|
|
2003-05-24 10:09:39 +00:00
|
|
|
return newbuf;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
2002-07-08 19:22:02 +00:00
|
|
|
* gst_buffer_new_and_alloc:
|
2011-01-22 14:33:58 +00:00
|
|
|
* @size: the size in bytes of the new buffer's data.
|
2002-07-08 19:22:02 +00:00
|
|
|
*
|
|
|
|
* Creates a newly allocated buffer with data of the given size.
|
2007-04-26 10:00:49 +00:00
|
|
|
* The buffer memory is not cleared. If the requested amount of
|
|
|
|
* memory can't be allocated, the program will abort. Use
|
|
|
|
* gst_buffer_try_new_and_alloc() if you want to handle this case
|
|
|
|
* gracefully or have gotten the size to allocate from an untrusted
|
|
|
|
* source such as a media stream.
|
|
|
|
*
|
2000-03-27 19:53:43 +00:00
|
|
|
*
|
2006-07-05 17:09:18 +00:00
|
|
|
* Note that when @size == 0, the buffer data pointer will be NULL.
|
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer full): the new #GstBuffer.
|
2000-03-27 19:53:43 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstBuffer *
|
2002-07-08 19:22:02 +00:00
|
|
|
gst_buffer_new_and_alloc (guint size)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2003-05-24 10:09:39 +00:00
|
|
|
GstBuffer *newbuf;
|
2002-07-08 19:22:02 +00:00
|
|
|
|
2003-05-24 10:09:39 +00:00
|
|
|
newbuf = gst_buffer_new ();
|
2002-07-08 19:22:02 +00:00
|
|
|
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_POSIX_MEMALIGN
|
|
|
|
{
|
|
|
|
gpointer memptr = NULL;
|
|
|
|
|
|
|
|
if (G_LIKELY (size)) {
|
|
|
|
if (G_UNLIKELY (!aligned_malloc (&memptr, size))) {
|
|
|
|
/* terminate on error like g_memdup() would */
|
2010-03-11 09:39:23 +00:00
|
|
|
g_error ("%s: failed to allocate %u bytes", G_STRLOC, size);
|
2010-03-04 08:44:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
newbuf->malloc_data = (guint8 *) memptr;
|
|
|
|
GST_BUFFER_FREE_FUNC (newbuf) = free;
|
|
|
|
}
|
|
|
|
#else
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
newbuf->malloc_data = g_malloc (size);
|
2010-03-04 08:44:52 +00:00
|
|
|
#endif
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_BUFFER_DATA (newbuf) = newbuf->malloc_data;
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_BUFFER_SIZE (newbuf) = size;
|
2002-07-08 19:22:02 +00:00
|
|
|
|
2005-08-24 11:22:32 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "new %p of size %d", newbuf, size);
|
2007-04-26 10:00:49 +00:00
|
|
|
|
|
|
|
return newbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_buffer_try_new_and_alloc:
|
2011-01-22 14:33:58 +00:00
|
|
|
* @size: the size in bytes of the new buffer's data.
|
2007-04-26 10:00:49 +00:00
|
|
|
*
|
|
|
|
* Tries to create a newly allocated buffer with data of the given size. If
|
|
|
|
* the requested amount of memory can't be allocated, NULL will be returned.
|
|
|
|
* The buffer memory is not cleared.
|
|
|
|
*
|
|
|
|
* Note that when @size == 0, the buffer data pointer will be NULL.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Returns: (transfer full): a new #GstBuffer, or NULL if the memory couldn't
|
|
|
|
* be allocated.
|
2007-04-26 10:00:49 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.13
|
|
|
|
*/
|
|
|
|
GstBuffer *
|
|
|
|
gst_buffer_try_new_and_alloc (guint size)
|
|
|
|
{
|
|
|
|
GstBuffer *newbuf;
|
|
|
|
guint8 *malloc_data;
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_POSIX_MEMALIGN
|
|
|
|
gpointer memptr = NULL;
|
|
|
|
|
|
|
|
if (G_LIKELY (size)) {
|
|
|
|
if (G_UNLIKELY (!aligned_malloc (&memptr, size))) {
|
|
|
|
GST_CAT_WARNING (GST_CAT_BUFFER, "failed to allocate %d bytes", size);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
malloc_data = (guint8 *) memptr;
|
|
|
|
#else
|
2007-04-26 10:00:49 +00:00
|
|
|
malloc_data = g_try_malloc (size);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (malloc_data == NULL && size != 0)) {
|
|
|
|
GST_CAT_WARNING (GST_CAT_BUFFER, "failed to allocate %d bytes", size);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-03-04 08:44:52 +00:00
|
|
|
#endif
|
2007-04-26 10:00:49 +00:00
|
|
|
|
|
|
|
/* FIXME: there's no g_type_try_create_instance() in GObject yet, so this
|
|
|
|
* will still abort if a new GstBuffer structure can't be allocated */
|
|
|
|
newbuf = gst_buffer_new ();
|
|
|
|
|
|
|
|
GST_BUFFER_MALLOCDATA (newbuf) = malloc_data;
|
|
|
|
GST_BUFFER_DATA (newbuf) = malloc_data;
|
|
|
|
GST_BUFFER_SIZE (newbuf) = size;
|
2010-03-04 08:44:52 +00:00
|
|
|
#ifdef HAVE_POSIX_MEMALIGN
|
|
|
|
GST_BUFFER_FREE_FUNC (newbuf) = free;
|
|
|
|
#endif
|
2007-04-26 10:00:49 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "new %p of size %d", newbuf, size);
|
2005-08-24 11:22:32 +00:00
|
|
|
|
2003-05-24 10:09:39 +00:00
|
|
|
return newbuf;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/**
|
|
|
|
* gst_buffer_get_caps:
|
2005-10-28 17:01:14 +00:00
|
|
|
* @buffer: a #GstBuffer.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* Gets the media type of the buffer. This can be NULL if there
|
2005-10-28 17:01:14 +00:00
|
|
|
* is no media type attached to this buffer.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Returns: (transfer full): a reference to the #GstCaps. unref after usage.
|
2005-10-28 17:01:14 +00:00
|
|
|
* Returns NULL if there were no caps on this buffer.
|
2005-03-07 18:27:42 +00:00
|
|
|
*/
|
2008-01-09 12:19:31 +00:00
|
|
|
/* this is not made atomic because if the buffer were reffed from multiple
|
|
|
|
* threads, it would have a refcount > 2 and thus be immutable.
|
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
GstCaps *
|
|
|
|
gst_buffer_get_caps (GstBuffer * buffer)
|
|
|
|
{
|
2005-09-22 09:30:41 +00:00
|
|
|
GstCaps *ret;
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (buffer != NULL, NULL);
|
|
|
|
|
2005-09-22 09:30:41 +00:00
|
|
|
ret = GST_BUFFER_CAPS (buffer);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
gst_caps_ref (ret);
|
|
|
|
|
|
|
|
return ret;
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_buffer_set_caps:
|
2005-10-28 17:01:14 +00:00
|
|
|
* @buffer: a #GstBuffer.
|
2010-12-07 18:35:04 +00:00
|
|
|
* @caps: (transfer none): a #GstCaps.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:01:14 +00:00
|
|
|
* Sets the media type on the buffer. The refcount of the caps will
|
2005-03-07 18:27:42 +00:00
|
|
|
* be increased and any previous caps on the buffer will be
|
|
|
|
* unreffed.
|
|
|
|
*/
|
2008-01-09 12:19:31 +00:00
|
|
|
/* this is not made atomic because if the buffer were reffed from multiple
|
|
|
|
* threads, it would have a refcount > 2 and thus be immutable.
|
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
void
|
|
|
|
gst_buffer_set_caps (GstBuffer * buffer, GstCaps * caps)
|
|
|
|
{
|
|
|
|
g_return_if_fail (buffer != NULL);
|
2010-10-13 11:51:00 +00:00
|
|
|
g_return_if_fail (caps == NULL || GST_CAPS_IS_SIMPLE (caps));
|
|
|
|
|
2009-08-06 16:47:32 +00:00
|
|
|
#if GST_VERSION_NANO == 1
|
|
|
|
/* we enable this extra debugging in git versions only for now */
|
2010-04-29 22:29:30 +00:00
|
|
|
g_warn_if_fail (gst_buffer_is_metadata_writable (buffer));
|
2010-10-13 11:51:00 +00:00
|
|
|
/* FIXME: would be nice to also check if caps are fixed here, but expensive */
|
2009-08-06 16:47:32 +00:00
|
|
|
#endif
|
2005-03-07 18:27:42 +00:00
|
|
|
|
gst/: Make gst_caps_replace() work like other _replace() functions.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_chain_unlocked):
* gst/base/gsttypefindhelper.c: (helper_find_suggest),
(gst_type_find_helper):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init),
(stop_typefinding), (gst_type_find_element_handle_event),
(find_suggest), (gst_type_find_element_chain),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_getrange), (do_typefind),
(gst_type_find_element_activate):
* gst/gstbuffer.c: (_gst_buffer_sub_free),
(gst_buffer_default_free), (gst_buffer_default_copy),
(gst_buffer_set_caps):
* gst/gstcaps.c: (gst_caps_ref), (gst_caps_unref),
(gst_caps_replace):
* gst/gstmessage.c: (gst_message_new),
(gst_message_new_state_changed):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_prepare_filtered), (gst_pad_relink_filtered),
(gst_pad_set_caps), (gst_pad_check_pull_range),
(gst_pad_pull_range), (gst_static_pad_template_get_caps):
* gst/gstpad.h:
* gst/gsttypefind.c: (gst_type_find_register):
Make gst_caps_replace() work like other _replace() functions.
Use _caps_replace() where possible.
Make sure _message_new() initialises its field.
Add gst_static_pad_template_get_caps()
2005-04-20 09:10:42 +00:00
|
|
|
gst_caps_replace (&GST_BUFFER_CAPS (buffer), caps);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
|
2006-01-17 12:14:20 +00:00
|
|
|
/**
|
|
|
|
* gst_buffer_is_metadata_writable:
|
|
|
|
* @buf: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Similar to gst_buffer_is_writable, but this only ensures that the
|
|
|
|
* refcount of the buffer is 1, indicating that the caller is the sole
|
|
|
|
* owner and can change the buffer metadata, such as caps and timestamps.
|
2006-02-14 13:07:10 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the metadata is writable.
|
2006-01-17 12:14:20 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_buffer_is_metadata_writable (GstBuffer * buf)
|
|
|
|
{
|
2006-06-12 09:23:43 +00:00
|
|
|
return (GST_MINI_OBJECT_REFCOUNT_VALUE (GST_MINI_OBJECT_CAST (buf)) == 1);
|
2006-01-17 12:14:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_buffer_make_metadata_writable:
|
2010-12-07 18:35:04 +00:00
|
|
|
* @buf: (transfer full): a #GstBuffer
|
2006-01-17 12:14:20 +00:00
|
|
|
*
|
|
|
|
* Similar to gst_buffer_make_writable, but does not ensure that the buffer
|
|
|
|
* data array is writable. Instead, this just ensures that the returned buffer
|
|
|
|
* is solely owned by the caller, by creating a subbuffer of the original
|
|
|
|
* buffer if necessary.
|
2006-02-14 13:07:10 +00:00
|
|
|
*
|
2006-08-21 09:30:04 +00:00
|
|
|
* After calling this function, @buf should not be referenced anymore. The
|
|
|
|
* result of this function has guaranteed writable metadata.
|
2006-02-14 13:07:10 +00:00
|
|
|
*
|
2010-12-07 18:35:04 +00:00
|
|
|
* Returns: (transfer full): a new #GstBuffer with writable metadata, which
|
|
|
|
* may or may not be the same as @buf.
|
2006-01-17 12:14:20 +00:00
|
|
|
*/
|
|
|
|
GstBuffer *
|
|
|
|
gst_buffer_make_metadata_writable (GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstBuffer *ret;
|
|
|
|
|
|
|
|
if (gst_buffer_is_metadata_writable (buf)) {
|
|
|
|
ret = buf;
|
|
|
|
} else {
|
|
|
|
ret = gst_buffer_create_sub (buf, 0, GST_BUFFER_SIZE (buf));
|
2006-08-21 09:30:04 +00:00
|
|
|
|
2006-01-17 12:14:20 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-12-02 18:47:46 +00:00
|
|
|
#define GST_IS_SUBBUFFER(obj) (GST_BUFFER_CAST(obj)->parent != NULL)
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
2005-08-23 11:53:58 +00:00
|
|
|
* gst_buffer_create_sub:
|
2005-10-28 17:01:14 +00:00
|
|
|
* @parent: a #GstBuffer.
|
|
|
|
* @offset: the offset into parent #GstBuffer at which the new sub-buffer
|
|
|
|
* begins.
|
2006-07-05 17:09:18 +00:00
|
|
|
* @size: the size of the new #GstBuffer sub-buffer, in bytes.
|
2000-03-27 19:53:43 +00:00
|
|
|
*
|
2005-11-09 18:10:53 +00:00
|
|
|
* Creates a sub-buffer from @parent at @offset and @size.
|
2002-07-08 19:22:02 +00:00
|
|
|
* This sub-buffer uses the actual memory space of the parent buffer.
|
2005-10-28 17:01:14 +00:00
|
|
|
* This function will copy the offset and timestamp fields when the
|
2006-08-21 09:30:04 +00:00
|
|
|
* offset is 0. If not, they will be set to #GST_CLOCK_TIME_NONE and
|
|
|
|
* #GST_BUFFER_OFFSET_NONE.
|
|
|
|
* If @offset equals 0 and @size equals the total size of @buffer, the
|
|
|
|
* duration and offset end fields are also copied. If not they will be set
|
|
|
|
* to #GST_CLOCK_TIME_NONE and #GST_BUFFER_OFFSET_NONE.
|
2005-08-14 22:29:07 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer full): the new #GstBuffer or NULL if the arguments were
|
|
|
|
* invalid.
|
2000-03-27 19:53:43 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstBuffer *
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
gst_buffer_create_sub (GstBuffer * buffer, guint offset, guint size)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2009-12-02 18:47:46 +00:00
|
|
|
GstBuffer *subbuffer;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GstBuffer *parent;
|
2006-08-21 09:30:04 +00:00
|
|
|
gboolean complete;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
g_return_val_if_fail (buffer != NULL, NULL);
|
2010-12-26 21:20:31 +00:00
|
|
|
g_return_val_if_fail (buffer->mini_object.refcount > 0, NULL);
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
g_return_val_if_fail (buffer->size >= offset + size, NULL);
|
2002-07-08 19:22:02 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
/* find real parent */
|
|
|
|
if (GST_IS_SUBBUFFER (buffer)) {
|
2009-12-02 18:47:46 +00:00
|
|
|
parent = buffer->parent;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
} else {
|
|
|
|
parent = buffer;
|
2002-07-08 19:22:02 +00:00
|
|
|
}
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
gst_buffer_ref (parent);
|
2002-07-08 19:22:02 +00:00
|
|
|
|
|
|
|
/* create the new buffer */
|
2009-12-02 18:47:46 +00:00
|
|
|
subbuffer = gst_buffer_new ();
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
subbuffer->parent = parent;
|
2009-12-27 18:33:25 +00:00
|
|
|
GST_BUFFER_FLAG_SET (subbuffer, GST_BUFFER_FLAG_READONLY);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_CAT_LOG (GST_CAT_BUFFER, "new subbuffer %p (parent %p)", subbuffer,
|
|
|
|
parent);
|
2002-07-08 19:22:02 +00:00
|
|
|
|
|
|
|
/* set the right values in the child */
|
2009-12-27 18:33:25 +00:00
|
|
|
GST_BUFFER_DATA (subbuffer) = buffer->data + offset;
|
|
|
|
GST_BUFFER_SIZE (subbuffer) = size;
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
|
2008-02-15 12:33:00 +00:00
|
|
|
if ((offset == 0) && (size == GST_BUFFER_SIZE (buffer))) {
|
|
|
|
/* copy all the flags except IN_CAPS */
|
|
|
|
GST_BUFFER_FLAG_SET (subbuffer, GST_BUFFER_FLAGS (buffer));
|
|
|
|
GST_BUFFER_FLAG_UNSET (subbuffer, GST_BUFFER_FLAG_IN_CAPS);
|
|
|
|
} else {
|
|
|
|
/* copy only PREROLL & GAP flags */
|
|
|
|
GST_BUFFER_FLAG_SET (subbuffer, (GST_BUFFER_FLAGS (buffer) &
|
|
|
|
(GST_BUFFER_FLAG_PREROLL | GST_BUFFER_FLAG_GAP)));
|
|
|
|
}
|
|
|
|
|
2003-05-24 10:09:39 +00:00
|
|
|
/* we can copy the timestamp and offset if the new buffer starts at
|
|
|
|
* offset 0 */
|
|
|
|
if (offset == 0) {
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (subbuffer) = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
GST_BUFFER_OFFSET (subbuffer) = GST_BUFFER_OFFSET (buffer);
|
2006-08-21 09:30:04 +00:00
|
|
|
complete = (buffer->size == size);
|
2004-03-13 15:27:01 +00:00
|
|
|
} else {
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (subbuffer) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_OFFSET (subbuffer) = GST_BUFFER_OFFSET_NONE;
|
2006-08-21 09:30:04 +00:00
|
|
|
complete = FALSE;
|
2003-05-24 10:09:39 +00:00
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2006-08-21 09:30:04 +00:00
|
|
|
if (complete) {
|
|
|
|
GstCaps *caps;
|
2003-10-28 20:25:30 +00:00
|
|
|
|
2006-08-21 09:30:04 +00:00
|
|
|
/* if we copied the complete buffer we can copy the duration,
|
|
|
|
* offset_end and caps as well */
|
|
|
|
GST_BUFFER_DURATION (subbuffer) = GST_BUFFER_DURATION (buffer);
|
|
|
|
GST_BUFFER_OFFSET_END (subbuffer) = GST_BUFFER_OFFSET_END (buffer);
|
|
|
|
if ((caps = GST_BUFFER_CAPS (buffer)))
|
|
|
|
gst_caps_ref (caps);
|
|
|
|
GST_BUFFER_CAPS (subbuffer) = caps;
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_DURATION (subbuffer) = GST_CLOCK_TIME_NONE;
|
|
|
|
GST_BUFFER_OFFSET_END (subbuffer) = GST_BUFFER_OFFSET_NONE;
|
|
|
|
GST_BUFFER_CAPS (subbuffer) = NULL;
|
|
|
|
}
|
2009-12-27 18:33:25 +00:00
|
|
|
return subbuffer;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-10-21 18:00:31 +00:00
|
|
|
/**
|
|
|
|
* gst_buffer_is_span_fast:
|
2005-10-28 17:01:14 +00:00
|
|
|
* @buf1: the first #GstBuffer.
|
|
|
|
* @buf2: the second #GstBuffer.
|
2001-09-10 19:46:01 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Determines whether a gst_buffer_span() can be done without copying
|
2005-10-28 17:01:14 +00:00
|
|
|
* the contents, that is, whether the data areas are contiguous sub-buffers of
|
|
|
|
* the same buffer.
|
2001-09-10 19:46:01 +00:00
|
|
|
*
|
2005-10-28 17:01:14 +00:00
|
|
|
* MT safe.
|
2005-06-08 13:40:46 +00:00
|
|
|
* Returns: TRUE if the buffers are contiguous,
|
2002-08-30 14:54:58 +00:00
|
|
|
* FALSE if a copy would be required.
|
2001-09-10 19:46:01 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_buffer_is_span_fast (GstBuffer * buf1, GstBuffer * buf2)
|
2001-09-10 19:46:01 +00:00
|
|
|
{
|
2002-11-22 23:15:14 +00:00
|
|
|
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE);
|
2010-12-26 21:20:31 +00:00
|
|
|
g_return_val_if_fail (buf1->mini_object.refcount > 0, FALSE);
|
|
|
|
g_return_val_if_fail (buf2->mini_object.refcount > 0, FALSE);
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2002-07-08 19:22:02 +00:00
|
|
|
/* it's only fast if we have subbuffers of the same parent */
|
2005-05-18 17:35:23 +00:00
|
|
|
return (GST_IS_SUBBUFFER (buf1) &&
|
2009-12-02 18:47:46 +00:00
|
|
|
GST_IS_SUBBUFFER (buf2) && (buf1->parent == buf2->parent)
|
2006-06-12 09:23:43 +00:00
|
|
|
&& ((buf1->data + buf1->size) == buf2->data));
|
2001-09-10 19:46:01 +00:00
|
|
|
}
|
|
|
|
|
2001-09-04 04:34:32 +00:00
|
|
|
/**
|
|
|
|
* gst_buffer_span:
|
2005-10-28 17:01:14 +00:00
|
|
|
* @buf1: the first source #GstBuffer to merge.
|
2002-08-30 14:54:58 +00:00
|
|
|
* @offset: the offset in the first buffer from where the new
|
|
|
|
* buffer should start.
|
|
|
|
* @buf2: the second source #GstBuffer to merge.
|
|
|
|
* @len: the total length of the new buffer.
|
2001-09-04 04:34:32 +00:00
|
|
|
*
|
2002-04-17 15:19:56 +00:00
|
|
|
* Creates a new buffer that consists of part of buf1 and buf2.
|
2001-09-04 04:34:32 +00:00
|
|
|
* Logically, buf1 and buf2 are concatenated into a single larger
|
|
|
|
* buffer, and a new buffer is created at the given offset inside
|
|
|
|
* this space, with a given length.
|
|
|
|
*
|
|
|
|
* If the two source buffers are children of the same larger buffer,
|
|
|
|
* and are contiguous, the new buffer will be a child of the shared
|
2005-08-14 22:29:07 +00:00
|
|
|
* parent, and thus no copying is necessary. you can use
|
2002-07-13 23:12:22 +00:00
|
|
|
* gst_buffer_is_span_fast() to determine if a memcpy will be needed.
|
2001-09-04 04:34:32 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2010-12-07 18:35:04 +00:00
|
|
|
*
|
|
|
|
* Returns: (transfer full): the new #GstBuffer that spans the two source
|
|
|
|
* buffers, or NULL if the arguments are invalid.
|
2001-09-04 04:34:32 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstBuffer *
|
|
|
|
gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
|
|
|
|
guint32 len)
|
2001-08-11 08:25:05 +00:00
|
|
|
{
|
|
|
|
GstBuffer *newbuf;
|
|
|
|
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, NULL);
|
2010-12-26 21:20:31 +00:00
|
|
|
g_return_val_if_fail (buf1->mini_object.refcount > 0, NULL);
|
|
|
|
g_return_val_if_fail (buf2->mini_object.refcount > 0, NULL);
|
|
|
|
g_return_val_if_fail (len > 0, NULL);
|
2003-05-24 10:09:39 +00:00
|
|
|
g_return_val_if_fail (len <= buf1->size + buf2->size - offset, NULL);
|
2001-08-11 08:25:05 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* if the two buffers have the same parent and are adjacent */
|
2002-07-13 23:12:22 +00:00
|
|
|
if (gst_buffer_is_span_fast (buf1, buf2)) {
|
2009-12-02 18:47:46 +00:00
|
|
|
GstBuffer *parent = buf1->parent;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* we simply create a subbuffer of the common parent */
|
2004-03-13 15:27:01 +00:00
|
|
|
newbuf = gst_buffer_create_sub (parent,
|
2004-03-15 19:27:17 +00:00
|
|
|
buf1->data - parent->data + offset, len);
|
2004-03-13 15:27:01 +00:00
|
|
|
} else {
|
|
|
|
GST_CAT_DEBUG (GST_CAT_BUFFER,
|
2004-03-15 19:27:17 +00:00
|
|
|
"slow path taken while spanning buffers %p and %p", buf1, buf2);
|
2001-12-14 22:59:21 +00:00
|
|
|
/* otherwise we simply have to brute-force copy the buffers */
|
2002-07-08 19:22:02 +00:00
|
|
|
newbuf = gst_buffer_new_and_alloc (len);
|
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* copy the first buffer's data across */
|
2002-07-08 19:22:02 +00:00
|
|
|
memcpy (newbuf->data, buf1->data + offset, buf1->size - offset);
|
2001-12-14 22:59:21 +00:00
|
|
|
/* copy the second buffer's data across */
|
2004-03-13 15:27:01 +00:00
|
|
|
memcpy (newbuf->data + (buf1->size - offset), buf2->data,
|
2004-03-15 19:27:17 +00:00
|
|
|
len - (buf1->size - offset));
|
2003-05-24 10:09:39 +00:00
|
|
|
}
|
2006-01-12 16:07:50 +00:00
|
|
|
/* if the offset is 0, the new buffer has the same timestamp as buf1 */
|
|
|
|
if (offset == 0) {
|
|
|
|
GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET (buf1);
|
|
|
|
GST_BUFFER_TIMESTAMP (newbuf) = GST_BUFFER_TIMESTAMP (buf1);
|
|
|
|
|
|
|
|
/* if we completely merged the two buffers (appended), we can
|
|
|
|
* calculate the duration too. Also make sure we's not messing with
|
|
|
|
* invalid DURATIONS */
|
|
|
|
if (buf1->size + buf2->size == len) {
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (buf1) &&
|
|
|
|
GST_BUFFER_DURATION_IS_VALID (buf2)) {
|
|
|
|
/* add duration */
|
|
|
|
GST_BUFFER_DURATION (newbuf) = GST_BUFFER_DURATION (buf1) +
|
|
|
|
GST_BUFFER_DURATION (buf2);
|
|
|
|
}
|
|
|
|
if (GST_BUFFER_OFFSET_END_IS_VALID (buf2)) {
|
|
|
|
/* add offset_end */
|
|
|
|
GST_BUFFER_OFFSET_END (newbuf) = GST_BUFFER_OFFSET_END (buf2);
|
|
|
|
}
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
}
|
2001-08-11 08:25:05 +00:00
|
|
|
|
|
|
|
return newbuf;
|
|
|
|
}
|