GstBuffer: GStreamer 1.0 Core Reference Manual

## GstBuffer GstBuffer |

## Functions

#define | GST_BUFFER_FLAGS()
#define | GST_BUFFER_FLAG_IS_SET()
#define | GST_BUFFER_FLAG_SET()
#define | GST_BUFFER_FLAG_UNSET()
#define | GST_BUFFER_PTS()
#define | GST_BUFFER_DTS()
#define | GST_BUFFER_DTS_OR_PTS()
#define | GST_BUFFER_DURATION()
#define | GST_BUFFER_OFFSET()
#define | GST_BUFFER_OFFSET_END()
#define | GST_BUFFER_DURATION_IS_VALID()
#define | GST_BUFFER_PTS_IS_VALID()
#define | GST_BUFFER_DTS_IS_VALID()
#define | GST_BUFFER_OFFSET_IS_VALID()
#define | GST_BUFFER_OFFSET_END_IS_VALID()
#define | GST_BUFFER_IS_DISCONT()
GstBuffer * | gst_buffer_new ()
GstBuffer * | gst_buffer_new_allocate ()
GstBuffer * | gst_buffer_new_wrapped ()
GstBuffer * | gst_buffer_new_wrapped_full ()
GstBuffer * | gst_buffer_ref ()
void | gst_buffer_unref ()
gsize | gst_buffer_get_sizes ()
gsize | gst_buffer_get_size ()
gsize | gst_buffer_get_sizes_range ()
gboolean | gst_buffer_resize_range ()
void | gst_buffer_resize ()
void | gst_buffer_set_size ()
guint | gst_buffer_get_max_memory ()
GstMemory * | gst_buffer_peek_memory ()
guint | gst_buffer_n_memory ()
void | gst_buffer_insert_memory ()
void | gst_buffer_replace_memory_range ()
GstMemory * | gst_buffer_get_memory_range ()
void | gst_buffer_remove_memory_range ()
gboolean | gst_buffer_find_memory ()
void | gst_buffer_prepend_memory ()
void | gst_buffer_append_memory ()
void | gst_buffer_replace_memory ()
void | gst_buffer_replace_all_memory ()
GstMemory * | gst_buffer_get_memory ()
GstMemory * | gst_buffer_get_all_memory ()
void | gst_buffer_remove_memory ()
void | gst_buffer_remove_all_memory ()
gboolean | gst_buffer_is_all_memory_writable ()
gboolean | gst_buffer_is_memory_range_writable ()
gboolean | gst_buffer_map ()
gboolean | gst_buffer_map_range ()
void | gst_buffer_unmap ()
gint | gst_buffer_memcmp ()
gsize | gst_buffer_extract ()
void | gst_buffer_extract_dup ()
gsize | gst_buffer_fill ()
gsize | gst_buffer_memset ()
GstBuffer * | gst_buffer_copy ()
gboolean | gst_buffer_copy_into ()
GstBuffer * | gst_buffer_copy_region ()
GstBuffer * | gst_buffer_copy_deep ()
#define | gst_buffer_is_writable()
#define | gst_buffer_make_writable()
gboolean | gst_buffer_replace ()
GstBuffer * | gst_buffer_append ()
GstBuffer * | gst_buffer_append_region ()
GstMeta * | gst_buffer_get_meta ()
GstMeta * | gst_buffer_add_meta ()
gboolean | gst_buffer_remove_meta ()
GstMeta * | gst_buffer_iterate_meta ()
gboolean | (*GstBufferForeachMetaFunc) ()
gboolean | gst_buffer_foreach_meta ()
GstParentBufferMeta * | gst_buffer_add_parent_buffer_meta ()
#define | gst_buffer_get_parent_buffer_meta()

## Types and Values

struct | GstBuffer
enum | GstBufferFlags
#define | GST_BUFFER_OFFSET_NONE
enum | GstBufferCopyFlags
#define | GST_BUFFER_COPY_METADATA
#define | GST_BUFFER_COPY_ALL
struct | GstParentBufferMeta

## Object Hierarchy

        GBoxed
        ╰── GstBuffer

## Includes

    #include <gst/gst.h>

## Description

## Functions

### GST_BUFFER_FLAGS()

    #define GST_BUFFER_FLAGS(buf)                   GST_MINI_OBJECT_FLAGS(buf)

### GST_BUFFER_FLAG_IS_SET()

    #define GST_BUFFER_FLAG_IS_SET(buf,flag)        GST_MINI_OBJECT_FLAG_IS_SET (buf, flag)

### GST_BUFFER_FLAG_SET()

    #define GST_BUFFER_FLAG_SET(buf,flag)           GST_MINI_OBJECT_FLAG_SET (buf, flag)

### GST_BUFFER_FLAG_UNSET()

    #define GST_BUFFER_FLAG_UNSET(buf,flag)         GST_MINI_OBJECT_FLAG_UNSET (buf, flag)

### GST_BUFFER_PTS()

    #define GST_BUFFER_PTS(buf)                     (GST_BUFFER_CAST(buf)->pts)

### GST_BUFFER_DTS()

    #define GST_BUFFER_DTS(buf)                     (GST_BUFFER_CAST(buf)->dts)

### GST_BUFFER_DTS_OR_PTS()

    #define GST_BUFFER_DTS_OR_PTS(buf)              (GST_BUFFER_DTS_IS_VALID(buf) ? GST_BUFFER_DTS(buf) : GST_BUFFER_PTS (buf))

### GST_BUFFER_DURATION()

    #define GST_BUFFER_DURATION(buf)                (GST_BUFFER_CAST(buf)->duration)

### GST_BUFFER_OFFSET()

    #define GST_BUFFER_OFFSET(buf)                  (GST_BUFFER_CAST(buf)->offset)

### GST_BUFFER_OFFSET_END()

    #define GST_BUFFER_OFFSET_END(buf)              (GST_BUFFER_CAST(buf)->offset_end)

### GST_BUFFER_DURATION_IS_VALID()

    #define GST_BUFFER_DURATION_IS_VALID(buffer)    (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))

### GST_BUFFER_PTS_IS_VALID()

    #define GST_BUFFER_PTS_IS_VALID(buffer)   (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))

### GST_BUFFER_DTS_IS_VALID()

    #define GST_BUFFER_DTS_IS_VALID(buffer)   (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer)))

### GST_BUFFER_OFFSET_IS_VALID()

    #define GST_BUFFER_OFFSET_IS_VALID(buffer)      (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE)

### GST_BUFFER_OFFSET_END_IS_VALID()

    #define GST_BUFFER_OFFSET_END_IS_VALID(buffer)  (GST_BUFFER_OFFSET_END (buffer) != GST_BUFFER_OFFSET_NONE)

### GST_BUFFER_IS_DISCONT()

    #define GST_BUFFER_IS_DISCONT(buffer)   (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))

### gst_buffer_new ()

    GstBuffer *
    gst_buffer_new (void);

### gst_buffer_new_allocate ()

    GstBuffer *
    gst_buffer_new_allocate (GstAllocator *allocator,
                             gsize size,
                             GstAllocationParams *params);

### gst_buffer_new_wrapped ()

    GstBuffer *
    gst_buffer_new_wrapped (gpointer data,
                            gsize size);

### gst_buffer_new_wrapped_full ()

    GstBuffer *
    gst_buffer_new_wrapped_full (GstMemoryFlags flags,
                                 gpointer data,
                                 gsize maxsize,
                                 gsize offset,
                                 gsize size,
                                 gpointer user_data,
                                 GDestroyNotify notify);

### gst_buffer_ref ()

    GstBuffer *
    gst_buffer_ref (GstBuffer *buf);

### gst_buffer_unref ()

    void
    gst_buffer_unref (GstBuffer *buf);

### gst_buffer_get_sizes ()

    gsize
    gst_buffer_get_sizes (GstBuffer *buffer,
                          gsize *offset,
                          gsize *maxsize);

### gst_buffer_get_size ()

    gsize
    gst_buffer_get_size (GstBuffer *buffer);

### gst_buffer_get_sizes_range ()

    gsize
    gst_buffer_get_sizes_range (GstBuffer *buffer,
                                guint idx,
                                gint length,
                                gsize *offset,
                                gsize *maxsize);

### gst_buffer_resize_range ()

    gboolean
    gst_buffer_resize_range (GstBuffer *buffer,
                             guint idx,
                             gint length,
                             gssize offset,
                             gssize size);

### gst_buffer_resize ()

    void
    gst_buffer_resize (GstBuffer *buffer,
                       gssize offset,
                       gssize size);

### gst_buffer_set_size ()

    void
    gst_buffer_set_size (GstBuffer *buffer,
                         gssize size);

### gst_buffer_get_max_memory ()

    guint
    gst_buffer_get_max_memory (void);

### gst_buffer_peek_memory ()

    GstMemory *
    gst_buffer_peek_memory (GstBuffer *buffer,
                            guint idx);

### gst_buffer_n_memory ()

    guint
    gst_buffer_n_memory (GstBuffer *buffer);

### gst_buffer_insert_memory ()

    void
    gst_buffer_insert_memory (GstBuffer *buffer,
                              gint idx,
                              GstMemory *mem);

### gst_buffer_replace_memory_range ()

    void
    gst_buffer_replace_memory_range (GstBuffer *buffer,
                                     guint idx,
                                     gint length,
                                     GstMemory *mem);

### gst_buffer_get_memory_range ()

    GstMemory *
    gst_buffer_get_memory_range (GstBuffer *buffer,
                                 guint idx,
                                 gint length);

### gst_buffer_remove_memory_range ()

    void
    gst_buffer_remove_memory_range (GstBuffer *buffer,
                                    guint idx,
                                    gint length);

### gst_buffer_find_memory ()

    gboolean
    gst_buffer_find_memory (GstBuffer *buffer,
                            gsize offset,
                            gsize size,
                            guint *idx,
                            guint *length,
                            gsize *skip);

### gst_buffer_prepend_memory ()

    void
    gst_buffer_prepend_memory (GstBuffer *buffer,
                               GstMemory *mem);

### gst_buffer_append_memory ()

    void
    gst_buffer_append_memory (GstBuffer *buffer,
                              GstMemory *mem);

### gst_buffer_replace_memory ()

    void
    gst_buffer_replace_memory (GstBuffer *buffer,
                               guint idx,
                               GstMemory *mem);

### gst_buffer_replace_all_memory ()

    void
    gst_buffer_replace_all_memory (GstBuffer *buffer,
                                   GstMemory *mem);

### gst_buffer_get_memory ()

    GstMemory *
    gst_buffer_get_memory (GstBuffer *buffer,
                           guint idx);

### gst_buffer_get_all_memory ()

    GstMemory *
    gst_buffer_get_all_memory (GstBuffer *buffer);

### gst_buffer_remove_memory ()

    void
    gst_buffer_remove_memory (GstBuffer *buffer,
                              guint idx);

### gst_buffer_remove_all_memory ()

    void
    gst_buffer_remove_all_memory (GstBuffer *buffer);

### gst_buffer_is_all_memory_writable ()

    gboolean
    gst_buffer_is_all_memory_writable (GstBuffer *buffer);

### gst_buffer_is_memory_range_writable ()

    gboolean
    gst_buffer_is_memory_range_writable (GstBuffer *buffer,
                                         guint idx,
                                         gint length);

### gst_buffer_map ()

    gboolean
    gst_buffer_map (GstBuffer *buffer,
                    GstMapInfo *info,
                    GstMapFlags flags);

### gst_buffer_map_range ()

    gboolean
    gst_buffer_map_range (GstBuffer *buffer,
                          guint idx,
                          gint length,
                          GstMapInfo *info,
                          GstMapFlags flags);

### gst_buffer_unmap ()

    void
    gst_buffer_unmap (GstBuffer *buffer,
                      GstMapInfo *info);

### gst_buffer_memcmp ()

    gint
    gst_buffer_memcmp (GstBuffer *buffer,
                       gsize offset,
                       gconstpointer mem,
                       gsize size);

### gst_buffer_extract ()

    gsize
    gst_buffer_extract (GstBuffer *buffer,
                        gsize offset,
                        gpointer dest,
                        gsize size);

### gst_buffer_extract_dup ()

    void
    gst_buffer_extract_dup (GstBuffer *buffer,
                            gsize offset,
                            gsize size,
                            gpointer *dest,
                            gsize *dest_size);

### gst_buffer_fill ()

    gsize
    gst_buffer_fill (GstBuffer *buffer,
                     gsize offset,
                     gconstpointer src,
                     gsize size);

### gst_buffer_memset ()

    gsize
    gst_buffer_memset (GstBuffer *buffer,
                       gsize offset,
                       guint8 val,
                       gsize size);

### gst_buffer_copy ()

    GstBuffer *
    gst_buffer_copy (const GstBuffer *buf);

### gst_buffer_copy_into ()

    gboolean
    gst_buffer_copy_into (GstBuffer *dest,
                          GstBuffer *src,
                          GstBufferCopyFlags flags,
                          gsize offset,
                          gsize size);

### gst_buffer_copy_region ()

    GstBuffer *
    gst_buffer_copy_region (GstBuffer *parent,
                            GstBufferCopyFlags flags,
                            gsize offset,
                            gsize size);

### gst_buffer_copy_deep ()

    GstBuffer *
    gst_buffer_copy_deep (const GstBuffer *buf);

### gst_buffer_is_writable()

    #define         gst_buffer_is_writable(buf)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (buf))

### gst_buffer_make_writable()

    #define         gst_buffer_make_writable(buf)   GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)))

### gst_buffer_replace ()

    gboolean
    gst_buffer_replace (GstBuffer **obuf,
                        GstBuffer *nbuf);

### gst_buffer_append ()

    GstBuffer *
    gst_buffer_append (GstBuffer *buf1,
                       GstBuffer *buf2);

### gst_buffer_append_region ()

    GstBuffer *
    gst_buffer_append_region (GstBuffer *buf1,
                              GstBuffer *buf2,
                              gssize offset,
                              gssize size);

### gst_buffer_get_meta ()

    GstMeta *
    gst_buffer_get_meta (GstBuffer *buffer,
                         GType api);

### gst_buffer_add_meta ()

    GstMeta *
    gst_buffer_add_meta (GstBuffer *buffer,
                         const GstMetaInfo *info,
                         gpointer params);

### gst_buffer_remove_meta ()

    gboolean
    gst_buffer_remove_meta (GstBuffer *buffer,
                            GstMeta *meta);

### gst_buffer_iterate_meta ()

    GstMeta *
    gst_buffer_iterate_meta (GstBuffer *buffer,
                             gpointer *state);

### GstBufferForeachMetaFunc ()

    gboolean
    (*GstBufferForeachMetaFunc) (GstBuffer *buffer,
                                 GstMeta **meta,
                                 gpointer user_data);

### gst_buffer_foreach_meta ()

    gboolean
    gst_buffer_foreach_meta (GstBuffer *buffer,
                             GstBufferForeachMetaFunc func,
                             gpointer user_data);

### gst_buffer_add_parent_buffer_meta ()

    GstParentBufferMeta *
    gst_buffer_add_parent_buffer_meta (GstBuffer *buffer,
                                       GstBuffer *ref);

### gst_buffer_get_parent_buffer_meta()

    #define             gst_buffer_get_parent_buffer_meta(b)

## Types and Values

### struct GstBuffer

    struct GstBuffer {
      GstMiniObject          mini_object;

      GstBufferPool         *pool;

      /* timestamp */
      GstClockTime           pts;
      GstClockTime           dts;
      GstClockTime           duration;

      /* media specific offset */
      guint64                offset;
      guint64                offset_end;
    };

### enum GstBufferFlags

#### Members

GST_BUFFER_FLAG_LIVE |  |
GST_BUFFER_FLAG_DECODE_ONLY |  |
GST_BUFFER_FLAG_DISCONT |  |
GST_BUFFER_FLAG_RESYNC |  |
GST_BUFFER_FLAG_CORRUPTED |  |
GST_BUFFER_FLAG_MARKER |  |
GST_BUFFER_FLAG_HEADER |  |
GST_BUFFER_FLAG_GAP |  |
GST_BUFFER_FLAG_DROPPABLE |  |
GST_BUFFER_FLAG_DELTA_UNIT |  |
GST_BUFFER_FLAG_TAG_MEMORY |  |
GST_BUFFER_FLAG_SYNC_AFTER |  |
GST_BUFFER_FLAG_LAST |  |

### GST_BUFFER_OFFSET_NONE

    #define GST_BUFFER_OFFSET_NONE  ((guint64)-1)

### enum GstBufferCopyFlags

#### Members

GST_BUFFER_COPY_NONE |  |
GST_BUFFER_COPY_FLAGS |  |
GST_BUFFER_COPY_TIMESTAMPS |  |
GST_BUFFER_COPY_META |  |
GST_BUFFER_COPY_MEMORY |  |
GST_BUFFER_COPY_MERGE |  |
GST_BUFFER_COPY_DEEP |  |

### GST_BUFFER_COPY_METADATA

    #define             GST_BUFFER_COPY_METADATA

### GST_BUFFER_COPY_ALL

    #define GST_BUFFER_COPY_ALL  ((GstBufferCopyFlags)(GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY))

### struct GstParentBufferMeta

    struct GstParentBufferMeta {
      GstMeta parent;

      GstBuffer *buffer;
    };