gst/gstbuffer.*: Avoid typechecking in places where not needed.

Original commit message from CVS:
* gst/gstbuffer.c: (gst_subbuffer_finalize),
(gst_buffer_create_sub), (gst_buffer_is_span_fast):
* gst/gstbuffer.h:
Avoid typechecking in places where not needed.
Added accessor for malloc_data.
This commit is contained in:
Wim Taymans 2005-05-30 15:44:50 +00:00
parent 0e1ad862de
commit a86feaf099
3 changed files with 13 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2005-05-30 Wim Taymans <wim@fluendo.com>
* gst/gstbuffer.c: (gst_subbuffer_finalize),
(gst_buffer_create_sub), (gst_buffer_is_span_fast):
* gst/gstbuffer.h:
Avoid typechecking in places where not needed.
Added accessor for malloc_data.
2005-05-30 Wim Taymans <wim@fluendo.com>
* gst/gstpad.c: (gst_real_pad_init), (gst_pad_set_active),

View file

@ -365,8 +365,8 @@ gst_buffer_create_sub (GstBuffer * buffer, guint offset, guint size)
parent);
/* set the right values in the child */
GST_BUFFER_DATA (GST_BUFFER (subbuffer)) = buffer->data + offset;
GST_BUFFER_SIZE (GST_BUFFER (subbuffer)) = size;
GST_BUFFER_DATA (GST_BUFFER_CAST (subbuffer)) = buffer->data + offset;
GST_BUFFER_SIZE (GST_BUFFER_CAST (subbuffer)) = size;
/* we can copy the timestamp and offset if the new buffer starts at
* offset 0 */
@ -383,7 +383,7 @@ gst_buffer_create_sub (GstBuffer * buffer, guint offset, guint size)
GST_BUFFER_CAPS (subbuffer) = NULL;
return GST_BUFFER (subbuffer);
return GST_BUFFER_CAST (subbuffer);
}
/**

View file

@ -41,6 +41,7 @@ typedef struct _GstBufferClass GstBufferClass;
#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_CAST(obj) ((GstBuffer *)(obj))
#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)
@ -54,6 +55,7 @@ typedef struct _GstBufferClass GstBufferClass;
#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_MALLOCDATA(buf) (GST_BUFFER(buf)->malloc_data)
#define GST_BUFFER_OFFSET_NONE ((guint64)-1)
#define GST_BUFFER_MAXSIZE_NONE ((guint)0)