## GstBaseMetadata GstBaseMetadata — Base class for metadata handling elements |

## Synopsis

                        GstBaseMetadata;
    #define             GST_BASE_METADATA_SINK_PAD          (obj)
    #define             GST_BASE_METADATA_SRC_PAD           (obj)
    MetaOptions         gst_base_metadata_get_option_flag   (const GstBaseMetadata *base);
    void                gst_base_metadata_set_option_flag   (GstBaseMetadata *base,
                                                             const MetaOptions options);
    void                gst_base_metadata_unset_option_flag (GstBaseMetadata *base,
                                                             const MetaOptions options);
    void                gst_base_metadata_update_inject_segment_with_new_data
                                                            (GstBaseMetadata *base,
                                                             guint8 **data,
                                                             guint32 *size,
                                                             MetadataChunkType type);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseMetadata
                         +----GstMetadataDemux
                         +----GstMetadataMux

## Description

This is a generice base class for metadata handling elements. The following types of elements are supported:

- parsers (only parse data)

- demuxers (parse data and remove metadata chunks)

- muxers

- any other kind of element that wants to handle chunks in file formats based on chunks

This a abstract element that parses a stream and find chunks and offset where new chunks could be injected into it. Basically, the only thing need by implementors (parsers, (de)muxers) is to set virtual methods that will be used to setup the caps and do some 'processing', which is called after the stream is completely parsed and before the first buffer is sent to the next element. Usualy the 'processing' function will send tags messages and event in case of parsers and demuxers, and add chunks to be injected (using the helper function gst_base_metadata_update_inject_segment_with_new_data in case of muxers.

This can work in 'pull' and 'push' scheduling modes. In case of push mode, the stream will be parsed during sink activation if gst_pad_get_range is available on upstream element. If get_range function is not available upstream, then the data will be hold until the stream is completly parsed, and then after that the fisrt buffer will be pushed downstream. The same happens with pull mode, if the downstream element calls gst_pad_get_range it will only gets data after the stream has been completely parsed.

Seek, and query duration will only be available after the stream has been parsed. Query position will always be 0 (zero) before the stream is completely parsed.

Currently there is implementation for JPEG and PNG (demux mode only) stream types and EXIF, IPTC and XMP metadatas.

Last reviewed on 2008-01-21 (0.10.15)

## Details

### GstBaseMetadata

    typedef struct _GstBaseMetadata GstBaseMetadata;

The opaque GstBaseMetadata data structure.

### GST_BASE_METADATA_SINK_PAD()

    #define GST_BASE_METADATA_SINK_PAD(obj) (GST_BASE_METADATA_CAST (obj)->sinkpad)

`obj` : |

### GST_BASE_METADATA_SRC_PAD()

    #define GST_BASE_METADATA_SRC_PAD(obj) (GST_BASE_METADATA_CAST (obj)->srcpad)

`obj` : |

### gst_base_metadata_get_option_flag ()

    MetaOptions         gst_base_metadata_get_option_flag   (const GstBaseMetadata *base);

Check how the this base class will behaviour. As a demuxer or muxer. Hanlding EXIF, IPTC, XMP or not. `see_also`: gst_base_metadata_set_option_flag gst_base_metadata_unset_option_flag

`base` : | the base metadata instance
Returns : | The current mode of operation

### gst_base_metadata_set_option_flag ()

    void                gst_base_metadata_set_option_flag   (GstBaseMetadata *base,
                                                             const MetaOptions options);

Set how the this base class will behaviour. As a demuxer or muxer. Hanlding EXIF, IPTC, XMP or not. `see_also`: gst_base_metadata_unset_option_flag gst_base_metadata_get_option_flag

`base` : | the base metadata instance
`options` : | mode of operation

### gst_base_metadata_unset_option_flag ()

    void                gst_base_metadata_unset_option_flag (GstBaseMetadata *base,
                                                             const MetaOptions options);

Set how the this base class will behaviour. As a demuxer or muxer. Hanlding EXIF, IPTC, XMP or not. `see_also`: gst_base_metadata_set_option_flag gst_base_metadata_get_option_flag

`base` : | the base metadata instance
`options` : | mode of operation

### gst_base_metadata_update_inject_segment_with_new_data ()

    void                gst_base_metadata_update_inject_segment_with_new_data
                                                            (GstBaseMetadata *base,
                                                             guint8 **data,
                                                             guint32 *size,
                                                             MetadataChunkType type);

If the file type specification of the parsed stream allows a chunk of `type`, set the `data` and `size` of the segment to be injected. This the `data` has been injected (metadata type supported by the stream `type`) then, the the `data` ownership will be taken and `data` and `size` willl be set to 0; Hanlding EXIF, IPTC, XMP or not. `see_also`: gst_base_metadata_calculate_offsets

`base` : | the base metadata instance
`data` : | new data to be injected
`size` : | the size in bytes of `data`
`type` : | kind of metadata chunk it is (currently EXIF, IPTC or XMP)