## Parser

Parser — Parses the content of a DVD

## Synopsis

    #include <ogmdvd-parser.h>

    enum                OGMDvdParserStatus;
    OGMDvdParser *      ogmdvd_parser_new                   (OGMDvdTitle *title);
    void                ogmdvd_parser_ref                   (OGMDvdParser *parser);
    void                ogmdvd_parser_unref                 (OGMDvdParser *parser);
    gint                ogmdvd_parser_analyze               (OGMDvdParser *parser,
                                                             guchar *buffer);
    gint                ogmdvd_parser_get_max_frames        (OGMDvdParser *parser);
    void                ogmdvd_parser_set_max_frames        (OGMDvdParser *parser,
                                                             gint max_frames);
    gint                ogmdvd_parser_get_audio_bitrate     (OGMDvdParser *parser,
                                                             guint nr);

## Description

## Details

### enum OGMDvdParserStatus

    typedef enum {
      OGMDVD_PARSER_STATUS_NONE,
      OGMDVD_PARSER_STATUS_BITRATES,
      OGMDVD_PARSER_STATUS_MAX_FRAMES
    } OGMDvdParserStatus;

Status code returned by `ogmdvd_parser_analyze()`

`OGMDVD_PARSER_STATUS_NONE` | There is no information available yet
`OGMDVD_PARSER_STATUS_BITRATES` | The bitrates of all the audio tracks are available
`OGMDVD_PARSER_STATUS_MAX_FRAMES` | The maximum number of frames has been reached

### ogmdvd_parser_new ()

    OGMDvdParser *      ogmdvd_parser_new                   (OGMDvdTitle *title);

Creates a new OGMDvdParser.

`title` : | An OGMDvdTitle
Returns : | The new OGMDvdParser, or NULL

### ogmdvd_parser_ref ()

    void                ogmdvd_parser_ref                   (OGMDvdParser *parser);

Increments the reference count of an OGMDvdParser.

`parser` : | An OGMDvdParser

### ogmdvd_parser_unref ()

    void                ogmdvd_parser_unref                 (OGMDvdParser *parser);

Decrements the reference count of an OGMDvdParser.

`parser` : | An OGMDvdParser

### ogmdvd_parser_analyze ()

    gint                ogmdvd_parser_analyze               (OGMDvdParser *parser,
                                                             guchar *buffer);

Analyzes the block contained in `buffer`.

`parser` : | An OGMDvdParser
`buffer` : | A buffer containing a block to analyze
Returns : | the status of the analysis

### ogmdvd_parser_get_max_frames ()

    gint                ogmdvd_parser_get_max_frames        (OGMDvdParser *parser);

Returns the maximum number of frames to analyze.

`parser` : | An OGMDvdParser
Returns : | The number of frames, -1 if the whole title is to be analyzed, 0 on error

### ogmdvd_parser_set_max_frames ()

    void                ogmdvd_parser_set_max_frames        (OGMDvdParser *parser,
                                                             gint max_frames);

Sets the maximum number of frames to analyse. If `max_frames` is negative, all the frames of the title will be analyzed.

`parser` : | An OGMDvdParser
`max_frames` : | A number of frames

### ogmdvd_parser_get_audio_bitrate ()

    gint                ogmdvd_parser_get_audio_bitrate     (OGMDvdParser *parser,
                                                             guint nr);

Returns the bitrate of the audio stream at position nr, starting at 0.

`parser` : | An OGMDvdParser
`nr` : | The audio stream number
Returns : | The bitrate, or -1