gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.MediaFile

Contents

- Exported types
- Methods
  - clear
  - getFile
  - getInputStream
  - new
  - newForFile
  - newForFilename
  - newForInputStream
  - newForResource
  - setFile
  - setFilename
  - setInputStream
  - setResource
- Properties
  - file
  - inputStream

Description

Implements the `GtkMediaStream` interface for files.

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 an implementation using GStreamer.

Synopsis

- newtype MediaFile = MediaFile (ManagedPtr MediaFile)
- class (GObject o, IsDescendantOf MediaFile o) => IsMediaFile o
- toMediaFile :: (MonadIO m, IsMediaFile o) => o -> m MediaFile
- mediaFileClear :: (HasCallStack, MonadIO m, IsMediaFile a) => a -> m ()
- mediaFileGetFile :: (HasCallStack, MonadIO m, IsMediaFile a) => a -> m (Maybe File)
- mediaFileGetInputStream :: (HasCallStack, MonadIO m, IsMediaFile a) => a -> m (Maybe InputStream)
- mediaFileNew :: (HasCallStack, MonadIO m) => m MediaFile
- mediaFileNewForFile :: (HasCallStack, MonadIO m, IsFile a) => a -> m MediaFile
- mediaFileNewForFilename :: (HasCallStack, MonadIO m) => [Char] -> m MediaFile
- mediaFileNewForInputStream :: (HasCallStack, MonadIO m, IsInputStream a) => a -> m MediaFile
- mediaFileNewForResource :: (HasCallStack, MonadIO m) => Text -> m MediaFile
- mediaFileSetFile :: (HasCallStack, MonadIO m, IsMediaFile a, IsFile b) => a -> Maybe b -> m ()
- mediaFileSetFilename :: (HasCallStack, MonadIO m, IsMediaFile a) => a -> Maybe [Char] -> m ()
- mediaFileSetInputStream :: (HasCallStack, MonadIO m, IsMediaFile a, IsInputStream b) => a -> Maybe b -> m ()
- mediaFileSetResource :: (HasCallStack, MonadIO m, IsMediaFile a) => a -> Maybe Text -> m ()
- clearMediaFileFile :: (MonadIO m, IsMediaFile o) => o -> m ()
- constructMediaFileFile :: (IsMediaFile o, MonadIO m, IsFile a) => a -> m (GValueConstruct o)
- getMediaFileFile :: (MonadIO m, IsMediaFile o) => o -> m (Maybe File)
- setMediaFileFile :: (MonadIO m, IsMediaFile o, IsFile a) => o -> a -> m ()
- clearMediaFileInputStream :: (MonadIO m, IsMediaFile o) => o -> m ()
- constructMediaFileInputStream :: (IsMediaFile o, MonadIO m, IsInputStream a) => a -> m (GValueConstruct o)
- getMediaFileInputStream :: (MonadIO m, IsMediaFile o) => o -> m (Maybe InputStream)
- setMediaFileInputStream :: (MonadIO m, IsMediaFile o, IsInputStream a) => o -> a -> m ()

# Exported types

newtype MediaFile Source #

Memory-managed wrapper type.

Constructors

MediaFile (ManagedPtr MediaFile) |

#### Instances

Instances details

Eq MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile Methods (==) :: MediaFile -> MediaFile -> Bool Source # (/=) :: MediaFile -> MediaFile -> Bool Source #
GObject MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile
ManagedPtrNewtype MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile Methods toManagedPtr :: MediaFile -> ManagedPtr MediaFile Source #
TypedObject MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile Methods glibType :: IO GType Source #
HasParentTypes MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile
IsGValue (Maybe MediaFile) Source # | Convert `MediaFile` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.MediaFile Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe MediaFile -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe MediaFile) Source #
type ParentTypes MediaFile Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile type ParentTypes MediaFile = '[MediaStream, Object, Paintable]

class (GObject o, IsDescendantOf MediaFile o) => IsMediaFile o Source #

Type class for types which can be safely cast to `MediaFile`, for instance with `toMediaFile`.

#### Instances

Instances details

(GObject o, IsDescendantOf MediaFile o) => IsMediaFile o Source # |
Instance details Defined in GI.Gtk.Objects.MediaFile

toMediaFile :: (MonadIO m, IsMediaFile o) => o -> m MediaFile Source #

Cast to `MediaFile`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, clear, computeConcreteSize, forceFloating, freezeNotify, gerror, getv, hasAudio, hasVideo, invalidateContents, invalidateSize, isFloating, isPrepared, isSeekable, isSeeking, notify, notifyByPspec, pause, play, realize, ref, refSink, runDispose, seek, seekFailed, seekSuccess, snapshot, stealData, stealQdata, streamEnded, streamPrepared, streamUnprepared, thawNotify, unrealize, unref, update, watchClosure.

#### Getters

getCurrentImage, getData, getDuration, getEnded, getError, getFile, getFlags, getInputStream, getIntrinsicAspectRatio, getIntrinsicHeight, getIntrinsicWidth, getLoop, getMuted, getPlaying, getProperty, getQdata, getTimestamp, getVolume.

#### Setters

setData, setDataFull, setFile, setFilename, setInputStream, setLoop, setMuted, setPlaying, setProperty, setResource, setVolume.

## clear

mediaFileClear Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a) |
=> a | `self`: a `GtkMediaFile`
-> m () |

Resets the media file to be empty.

## getFile

mediaFileGetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a) |
=> a | `self`: a `GtkMediaFile`
-> m (Maybe File) | Returns: The currently playing file

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

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

## getInputStream

mediaFileGetInputStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a) |
=> a | `self`: a `GtkMediaFile`
-> m (Maybe InputStream) | Returns: The currently playing stream

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

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

## new

mediaFileNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m MediaFile | Returns: a new `GtkMediaFile`

Creates a new empty media file.

## newForFile

mediaFileNewForFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) |
=> a | `file`: The file to play
-> m MediaFile | Returns: a new `GtkMediaFile` playing `file`

Creates a new media file to play `file`.

## newForFilename

mediaFileNewForFilename Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [Char] | `filename`: filename to open
-> m MediaFile | Returns: a new `GtkMediaFile` playing `filename`

Creates a new media file for the given filename.

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

## newForInputStream

mediaFileNewForInputStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputStream a) |
=> a | `stream`: The stream to play
-> m MediaFile | Returns: a new `GtkMediaFile`

Creates a new media file to play `stream`.

If you want the resulting media to be seekable, the stream should implement the `GSeekable` interface.

## newForResource

mediaFileNewForResource Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `resourcePath`: resource path to open
-> m MediaFile | Returns: a new `GtkMediaFile` playing `resourcePath`

Creates a new new media file for the given resource.

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

## setFile

mediaFileSetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a, IsFile b) |
=> a | `self`: a `GtkMediaFile`
-> Maybe b | `file`: the file to play
-> m () |

Sets the `GtkMediaFile` to play the given file.

If any file is still playing, stop playing it.

## setFilename

mediaFileSetFilename Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a) |
=> a | `self`: a `GtkMediaFile`
-> Maybe [Char] | `filename`: name of file to play
-> m () |

Sets the `GtkMediaFile` to play the given file.

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

## setInputStream

mediaFileSetInputStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a, IsInputStream b) |
=> a | `self`: a `GtkMediaFile`
-> Maybe b | `stream`: the stream to play from
-> m () |

Sets the `GtkMediaFile` to play the given stream.

If anything is still playing, stop playing it.

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

## setResource

mediaFileSetResource Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaFile a) |
=> a | `self`: a `GtkMediaFile`
-> Maybe Text | `resourcePath`: path to resource to play
-> m () |

Sets the `GtkMediaFile` to play the given resource.

This is a utility function that converts the given `resourcePath` to a `GFile` and calls `mediaFileSetFile`.

# Properties

## file

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

clearMediaFileFile :: (MonadIO m, IsMediaFile o) => o -> m () Source #

Set the value of the “`file`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #file

constructMediaFileFile :: (IsMediaFile o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`file`” property. This is rarely needed directly, but it is used by `new`.

getMediaFileFile :: (MonadIO m, IsMediaFile o) => o -> m (Maybe File) Source #

Get the value of the “`file`” property. When overloading is enabled, this is equivalent to

    get mediaFile #file

setMediaFileFile :: (MonadIO m, IsMediaFile o, IsFile a) => o -> a -> m () Source #

Set the value of the “`file`” property. When overloading is enabled, this is equivalent to

    set mediaFile [ #file := value ]

## inputStream

The stream being played back or `Nothing` if not playing a stream.

This is `Nothing` when playing a file.

clearMediaFileInputStream :: (MonadIO m, IsMediaFile o) => o -> m () Source #

Set the value of the “`input-stream`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #inputStream

constructMediaFileInputStream :: (IsMediaFile o, MonadIO m, IsInputStream a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`input-stream`” property. This is rarely needed directly, but it is used by `new`.

getMediaFileInputStream :: (MonadIO m, IsMediaFile o) => o -> m (Maybe InputStream) Source #

Get the value of the “`input-stream`” property. When overloading is enabled, this is equivalent to

    get mediaFile #inputStream

setMediaFileInputStream :: (MonadIO m, IsMediaFile o, IsInputStream a) => o -> a -> m () Source #

Set the value of the “`input-stream`” property. When overloading is enabled, this is equivalent to

    set mediaFile [ #inputStream := value ]