Blame gst/gstbufferlist.h

Packit Service 963350
/* GStreamer
Packit Service 963350
 * Copyright (C) 2009 Axis Communications <dev-gstreamer at axis dot com>
Packit Service 963350
 * @author Jonas Holmberg <jonas dot holmberg at axis dot com>
Packit Service 963350
 *
Packit Service 963350
 * gstbufferlist.h: Header for GstBufferList object
Packit Service 963350
 *
Packit Service 963350
 * This library is free software; you can redistribute it and/or
Packit Service 963350
 * modify it under the terms of the GNU Library General Public
Packit Service 963350
 * License as published by the Free Software Foundation; either
Packit Service 963350
 * version 2 of the License, or (at your option) any later version.
Packit Service 963350
 *
Packit Service 963350
 * This library is distributed in the hope that it will be useful,
Packit Service 963350
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 963350
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 963350
 * Library General Public License for more details.
Packit Service 963350
 *
Packit Service 963350
 * You should have received a copy of the GNU Library General Public
Packit Service 963350
 * License along with this library; if not, write to the
Packit Service 963350
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit Service 963350
 * Boston, MA 02110-1301, USA.
Packit Service 963350
 */
Packit Service 963350
Packit Service 963350
#ifndef __GST_BUFFER_LIST_H__
Packit Service 963350
#define __GST_BUFFER_LIST_H__
Packit Service 963350
Packit Service 963350
#include <gst/gstbuffer.h>
Packit Service 963350
Packit Service 963350
G_BEGIN_DECLS
Packit Service 963350
Packit Service 963350
GST_API GType _gst_buffer_list_type;
Packit Service 963350
Packit Service 963350
#define GST_TYPE_BUFFER_LIST      (_gst_buffer_list_type)
Packit Service 963350
#define GST_IS_BUFFER_LIST(obj)   (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_BUFFER_LIST))
Packit Service 963350
#define GST_BUFFER_LIST_CAST(obj) ((GstBufferList *)obj)
Packit Service 963350
#define GST_BUFFER_LIST(obj)      (GST_BUFFER_LIST_CAST(obj))
Packit Service 963350
Packit Service 963350
typedef struct _GstBufferList GstBufferList;
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * GstBufferListFunc:
Packit Service 963350
 * @buffer: (out) (nullable): pointer the buffer
Packit Service 963350
 * @idx: the index of @buffer
Packit Service 963350
 * @user_data: user data passed to gst_buffer_list_foreach()
Packit Service 963350
 *
Packit Service 963350
 * A function that will be called from gst_buffer_list_foreach(). The @buffer
Packit Service 963350
 * field will point to a the reference of the buffer at @idx.
Packit Service 963350
 *
Packit Service 963350
 * When this function returns %TRUE, the next buffer will be
Packit Service 963350
 * returned. When %FALSE is returned, gst_buffer_list_foreach() will return.
Packit Service 963350
 *
Packit Service 963350
 * When @buffer is set to %NULL, the item will be removed from the bufferlist.
Packit Service 963350
 * When @buffer has been made writable, the new buffer reference can be assigned
Packit Service 963350
 * to @buffer. This function is responsible for unreffing the old buffer when
Packit Service 963350
 * removing or modifying.
Packit Service 963350
 *
Packit Service 963350
 * Returns: %FALSE when gst_buffer_list_foreach() should stop
Packit Service 963350
 */
Packit Service 963350
typedef gboolean   (*GstBufferListFunc)   (GstBuffer **buffer, guint idx,
Packit Service 963350
                                           gpointer user_data);
Packit Service 963350
Packit Service 963350
Packit Service 963350
/* refcounting */
Packit Service 963350
/**
Packit Service 963350
 * gst_buffer_list_ref:
Packit Service 963350
 * @list: a #GstBufferList
Packit Service 963350
 *
Packit Service 963350
 * Increases the refcount of the given buffer list by one.
Packit Service 963350
 *
Packit Service 963350
 * Note that the refcount affects the writability of @list and its data, see
Packit Service 963350
 * gst_buffer_list_make_writable(). It is important to note that keeping
Packit Service 963350
 * additional references to GstBufferList instances can potentially increase
Packit Service 963350
 * the number of memcpy operations in a pipeline.
Packit Service 963350
 *
Packit Service 963350
 * Returns: (transfer full): @list
Packit Service 963350
 */
Packit Service 963350
static inline GstBufferList *
Packit Service 963350
gst_buffer_list_ref (GstBufferList * list)
Packit Service 963350
{
Packit Service 963350
  return GST_BUFFER_LIST_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (
Packit Service 963350
      list)));
Packit Service 963350
}
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * gst_buffer_list_unref:
Packit Service 963350
 * @list: (transfer full): a #GstBufferList
Packit Service 963350
 *
Packit Service 963350
 * Decreases the refcount of the buffer list. If the refcount reaches 0, the
Packit Service 963350
 * buffer list will be freed.
Packit Service 963350
 */
Packit Service 963350
static inline void
Packit Service 963350
gst_buffer_list_unref (GstBufferList * list)
Packit Service 963350
{
Packit Service 963350
  gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
Packit Service 963350
}
Packit Service 963350
Packit Service 963350
/* copy */
Packit Service 963350
/**
Packit Service 963350
 * gst_buffer_list_copy:
Packit Service 963350
 * @list: a #GstBufferList
Packit Service 963350
 *
Packit Service 963350
 * Create a shallow copy of the given buffer list. This will make a newly
Packit Service 963350
 * allocated copy of the source list with copies of buffer pointers. The
Packit Service 963350
 * refcount of buffers pointed to will be increased by one.
Packit Service 963350
 *
Packit Service 963350
 * Returns: (transfer full): a new copy of @list.
Packit Service 963350
 */
Packit Service 963350
static inline GstBufferList *
Packit Service 963350
gst_buffer_list_copy (const GstBufferList * list)
Packit Service 963350
{
Packit Service 963350
  return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (list)));
Packit Service 963350
}
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * gst_buffer_list_is_writable:
Packit Service 963350
 * @list: a #GstBufferList
Packit Service 963350
 *
Packit Service 963350
 * Tests if you can safely add buffers and groups into a buffer list.
Packit Service 963350
 */
Packit Service 963350
#define gst_buffer_list_is_writable(list) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (list))
Packit Service 963350
Packit Service 963350
/**
Packit Service 963350
 * gst_buffer_list_make_writable:
Packit Service 963350
 * @list: (transfer full): a #GstBufferList
Packit Service 963350
 *
Packit Service 963350
 * Makes a writable buffer list from the given buffer list. If the source buffer
Packit Service 963350
 * list is already writable, this will simply return the same buffer list. A
Packit Service 963350
 * copy will otherwise be made using gst_buffer_list_copy().
Packit Service 963350
 *
Packit Service 963350
 * Returns: (transfer full): a writable list, which may or may not be the
Packit Service 963350
 *     same as @list
Packit Service 963350
 */
Packit Service 963350
#define gst_buffer_list_make_writable(list) GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (list)))
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GType                    gst_buffer_list_get_type              (void);
Packit Service 963350
Packit Service 963350
/* allocation */
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstBufferList *          gst_buffer_list_new                   (void) G_GNUC_MALLOC;
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstBufferList *          gst_buffer_list_new_sized             (guint size) G_GNUC_MALLOC;
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
guint                    gst_buffer_list_length                (GstBufferList *list);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstBuffer *              gst_buffer_list_get                   (GstBufferList *list, guint idx);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
GstBuffer *              gst_buffer_list_get_writable          (GstBufferList *list, guint idx);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                     gst_buffer_list_insert                (GstBufferList *list, gint idx, GstBuffer *buffer);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
void                     gst_buffer_list_remove                (GstBufferList *list, guint idx, guint length);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gboolean                 gst_buffer_list_foreach               (GstBufferList *list,
Packit Service 963350
                                                                GstBufferListFunc func,
Packit Service 963350
								gpointer user_data);
Packit Service 963350
GST_API
Packit Service 963350
GstBufferList *          gst_buffer_list_copy_deep             (const GstBufferList * list);
Packit Service 963350
Packit Service 963350
GST_API
Packit Service 963350
gsize                    gst_buffer_list_calculate_size        (GstBufferList * list);
Packit Service 963350
Packit Service 963350
#define gst_buffer_list_add(l,b) gst_buffer_list_insert((l),-1,(b));
Packit Service 963350
Packit Service 963350
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit Service 963350
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBufferList, gst_buffer_list_unref)
Packit Service 963350
#endif
Packit Service 963350
Packit Service 963350
G_END_DECLS
Packit Service 963350
Packit Service 963350
#endif /* __GST_BUFFER_LIST_H__ */