Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
MediaFile
is the implementation for media file usage with MediaStream
.
This provides a simple way to play back video files with GTK.
GTK provides a GIO extension point for MediaFile
implementations
to allow for external implementations using various media frameworks.
GTK itself includes implementations using GStreamer and ffmpeg.
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) => Text -> 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 Text -> 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
Memory-managed wrapper type.
Instances
Eq MediaFile Source # | |
GObject MediaFile Source # | |
Defined in GI.Gtk.Objects.MediaFile | |
ManagedPtrNewtype MediaFile Source # | |
Defined in GI.Gtk.Objects.MediaFile toManagedPtr :: MediaFile -> ManagedPtr MediaFile | |
TypedObject MediaFile Source # | |
Defined in GI.Gtk.Objects.MediaFile | |
HasParentTypes MediaFile Source # | |
Defined in GI.Gtk.Objects.MediaFile | |
IsGValue (Maybe MediaFile) Source # | Convert |
Defined in GI.Gtk.Objects.MediaFile gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe MediaFile -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe MediaFile) | |
type ParentTypes MediaFile Source # | |
Defined in GI.Gtk.Objects.MediaFile |
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
(GObject o, IsDescendantOf MediaFile o) => IsMediaFile o Source # | |
Defined in GI.Gtk.Objects.MediaFile |
toMediaFile :: (MonadIO m, IsMediaFile o) => o -> m MediaFile Source #
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clear, computeConcreteSize, ended, forceFloating, freezeNotify, gerror, getv, hasAudio, hasVideo, invalidateContents, invalidateSize, isFloating, isPrepared, isSeekable, isSeeking, notify, notifyByPspec, pause, play, prepared, realize, ref, refSink, runDispose, seek, seekFailed, seekSuccess, snapshot, stealData, stealQdata, thawNotify, unprepared, 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
:: (HasCallStack, MonadIO m, IsMediaFile a) | |
=> a |
|
-> m () |
Resets the media file to be empty.
getFile
:: (HasCallStack, MonadIO m, IsMediaFile a) | |
=> a |
|
-> m (Maybe File) | Returns: The currently playing file or |
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 #
:: (HasCallStack, MonadIO m, IsMediaFile a) | |
=> a |
|
-> m (Maybe InputStream) | Returns: The currently playing stream or |
Returns the stream that self
is currently playing from.
When self
is not playing or not playing from a stream,
Nothing
is returned.
new
:: (HasCallStack, MonadIO m) | |
=> m MediaFile | Returns: a new |
Creates a new empty media file.
newForFile
:: (HasCallStack, MonadIO m, IsFile a) | |
=> a |
|
-> m MediaFile | Returns: a new |
Creates a new media file to play file
.
newForFilename
mediaFileNewForFilename Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m MediaFile | Returns: a new |
This is a utility function that converts the given filename
to a File
and calls mediaFileNewForFile
.
newForInputStream
mediaFileNewForInputStream Source #
:: (HasCallStack, MonadIO m, IsInputStream a) | |
=> a |
|
-> m MediaFile | Returns: a new |
Creates a new media file to play stream
. If you want the
resulting media to be seekable, the stream should implement
the Seekable
interface.
newForResource
mediaFileNewForResource Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m MediaFile | Returns: a new |
This is a utility function that converts the given resource
to a File
and calls mediaFileNewForFile
.
setFile
:: (HasCallStack, MonadIO m, IsMediaFile a, IsFile b) | |
=> a |
|
-> Maybe b |
|
-> m () |
If any file is still playing, stop playing it.
Then start playing the given file
.
setFilename
:: (HasCallStack, MonadIO m, IsMediaFile a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
This is a utility function that converts the given filename
to a File
and calls mediaFileSetFile
.
setInputStream
mediaFileSetInputStream Source #
:: (HasCallStack, MonadIO m, IsMediaFile a, IsInputStream b) | |
=> a |
|
-> Maybe b |
|
-> m () |
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.
setResource
:: (HasCallStack, MonadIO m, IsMediaFile a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
This is a utility function that converts the given resourcePath
to a File
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, like 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 ]