We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

Commit e134f7f7 authored by David Schleef's avatar David Schleef

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:
parent 735061ec
2005-05-15 David Schleef <ds@schleef.org>
* 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-15 David Schleef <ds@schleef.org>
* gst/elements/gstelements.c: Don't include headers that were
......
......@@ -26,7 +26,6 @@ TESTS = $(top_builddir)/tools/gst-register \
gst/gstbin \
gst/gstbus \
gst/gstcaps \
gst/gstdata \
gst/gstiterator \
gst/gstmessage \
gst/gstobject \
......
......@@ -98,8 +98,7 @@ START_TEST (test_buffer)
GST_BUFFER_DURATION (buffer) = (GstClockTime) GST_SECOND;
GST_BUFFER_OFFSET (buffer) = (guint64) 10;
GST_BUFFER_OFFSET_END (buffer) = (guint64) 19;
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_IN_CAPS);
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_SUBBUFFER);
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
memmove (GST_BUFFER_DATA (buffer), "a buffer", 8);
/* create a buffer with CRC checking */
......@@ -136,9 +135,7 @@ START_TEST (test_buffer)
"Offsets don't match !");
fail_unless (GST_BUFFER_OFFSET_END (newbuffer) ==
GST_BUFFER_OFFSET_END (buffer), "Offset ends don't match !");
fail_if (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_SUBBUFFER),
"GST_BUFFER_SUBBUFFER flag should not have been copied !");
fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_IN_CAPS),
fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_FLAG_IN_CAPS),
"GST_BUFFER_IN_CAPS flag should have been copied !");
g_free (header);
......
......@@ -82,7 +82,6 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gstbus.c \
gstcaps.c \
gstclock.c \
gstdata.c \
gstelement.c \
gstelementfactory.c \
gsterror.c \
......@@ -95,6 +94,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gstiterator.c \
gstmemchunk.c \
gstmessage.c \
gstminiobject.c \
gstpad.c \
gstpipeline.c \
gstplugin.c \
......@@ -157,7 +157,6 @@ gst_headers = \
gstcaps.h \
gstclock.h \
gstcompat.h \
gstdata.h \
gstelement.h \
gsterror.h \
gstevent.h \
......@@ -170,6 +169,7 @@ gst_headers = \
gstmacros.h \
gstmemchunk.h \
gstmessage.h \
gstminiobject.h \
gstpad.h \
gstpipeline.h \
gstplugin.h \
......@@ -206,7 +206,6 @@ noinst_HEADERS = \
gst-i18n-lib.h \
gst-i18n-app.h \
gst_private.h \
gstdata_private.h \
gstarch.h \
cothreads.h
......
......@@ -135,7 +135,7 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
/* the starting buffer had an invalid offset, in that case we assume continuous buffers */
GST_LOG_OBJECT (store, "adding buffer %p with invalid offset and size %u",
buffer, GST_BUFFER_SIZE (buffer));
gst_data_ref (GST_DATA (buffer));
gst_mini_object_ref (GST_MINI_OBJECT (buffer));
store->buffers = g_list_append (store->buffers, buffer);
return TRUE;
} else {
......@@ -176,14 +176,14 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
g_assert (sub);
buffer = sub;
} else {
gst_data_ref (GST_DATA (buffer));
gst_mini_object_ref (GST_MINI_OBJECT (buffer));
}
/* replace current buffer with new one */
GST_INFO_OBJECT (store,
"replacing buffer %p with buffer %p with offset %" G_GINT64_FORMAT
" and size %u", current_list->data, buffer,
GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
gst_data_unref (GST_DATA (current_list->data));
gst_mini_object_unref (GST_MINI_OBJECT (current_list->data));
current_list->data = buffer;
buffer = NULL;
break;
......@@ -215,7 +215,7 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
GST_BUFFER_OFFSET (sub) = start_offset + GST_BUFFER_OFFSET (buffer);
buffer = sub;
} else {
gst_data_ref (GST_DATA (buffer));
gst_mini_object_ref (GST_MINI_OBJECT (buffer));
}
GST_INFO_OBJECT (store,
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
......@@ -228,7 +228,7 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
}
}
if (buffer) {
gst_data_ref (GST_DATA (buffer));
gst_mini_object_ref (GST_MINI_OBJECT (buffer));
GST_INFO_OBJECT (store,
"adding buffer %p with offset %" G_GINT64_FORMAT " and size %u",
buffer, GST_BUFFER_OFFSET (buffer), GST_BUFFER_SIZE (buffer));
......@@ -245,7 +245,7 @@ gst_buffer_store_add_buffer_func (GstBufferStore * store, GstBuffer * buffer)
static void
gst_buffer_store_cleared_func (GstBufferStore * store)
{
g_list_foreach (store->buffers, (GFunc) gst_data_unref, NULL);
g_list_foreach (store->buffers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (store->buffers);
store->buffers = NULL;
}
......@@ -355,8 +355,8 @@ gst_buffer_store_get_buffer (GstBufferStore * store, guint64 offset, guint size)
"found matching buffer %p for offset %" G_GUINT64_FORMAT
" and size %u", current, offset, size);
ret = current;
gst_data_ref (GST_DATA (ret));
GST_LOG_OBJECT (store, "refcount %d", GST_DATA_REFCOUNT_VALUE (ret));
gst_mini_object_ref (GST_MINI_OBJECT (ret));
GST_LOG_OBJECT (store, "refcount %d", GST_MINI_OBJECT (ret)->refcount);
break;
} else if (cur_offset + GST_BUFFER_SIZE (current) > offset) {
if (cur_offset + GST_BUFFER_SIZE (current) >= offset + size) {
......@@ -384,7 +384,7 @@ gst_buffer_store_get_buffer (GstBufferStore * store, guint64 offset, guint size)
GST_DEBUG_OBJECT (store,
"not all data for offset %" G_GUINT64_FORMAT
" and remaining size %u available, aborting", offset, size);
gst_data_unref (GST_DATA (ret));
gst_mini_object_unref (GST_MINI_OBJECT (ret));
ret = NULL;
goto out;
}
......
......@@ -172,8 +172,8 @@ gst_fakesink_class_init (GstFakeSinkClass * klass)
gst_fakesink_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE, GST_TYPE_PAD);
gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2,
G_TYPE_OBJECT, GST_TYPE_PAD);
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_fakesink_change_state);
......@@ -317,7 +317,7 @@ gst_fakesink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_BUFFER_SIZE (buf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
GST_BUFFER_OFFSET_END (buf), GST_BUFFER_FLAGS (buf), buf);
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, buf);
g_object_notify (G_OBJECT (sink), "last_message");
}
......
......@@ -288,8 +288,7 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
gst_fakesrc_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstFakeSrcClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED_OBJECT, G_TYPE_NONE, 1,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
/*gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fakesrc_is_seekable); */
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_fakesrc_start);
......
......@@ -350,22 +350,92 @@ gst_filesrc_get_property (GObject * object, guint prop_id, GValue * value,
*/
#ifdef HAVE_MMAP
/* GstMmapBuffer */
typedef struct _GstMmapBuffer GstMmapBuffer;
typedef struct _GstMmapBufferClass GstMmapBufferClass;
#define GST_TYPE_MMAP_BUFFER (gst_mmap_buffer_get_type())
#define GST_IS_MMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MMAP_BUFFER))
#define GST_IS_MMAP_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MMAP_BUFFER))
#define GST_MMAP_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MMAP_BUFFER, GstMmapBufferClass))
#define GST_MMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MMAP_BUFFER, GstMmapBuffer))
#define GST_MMAP_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MMAP_BUFFER, GstMmapBufferClass))
struct _GstMmapBuffer
{
GstBuffer buffer;
GstFileSrc *filesrc;
};
struct _GstMmapBufferClass
{
GstBufferClass buffer_class;
};
static void gst_mmap_buffer_init (GTypeInstance * instance, gpointer g_class);
static void gst_mmap_buffer_class_init (gpointer g_class, gpointer class_data);
static void gst_mmap_buffer_finalize (GstMmapBuffer * mmap_buffer);
static GType
gst_mmap_buffer_get_type (void)
{
static GType _gst_mmap_buffer_type;
if (G_UNLIKELY (_gst_mmap_buffer_type == 0)) {
static const GTypeInfo mmap_buffer_info = {
sizeof (GstMmapBufferClass),
NULL,
NULL,
gst_mmap_buffer_class_init,
NULL,
NULL,
sizeof (GstMmapBuffer),
0,
gst_mmap_buffer_init,
NULL
};
_gst_mmap_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
"GstMmapBuffer", &mmap_buffer_info, 0);
}
return _gst_mmap_buffer_type;
}
static void
gst_filesrc_free_parent_mmap (GstBuffer * buf)
gst_mmap_buffer_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
mini_object_class->finalize =
(GstMiniObjectFinalizeFunction) gst_mmap_buffer_finalize;
}
static void
gst_mmap_buffer_init (GTypeInstance * instance, gpointer g_class)
{
}
static void
gst_mmap_buffer_finalize (GstMmapBuffer * mmap_buffer)
{
guint size;
guint64 offset;
gpointer data;
GstBaseSrc *src;
guint64 offset;
GstFileSrc *src;
GstBuffer *buffer = GST_BUFFER (mmap_buffer);
/* get info */
size = GST_BUFFER_MAXSIZE (buf);
offset = GST_BUFFER_OFFSET (buf);
data = GST_BUFFER_DATA (buf);
src = (GstBaseSrc *) GST_BUFFER_PRIVATE (buf);
if (!GST_IS_BASESRC (src))
goto wrong_buffer;
size = GST_BUFFER_SIZE (buffer);
offset = GST_BUFFER_OFFSET (buffer);
data = GST_BUFFER_DATA (buffer);
src = mmap_buffer->filesrc;
GST_LOG ("freeing mmap()d buffer at %" G_GUINT64_FORMAT "+%u", offset, size);
......@@ -385,15 +455,6 @@ gst_filesrc_free_parent_mmap (GstBuffer * buf)
* guint64 as hex */
GST_LOG ("unmapped region %08lx+%08lx at %p",
(gulong) offset, (gulong) size, data);
GST_BUFFER_DATA (buf) = NULL;
return;
wrong_buffer:
{
GST_WARNING ("freeing wrong mmap buffer");
return;
}
}
static GstBuffer *
......@@ -416,9 +477,10 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
(gulong) offset, (gulong) size, mmapregion);
/* time to allocate a new mapbuf */
buf = gst_buffer_new ();
buf = (GstBuffer *) gst_mini_object_new (GST_TYPE_MMAP_BUFFER);
/* mmap() the data into this new buffer */
GST_BUFFER_DATA (buf) = mmapregion;
GST_MMAP_BUFFER (buf)->filesrc = src;
#ifdef MADV_SEQUENTIAL
/* madvise to tell the kernel what to do with it */
......@@ -428,15 +490,13 @@ gst_filesrc_map_region (GstFileSrc * src, off_t offset, size_t size)
#endif
/* fill in the rest of the fields */
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_ORIGINAL);
/* FIXME */
//GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY);
//GST_BUFFER_FLAG_SET (buf, GST_BUFFER_ORIGINAL);
GST_BUFFER_SIZE (buf) = size;
GST_BUFFER_MAXSIZE (buf) = size;
GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_OFFSET_END (buf) = offset + size;
GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_PRIVATE (buf) = src;
GST_BUFFER_FREE_DATA_FUNC (buf) = gst_filesrc_free_parent_mmap;
return buf;
......@@ -661,7 +721,6 @@ gst_filesrc_create_read (GstFileSrc * src, guint64 offset, guint length,
length = ret;
GST_BUFFER_SIZE (buf) = length;
GST_BUFFER_MAXSIZE (buf) = length;
GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_OFFSET_END (buf) = offset + length;
......
......@@ -182,8 +182,7 @@ gst_identity_class_init (GstIdentityClass * klass)
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstIdentityClass, handoff), NULL, NULL,
gst_marshal_VOID__BOXED, G_TYPE_NONE, 1,
GST_TYPE_BUFFER | G_SIGNAL_TYPE_STATIC_SCOPE);
gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
......
......@@ -359,7 +359,7 @@ gst_type_find_element_src_event (GstPad * pad, GstEvent * event)
if (typefind->mode != MODE_NORMAL) {
/* need to do more? */
gst_data_unref (GST_DATA (event));
gst_mini_object_unref (GST_MINI_OBJECT (event));
return FALSE;
}
return gst_pad_event_default (pad, event);
......@@ -385,7 +385,7 @@ new_entry (void)
static void
free_entry_buffers (TypeFindEntry * entry)
{
g_list_foreach (entry->buffers, (GFunc) gst_data_unref, NULL);
g_list_foreach (entry->buffers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (entry->buffers);
entry->buffers = NULL;
}
......@@ -539,7 +539,7 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event)
}
break;
default:
gst_data_unref (GST_DATA (event));
gst_mini_object_unref (GST_MINI_OBJECT (event));
res = TRUE;
break;
}
......
......@@ -44,6 +44,7 @@
#include <gst/gstiterator.h>
#include <gst/gstmarshal.h>
#include <gst/gstmessage.h>
#include <gst/gstminiobject.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstpipeline.h>
......
This diff is collapsed.
......@@ -24,45 +24,36 @@
#ifndef __GST_BUFFER_H__
#define __GST_BUFFER_H__
#include <gst/gstdata.h>
#include <gst/gstminiobject.h>
#include <gst/gstclock.h>
#include <gst/gstcaps.h>
G_BEGIN_DECLS
typedef struct _GstBuffer GstBuffer;
typedef void (*GstBufferFreeDataFunc) (GstBuffer *buffer);
typedef struct _GstBufferClass GstBufferClass;
#define GST_BUFFER_TRACE_NAME "GstBuffer"
extern GType _gst_buffer_type;
#define GST_TYPE_BUFFER (gst_buffer_get_type())
#define GST_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_BUFFER))
#define GST_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_BUFFER))
#define GST_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BUFFER, GstBufferClass))
#define GST_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_BUFFER, GstBuffer))
#define GST_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BUFFER, GstBufferClass))
#define GST_BUFFER(buf) ((GstBuffer *)(buf))
#define GST_IS_BUFFER(buf) (GST_DATA_TYPE(buf) == GST_TYPE_BUFFER)
#define GST_BUFFER_REFCOUNT(buf) GST_DATA_REFCOUNT(buf)
#define GST_BUFFER_REFCOUNT_VALUE(buf) GST_DATA_REFCOUNT_VALUE(buf)
#define GST_BUFFER_COPY_FUNC(buf) GST_DATA_COPY_FUNC(buf)
#define GST_BUFFER_FREE_FUNC(buf) GST_DATA_FREE_FUNC(buf)
#define GST_BUFFER_FLAGS(buf) GST_DATA_FLAGS(buf)
#define GST_BUFFER_FLAG_IS_SET(buf,flag) GST_DATA_FLAG_IS_SET (buf, flag)
#define GST_BUFFER_FLAG_SET(buf,flag) GST_DATA_FLAG_SET (buf, flag)
#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_DATA_FLAG_UNSET (buf, flag)
#define GST_BUFFER_FLAGS(buf) GST_MINI_OBJECT_FLAGS(buf)
#define GST_BUFFER_FLAG_IS_SET(buf,flag) GST_MINI_OBJECT_FLAG_IS_SET (buf, flag)
#define GST_BUFFER_FLAG_SET(buf,flag) GST_MINI_OBJECT_FLAG_SET (buf, flag)
#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_MINI_OBJECT_FLAG_UNSET (buf, flag)
#define GST_BUFFER_DATA(buf) (GST_BUFFER(buf)->data)
#define GST_BUFFER_SIZE(buf) (GST_BUFFER(buf)->size)
#define GST_BUFFER_MAXSIZE(buf) (GST_BUFFER(buf)->maxsize)
#define GST_BUFFER_TIMESTAMP(buf) (GST_BUFFER(buf)->timestamp)
#define GST_BUFFER_DURATION(buf) (GST_BUFFER(buf)->duration)
#define GST_BUFFER_CAPS(buf) (GST_BUFFER(buf)->caps)
#define GST_BUFFER_OFFSET(buf) (GST_BUFFER(buf)->offset)
#define GST_BUFFER_OFFSET_END(buf) (GST_BUFFER(buf)->offset_end)
#define GST_BUFFER_FREE_DATA_FUNC(buf) (GST_BUFFER(buf)->free_data)
#define GST_BUFFER_PRIVATE(buf) (GST_BUFFER(buf)->buffer_private)
#define GST_BUFFER_OFFSET_NONE ((guint64)-1)
#define GST_BUFFER_MAXSIZE_NONE ((guint)0)
......@@ -75,44 +66,37 @@ extern GType _gst_buffer_type;
/**
* GstBufferFlag:
* @GST_BUFFER_READONLY: the buffer is read-only.
* @GST_BUFFER_SUBBUFFER: the buffer is a subbuffer, the parent buffer can be
* found with the GST_BUFFER_POOL_PRIVATE() macro.
* @GST_BUFFER_ORIGINAL: buffer is not a copy of another buffer.
* @GST_BUFFER_DONTFREE: do not try to free the data when this buffer is
* unreferenced.
* @GST_BUFFER_PREROLL: the buffer is part of a preroll and should not be
* @GST_BUFFER_FLAG_READONLY: the buffer is read-only.
* @GST_BUFFER_FLAG_ORIGINAL: buffer is not a copy of another buffer.
* @GST_BUFFER_FLAG_PREROLL: the buffer is part of a preroll and should not be
* displayed.
* @GST_BUFFER_DISCONT: the buffer marks a discontinuity in the stream.
* @GST_BUFFER_IN_CAPS: the buffer has been added as a field in a #GstCaps.
* @GST_BUFFER_GAP: the buffer has been created to fill a gap in the stream.
* @GST_BUFFER_DELTA_UNIT: this unit cannot be decoded independently.
* @GST_BUFFER_FLAG_DISCONT: the buffer marks a discontinuity in the stream.
* @GST_BUFFER_FLAG_IN_CAPS: the buffer has been added as a field in a #GstCaps.
* @GST_BUFFER_FLAG_GAP: the buffer has been created to fill a gap in the stream.
* @GST_BUFFER_FLAG_DELTA_UNIT: this unit cannot be decoded independently.
* Since 0.8.5
* @GST_BUFFER_FLAG_LAST: additional flags can be added starting from this flag.
*
* A set of buffer flags used to describe properties of a #GstBuffer.
*/
typedef enum {
GST_BUFFER_READONLY = GST_DATA_READONLY,
GST_BUFFER_SUBBUFFER = GST_DATA_FLAG_LAST,
GST_BUFFER_ORIGINAL, /* original data, not copied, not currently used */
GST_BUFFER_DONTFREE, /* buffer data is managed by somebody else and cannot be freeed */
GST_BUFFER_PREROLL, /* sample should not be displayed */
GST_BUFFER_DISCONT, /* buffer is first after discontinuity in the stream */
GST_BUFFER_IN_CAPS, /* buffer is also part of caps */
GST_BUFFER_GAP, /* buffer has been created to fill a gap in the stream */
GST_BUFFER_DELTA_UNIT, /* can't be used as sync point in stream */
GST_BUFFER_FLAG_LAST = GST_DATA_FLAG_LAST + 8
GST_BUFFER_FLAG_READONLY = GST_MINI_OBJECT_FLAG_READONLY,
GST_BUFFER_FLAG_ORIGINAL = (GST_MINI_OBJECT_FLAG_LAST << 0), /* original data, not copied, not currently used */
GST_BUFFER_FLAG_PREROLL = (GST_MINI_OBJECT_FLAG_LAST << 1), /* sample should not be displayed */
GST_BUFFER_FLAG_DISCONT = (GST_MINI_OBJECT_FLAG_LAST << 2), /* buffer is first after discontinuity in the stream */
GST_BUFFER_FLAG_IN_CAPS = (GST_MINI_OBJECT_FLAG_LAST << 3), /* buffer is also part of caps */
GST_BUFFER_FLAG_GAP = (GST_MINI_OBJECT_FLAG_LAST << 4), /* buffer has been created to fill a gap in the stream */
GST_BUFFER_FLAG_DELTA_UNIT = (GST_MINI_OBJECT_FLAG_LAST << 5), /* can't be used as sync point in stream */
GST_BUFFER_FLAG_LAST = (GST_MINI_OBJECT_FLAG_LAST << 8)
} GstBufferFlag;
struct _GstBuffer {
GstData data_type;
GstMiniObject mini_object;
/*< public >*/ /* with COW */
/* pointer to data and its size */
guint8 *data; /* pointer to buffer data */
guint size; /* size of buffer data */
guint maxsize; /* max size of this buffer */
/* timestamp */
GstClockTime timestamp;
......@@ -131,14 +115,17 @@ struct _GstBuffer {
guint64 offset;
guint64 offset_end;
/*< protected >*/
GstBufferFreeDataFunc free_data;
gpointer buffer_private;
/*< private >*/
guint8 *malloc_data;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstBufferClass {
GstMiniObjectClass mini_object_class;
};
/* allocation */
GType gst_buffer_get_type (void);
GstBuffer* gst_buffer_new (void);
......@@ -151,15 +138,14 @@ G_STMT_START { \
} G_STMT_END
/* refcounting */
#define gst_buffer_ref(buf) GST_BUFFER (gst_data_ref (GST_DATA (buf)))
#define gst_buffer_ref_by_count(buf,c) GST_BUFFER (gst_data_ref_by_count (GST_DATA (buf), c))
#define gst_buffer_unref(buf) gst_data_unref (GST_DATA (buf))
#define gst_buffer_ref(buf) GST_BUFFER (gst_mini_object_ref (GST_MINI_OBJECT (buf)))
#define gst_buffer_unref(buf) gst_mini_object_unref (GST_MINI_OBJECT (buf))
/* copy buffer */
#define gst_buffer_copy(buf) GST_BUFFER (gst_data_copy (GST_DATA (buf)))
#define gst_buffer_is_writable(buf) gst_data_is_writable (GST_DATA (buf))
#define gst_buffer_copy_on_write(buf) GST_BUFFER (gst_data_copy_on_write (GST_DATA (buf)))
#define gst_buffer_copy(buf) GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT (buf)))
#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT (buf))
#define gst_buffer_make_writable(buf) GST_BUFFER (gst_mini_object_make_writable (GST_MINI_OBJECT (buf)))
#define gst_buffer_replace(obuf,nbuf) gst_data_replace ((GstData **)(obuf), GST_DATA (nbuf))
#define gst_buffer_replace(obuf,nbuf) gst_mini_object_replace ((GstMiniObject **)(obuf), GST_MINI_OBJECT (nbuf))
GstCaps* gst_buffer_get_caps (GstBuffer *buffer);
void gst_buffer_set_caps (GstBuffer *buffer, GstCaps *caps);
......
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim@fluendo.com>
*
* gstdata.c: Data operations
*
* 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.
*/
#include "gst_private.h"
#include "gstdata.h"
#include "gstdata_private.h"
#include "gstinfo.h"
#include "gstutils.h"
GType
gst_data_get_type (void)
{
static GType type = 0;
if (!type)
type = g_boxed_type_register_static ("GstData",
(GBoxedCopyFunc) gst_data_copy, (GBoxedFreeFunc) gst_data_unref);
return type;
}
/**
* gst_data_init: