## Files

Files — Structures to manipulate media files

## Synopsis

    #include <ogmrip-file.h>

                        OGMRipFile;
                        OGMRipVideoFile;
                        OGMRipAudioFile;
                        OGMRipSubpFile;
    enum                OGMRipFileType;
    enum                OGMRipFileError;
    #define             OGMRIP_FILE_ERROR
    void                ogmrip_file_ref                     (OGMRipFile *file);
    void                ogmrip_file_unref                   (OGMRipFile *file);
    gint                ogmrip_file_get_type                (OGMRipFile *file);
    gint                ogmrip_file_get_format              (OGMRipFile *file);
    gint64              ogmrip_file_get_size                (OGMRipFile *file);
    gchar *             ogmrip_file_get_filename            (OGMRipFile *file);
    void                ogmrip_file_set_language            (OGMRipFile *file,
                                                             gint lang);
    gint                ogmrip_file_get_language            (OGMRipFile *file);
    void                ogmrip_file_set_unlink_on_unref     (OGMRipFile *file,
                                                             gboolean do_unlink);
    gboolean            ogmrip_file_get_unlink_on_unref     (OGMRipFile *file);
    OGMRipFile *        ogmrip_video_file_new               (const gchar *filename,
                                                             GError **error);
    gint                ogmrip_video_file_get_bitrate       (OGMRipVideoFile *video);
    gdouble             ogmrip_video_file_get_length        (OGMRipVideoFile *video);
    void                ogmrip_video_file_get_size          (OGMRipVideoFile *video,
                                                             guint *width,
                                                             guint *height);
    gdouble             ogmrip_video_file_get_framerate     (OGMRipVideoFile *video);
    gdouble             ogmrip_video_file_get_aspect_ratio  (OGMRipVideoFile *video);
    OGMRipFile *        ogmrip_audio_file_new               (const gchar *filename,
                                                             GError **error);
    gint                ogmrip_audio_file_get_bitrate       (OGMRipAudioFile *audio);
    gdouble             ogmrip_audio_file_get_length        (OGMRipAudioFile *audio);
    gint                ogmrip_audio_file_get_sample_rate   (OGMRipAudioFile *audio);
    gint                ogmrip_audio_file_get_samples_per_frame
                                                            (OGMRipAudioFile *audio);
    gint                ogmrip_audio_file_get_channels      (OGMRipAudioFile *audio);
    OGMRipFile *        ogmrip_subp_file_new                (const gchar *filename,
                                                             GError **error);
    gint                ogmrip_subp_file_get_charset        (OGMRipSubpFile *subp);

## Description

## Details

### OGMRipFile

    typedef struct _OGMRipFile OGMRipFile;

### OGMRipVideoFile

    typedef struct _OGMRipVideoFile OGMRipVideoFile;

### OGMRipAudioFile

    typedef struct _OGMRipAudioFile OGMRipAudioFile;

### OGMRipSubpFile

    typedef struct _OGMRipSubpFile OGMRipSubpFile;

### enum OGMRipFileType

    typedef enum {
      OGMRIP_FILE_TYPE_VIDEO,
      OGMRIP_FILE_TYPE_AUDIO,
      OGMRIP_FILE_TYPE_SUBP
    } OGMRipFileType;

The stream type of the file.

`OGMRIP_FILE_TYPE_VIDEO` | The file contains a video stream
`OGMRIP_FILE_TYPE_AUDIO` | The file contains an audio stream
`OGMRIP_FILE_TYPE_SUBP` | The file contains a subtitle stream

### enum OGMRipFileError

    typedef enum {
      OGMRIP_FILE_ERROR_UNKNOWN,
      OGMRIP_FILE_ERROR_RANGE,
      OGMRIP_FILE_ERROR_BITRATE,
      OGMRIP_FILE_ERROR_RATE,
      OGMRIP_FILE_ERROR_LENGTH,
      OGMRIP_FILE_ERROR_FORMAT,
      OGMRIP_FILE_ERROR_WIDTH,
      OGMRIP_FILE_ERROR_HEIGHT,
      OGMRIP_FILE_ERROR_ASPECT,
      OGMRIP_FILE_ERROR_FPS
    } OGMRipFileError;

Error codes returned by OGMRipFile functions.

`OGMRIP_FILE_ERROR_UNKNOWN` | Unknown error
`OGMRIP_FILE_ERROR_RANGE` | Range error
`OGMRIP_FILE_ERROR_BITRATE` | Impossible to get bitrate
`OGMRIP_FILE_ERROR_RATE` | Impossible to get rate
`OGMRIP_FILE_ERROR_LENGTH` | Impossible to get length
`OGMRIP_FILE_ERROR_FORMAT` | Impossible to get format
`OGMRIP_FILE_ERROR_WIDTH` | Impossible to get width
`OGMRIP_FILE_ERROR_HEIGHT` | Impossible to get height
`OGMRIP_FILE_ERROR_ASPECT` | Impossible to get aspect
`OGMRIP_FILE_ERROR_FPS` | Impossible to get fps

### OGMRIP_FILE_ERROR

    #define OGMRIP_FILE_ERROR ogmrip_file_error_quark ()

Error domain for file operations. Errors in this domain will be from the OGMRipFileError enumeration. See GError for information on error domains.

### ogmrip_file_ref ()

    void                ogmrip_file_ref                     (OGMRipFile *file);

Increments the reference count of an OGMRipFile.

`file` : | an OGMRipFile

### ogmrip_file_unref ()

    void                ogmrip_file_unref                   (OGMRipFile *file);

Decrements the reference count of an OGMRipFile.

`file` : | an OGMRipFile

### ogmrip_file_get_type ()

    gint                ogmrip_file_get_type                (OGMRipFile *file);

Gets the type of a file.

`file` : | An OGMRipFile
Returns : | An OGMRipFileType, or -1

### ogmrip_file_get_format ()

    gint                ogmrip_file_get_format              (OGMRipFile *file);

Gets the format of a file.

`file` : | An OGMRipFile
Returns : | An OGMRipFormatType, or -1

### ogmrip_file_get_size ()

    gint64              ogmrip_file_get_size                (OGMRipFile *file);

Gets the size of a file in bytes.

`file` : | An OGMRipFile
Returns : | The file size, or -1

### ogmrip_file_get_filename ()

    gchar *             ogmrip_file_get_filename            (OGMRipFile *file);

Gets the filename of a file.

`file` : | An OGMRipFile
Returns : | The filename, or NULL

### ogmrip_file_set_language ()

    void                ogmrip_file_set_language            (OGMRipFile *file,
                                                             gint lang);

Sets the language of a file.

`file` : | An OGMRipFile
`lang` : | A language code

### ogmrip_file_get_language ()

    gint                ogmrip_file_get_language            (OGMRipFile *file);

Gets the language of a file.

`file` : | An OGMRipFile
Returns : | A language code, or -1

### ogmrip_file_set_unlink_on_unref ()

    void                ogmrip_file_set_unlink_on_unref     (OGMRipFile *file,
                                                             gboolean do_unlink);

Sets whether the file will be unlinked when `file` receives its final unref and is destroyed.

`file` : | An OGMRipFile
`do_unlink` : | Whether the file will be closed on the final unref of `file`

### ogmrip_file_get_unlink_on_unref ()

    gboolean            ogmrip_file_get_unlink_on_unref     (OGMRipFile *file);

Gets whether the file will be unlinked when `file` receives its final unref and is destroyed.

`file` : | An OGMRipFile
Returns : | Whether the channel will be closed on the final unref

### ogmrip_video_file_new ()

    OGMRipFile *        ogmrip_video_file_new               (const gchar *filename,
                                                             GError **error);

Creates a new OGMRipVideoFile from a video file.

`filename` : | A filename
`error` : | A location to return an error of type OGMRIP_FILE_ERROR
Returns : | The new OGMRipVideoFile

### ogmrip_video_file_get_bitrate ()

    gint                ogmrip_video_file_get_bitrate       (OGMRipVideoFile *video);

Gets the bitrate of a video file.

`video` : | An OGMRipVideoFile
Returns : | The bitrate, or -1

### ogmrip_video_file_get_length ()

    gdouble             ogmrip_video_file_get_length        (OGMRipVideoFile *video);

Gets the length in seconds of a video file.

`video` : | An OGMRipVideoFile
Returns : | The length, or -1.0

### ogmrip_video_file_get_size ()

    void                ogmrip_video_file_get_size          (OGMRipVideoFile *video,
                                                             guint *width,
                                                             guint *height);

Gets the dimension of a video file.

`video` : | An OGMRipVideoFile
`width` : | A pointer to store the width, or NULL
`height` : | A pointer to store the height, or NULL

### ogmrip_video_file_get_framerate ()

    gdouble             ogmrip_video_file_get_framerate     (OGMRipVideoFile *video);

Gets the framerate of a video file.

`video` : | An OGMRipVideoFile
Returns : | The framerate, or -1

### ogmrip_video_file_get_aspect_ratio ()

    gdouble             ogmrip_video_file_get_aspect_ratio  (OGMRipVideoFile *video);

Gets the aspect ratio of a video file.

`video` : | An OGMRipVideoFile
Returns : | The aspect ratio, or -1

### ogmrip_audio_file_new ()

    OGMRipFile *        ogmrip_audio_file_new               (const gchar *filename,
                                                             GError **error);

Creates a new OGMRipAudioFile from au audio file.

`filename` : | A filename
`error` : | A location to return an error of type OGMRIP_FILE_ERROR
Returns : | The new OGMRipAudioFile

### ogmrip_audio_file_get_bitrate ()

    gint                ogmrip_audio_file_get_bitrate       (OGMRipAudioFile *audio);

Gets the bitrate of an audio file.

`audio` : | An OGMRipAudioFile
Returns : | The bitrate, or -1

### ogmrip_audio_file_get_length ()

    gdouble             ogmrip_audio_file_get_length        (OGMRipAudioFile *audio);

Gets the length in seconds of an audio file.

`audio` : | An OGMRipAudioFile
Returns : | The length, or -1.0

### ogmrip_audio_file_get_sample_rate ()

    gint                ogmrip_audio_file_get_sample_rate   (OGMRipAudioFile *audio);

Gets the sample rate of an audio file.

`audio` : | An OGMRipAudioFile
Returns : | The sample rate, or -1

### ogmrip_audio_file_get_samples_per_frame ()

    gint                ogmrip_audio_file_get_samples_per_frame
                                                            (OGMRipAudioFile *audio);

Gets the number of samples per frame of an audio file.

`audio` : | An OGMRipAudioFile
Returns : | The number of samples per frame, or -1

### ogmrip_audio_file_get_channels ()

    gint                ogmrip_audio_file_get_channels      (OGMRipAudioFile *audio);

Gets the number of channels of an audio file.

`audio` : | An OGMRipAudioFile
Returns : | an OGMDvdAudioChannels, or -1

### ogmrip_subp_file_new ()

    OGMRipFile *        ogmrip_subp_file_new                (const gchar *filename,
                                                             GError **error);

Creates a new OGMRipSubpFile from a subtitle file.

`filename` : | A filename
`error` : | A location to return an error of type OGMRIP_FILE_ERROR
Returns : | The new OGMRipSubpFile

### ogmrip_subp_file_get_charset ()

    gint                ogmrip_subp_file_get_charset        (OGMRipSubpFile *subp);

Gets the character set of a subtitle file.

`subp` : | An OGMRipSubpFile
Returns : | The OGMRipCharset, or -1