## Files Files — Structures to manipulate media files |

## Functions

void | ogmrip_file_ref ()
void | ogmrip_file_unref ()
gint | ogmrip_file_get_type ()
gint | ogmrip_file_get_format ()
gint64 | ogmrip_file_get_size ()
gchar * | ogmrip_file_get_filename ()
void | ogmrip_file_set_language ()
gint | ogmrip_file_get_language ()
void | ogmrip_file_set_unlink_on_unref ()
gboolean | ogmrip_file_get_unlink_on_unref ()
OGMRipFile * | ogmrip_video_file_new ()
gint | ogmrip_video_file_get_bitrate ()
gdouble | ogmrip_video_file_get_length ()
void | ogmrip_video_file_get_size ()
gdouble | ogmrip_video_file_get_framerate ()
gdouble | ogmrip_video_file_get_aspect_ratio ()
OGMRipFile * | ogmrip_audio_file_new ()
gint | ogmrip_audio_file_get_bitrate ()
gdouble | ogmrip_audio_file_get_length ()
gint | ogmrip_audio_file_get_sample_rate ()
gint | ogmrip_audio_file_get_samples_per_frame ()
gint | ogmrip_audio_file_get_channels ()
OGMRipFile * | ogmrip_subp_file_new ()
gint | ogmrip_subp_file_get_charset ()

## Types and Values

| OGMRipFile
| OGMRipVideoFile
| OGMRipAudioFile
| OGMRipSubpFile
enum | OGMRipFileType
enum | OGMRipFileError
#define | OGMRIP_FILE_ERROR

## Includes

    #include <ogmrip-file.h>

## Description

## Functions

### ogmrip_file_ref ()

    void
    ogmrip_file_ref (OGMRipFile *file);

Increments the reference count of an OGMRipFile.

#### Parameters

file | an OGMRipFile |

### ogmrip_file_unref ()

    void
    ogmrip_file_unref (OGMRipFile *file);

Decrements the reference count of an OGMRipFile.

#### Parameters

file | an OGMRipFile |

### ogmrip_file_get_type ()

    gint
    ogmrip_file_get_type (OGMRipFile *file);

Gets the type of a file.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

file | An OGMRipFile |
lang | A language code |

### ogmrip_file_get_language ()

    gint
    ogmrip_file_get_language (OGMRipFile *file);

Gets the language of a file.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

subp | An OGMRipSubpFile |

#### Returns

The OGMRipCharset, or -1

## Types and Values

### OGMRipFile

    typedef struct _OGMRipFile OGMRipFile;

### OGMRipVideoFile

    typedef struct _OGMRipVideoFile OGMRipVideoFile;

### OGMRipAudioFile

    typedef struct _OGMRipAudioFile OGMRipAudioFile;

### OGMRipSubpFile

    typedef struct _OGMRipSubpFile OGMRipSubpFile;

### enum OGMRipFileType

The stream type of the file.

#### Members

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

Error codes returned by OGMRipFile functions.

#### Members

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.