GstSample

## GstSample GstSample — A media sample |

## Synopsis

    #include <gst/gst.h>

                        GstSample;
    GstBuffer *         gst_sample_get_buffer               (GstSample *sample);
    GstCaps *           gst_sample_get_caps                 (GstSample *sample);
    const GstStructure * gst_sample_get_info                (GstSample *sample);
    GstSegment *        gst_sample_get_segment              (GstSample *sample);
    GstSample *         gst_sample_new                      (GstBuffer *buffer,
                                                             GstCaps *caps,
                                                             const GstSegment *segment,
                                                             GstStructure *info);
    GstSample *         gst_sample_ref                      (GstSample *sample);
    void                gst_sample_unref                    (GstSample *sample);

## Description

A GstSample is a small object containing data, a type, timing and extra arbitrary information.

Last reviewed on 2012-03-29 (0.11.3)

## Details

### GstSample

    typedef struct _GstSample GstSample;

The opaque structure of a GstSample. A sample contains a typed memory block and the associated timing information. It is mainly used to exchange buffers with an application.

### gst_sample_get_buffer ()

    GstBuffer *         gst_sample_get_buffer               (GstSample *sample);

Get the buffer associated with `sample`

`sample` : | a GstSample
Returns : | the buffer of `sample` or NULL when there is no buffer. The buffer remains valid as long as `sample` is valid. [transfer none]

### gst_sample_get_caps ()

    GstCaps *           gst_sample_get_caps                 (GstSample *sample);

Get the caps associated with `sample`

`sample` : | a GstSample
Returns : | the caps of `sample` or NULL when there is no caps. The caps remain valid as long as `sample` is valid. [transfer none]

### gst_sample_get_info ()

    const GstStructure * gst_sample_get_info                (GstSample *sample);

Get extra information associated with `sample`.

`sample` : | a GstSample
Returns : | the extra info of `sample`. The info remains valid as long as `sample` is valid. [transfer none]

### gst_sample_get_segment ()

    GstSegment *        gst_sample_get_segment              (GstSample *sample);

Get the segment associated with `sample`

`sample` : | a GstSample
Returns : | the segment of `sample`. The segment remains valid as long as `sample` is valid. [transfer none]

### gst_sample_new ()

    GstSample *         gst_sample_new                      (GstBuffer *buffer,
                                                             GstCaps *caps,
                                                             const GstSegment *segment,
                                                             GstStructure *info);

Create a new GstSample with the provided details.

Free-function: gst_sample_unref

`buffer` : | a GstBuffer, or NULL. [transfer none][allow-none]
`caps` : | a GstCaps, or NULL. [transfer none][allow-none]
`segment` : | transfer none) (allow-none): a GstSegment, or NULL
`info` : | a GstStructure, or NULL. [transfer full][allow-none]
Returns : | the new GstSample. `gst_sample_unref()` after usage. [transfer full]

### gst_sample_ref ()

    GstSample *         gst_sample_ref                      (GstSample *sample);

Increases the refcount of the given sample by one.

`sample` : | a GstSample
Returns : | `sample`. [transfer full]

### gst_sample_unref ()

    void                gst_sample_unref                    (GstSample *sample);

Decreases the refcount of the sample. If the refcount reaches 0, the sample will be freed.

`sample` : | a GstSample. [transfer full]

## See Also

GstBuffer, GstCaps, GstSegment