## GtkMediaFile GtkMediaFile — Open media files for use in GTK |

## Functions

GtkMediaStream * | gtk_media_file_new ()
GtkMediaStream * | gtk_media_file_new_for_filename ()
GtkMediaStream * | gtk_media_file_new_for_resource ()
GtkMediaStream * | gtk_media_file_new_for_file ()
GtkMediaStream * | gtk_media_file_new_for_input_stream ()
void | gtk_media_file_clear ()
void | gtk_media_file_set_filename ()
void | gtk_media_file_set_resource ()
void | gtk_media_file_set_file ()
GFile * | gtk_media_file_get_file ()
void | gtk_media_file_set_input_stream ()
GInputStream * | gtk_media_file_get_input_stream ()

## Properties

GFile * | file | Read / Write
GInputStream * | input-stream | Read / Write

## Types and Values

| GtkMediaFile

## Object Hierarchy

        GObject
        ╰── GtkMediaStream
            ╰── GtkMediaFile

## Implemented Interfaces

GtkMediaFile implements GdkPaintable.

## Includes

    #include <gtk/gtk.h>

## Description

GtkMediaFile is the implementation for media file usage with GtkMediaStream.

This provides a simple way to play back video files with GTK.

GTK+ provides a GIO extension point for GtkMediaFile implementations to allow for external implementations using various media frameworks. GTK+ itself includes implementations using GStreamer and ffmpeg.

## Functions

### gtk_media_file_new ()

    GtkMediaStream *
    gtk_media_file_new (void);

Creates a new empty media file.

#### Returns

a new GtkMediaFile.

[type Gtk.MediaFile]

### gtk_media_file_new_for_filename ()

    GtkMediaStream *
    gtk_media_file_new_for_filename (const char *filename);

This is a utility function that converts the given `filename` to a GFile and calls `gtk_media_file_new_for_file()`.

#### Parameters

filename | filename to open |

#### Returns

a new GtkMediaFile playing `filename` .

[type Gtk.MediaFile]

### gtk_media_file_new_for_resource ()

    GtkMediaStream *
    gtk_media_file_new_for_resource (const char *resource_path);

This is a utility function that converts the given `resource` to a GFile and calls `gtk_media_file_new_for_file()`.

#### Parameters

resource_path | resource path to open |

#### Returns

a new GtkMediaFile playing `resource_path` .

[type Gtk.MediaFile]

### gtk_media_file_new_for_file ()

    GtkMediaStream *
    gtk_media_file_new_for_file (GFile *file);

Creates a new media file to play `file` .

#### Parameters

file | The file to play |

#### Returns

a new GtkMediaFile playing `file` .

[type Gtk.MediaFile]

### gtk_media_file_new_for_input_stream ()

    GtkMediaStream *
    gtk_media_file_new_for_input_stream (GInputStream *stream);

Creates a new media file to play `stream` . If you want the resulting media to be seekable, the stream should implement the GSeekable interface.

#### Parameters

stream | The stream to play |

#### Returns

a new GtkMediaFile.

[type Gtk.MediaFile]

### gtk_media_file_clear ()

    void
    gtk_media_file_clear (GtkMediaFile *self);

Resets the media file to be empty.

#### Parameters

self | a GtkMediaFile |

### gtk_media_file_set_filename ()

    void
    gtk_media_file_set_filename (GtkMediaFile *self,
                                 const char *filename);

This is a utility function that converts the given `filename` to a GFile and calls `gtk_media_file_set_file()`.

#### Parameters

self | a GtkMediaFile |
filename | name of file to play. | [allow-none]

### gtk_media_file_set_resource ()

    void
    gtk_media_file_set_resource (GtkMediaFile *self,
                                 const char *resource_path);

This is a utility function that converts the given `resource_path` to a GFile and calls `gtk_media_file_set_file()`.

#### Parameters

self | a GtkMediaFile |
resource_path | path to resource to play. | [allow-none]

### gtk_media_file_set_file ()

    void
    gtk_media_file_set_file (GtkMediaFile *self,
                             GFile *file);

If any file is still playing, stop playing it.

Then start playing the given `file` .

#### Parameters

self | a GtkMediaFile |
file | the file to play. | [allow-none]

### gtk_media_file_get_file ()

    GFile *
    gtk_media_file_get_file (GtkMediaFile *self);

Returns the file that `self` is currently playing from.

When `self` is not playing or not playing from a file, `NULL` is returned.

#### Parameters

self | a GtkMediaFile |

#### Returns

The currently playing file or `NULL` if not playing from a file.

[nullable][transfer none]

### gtk_media_file_set_input_stream ()

    void
    gtk_media_file_set_input_stream (GtkMediaFile *self,
                                     GInputStream *stream);

If anything is still playing, stop playing it. Then start playing the given `stream` .

Full control about the `stream` is assumed for the duration of playback. The stream will not bt be closed.

#### Parameters

self | a GtkMediaFile |
stream | the stream to play from. | [allow-none]

### gtk_media_file_get_input_stream ()

    GInputStream *
    gtk_media_file_get_input_stream (GtkMediaFile *self);

Returns the stream that `self` is currently playing from.

When `self` is not playing or not playing from a stream, `NULL` is returned.

#### Parameters

self | a GtkMediaFile |

#### Returns

The currently playing stream or `NULL` if not playing from a stream.

[nullable][transfer none]

## Types and Values

### GtkMediaFile

    typedef struct _GtkMediaFile GtkMediaFile;

## Property Details

### The `“file”` property

      “file”                     GFile *

The file being played back or `NULL` if not playing a file.

Owner: GtkMediaFile

Flags: Read / Write

### The `“input-stream”` property

      “input-stream”             GInputStream *

The stream being played back or `NULL` if not playing a stream, like when playing a file.

Owner: GtkMediaFile

Flags: Read / Write

## See Also

GtkMediaStream, GtkVideo