gstreamer-0.12.1.2: Binding to the GStreamer open source multimedia framework.

Portability | portable (depends on GHC)
Stability | alpha
Maintainer | gtk2hs-devel@lists.sourceforge.net
Safe Haskell | None

Media.Streaming.GStreamer.Core.Caps

Contents

- Detail
- Types
- Caps Operations
- Caps Mutation

Description

A structure describing sets of media formats.

Synopsis

- data Caps
- capsNone :: Caps
- capsAny :: Caps
- capsSize :: Caps -> Word
- capsGetStructure :: Caps -> Word -> Maybe Structure
- capsIsEmpty :: Caps -> Bool
- capsIsFixed :: Caps -> Bool
- capsIsEqual :: Caps -> Caps -> Bool
- capsIsEqualFixed :: Caps -> Caps -> Bool
- capsIsAlwaysCompatible :: Caps -> Caps -> Bool
- capsIsSubset :: Caps -> Caps -> Bool
- capsIntersect :: Caps -> Caps -> Caps
- capsUnion :: Caps -> Caps -> Caps
- capsSubtract :: Caps -> Caps -> Caps
- capsNormalize :: Caps -> Caps
- capsFromString :: String -> Maybe Caps
- capsToString :: Caps -> String
- data CapsM a
- capsCreate :: CapsM a -> (Caps, a)
- capsModify :: Caps -> CapsM a -> (Caps, a)
- capsAppendStructure :: Structure -> CapsM ()
- capsMergeStructure :: Structure -> CapsM ()
- capsRemoveStructure :: Word -> CapsM ()
- capsTruncate :: CapsM ()

# Detail

`Caps` (short for capabilities) are lightweight objects describing media types. They are composed of arrays of `Structure`s.

`Caps` are exposed on `PadTemplate`s to describe all the possible types a given `Pad` can handle. They are also stored in the `Registry` along with the description of an `Element`.

`Caps` can be retrieved from an 'Element'\'s `Pad`s using the `padGetCaps` function. The returned `Caps` describes the possible types that the pad can handle or produce at runtime.

`Caps` are also attached to `Buffers` to describe the type of the contained data using the function `bufferSetCaps`. `Caps` attached to a buffer allow for format negotiation upstream and downstream.

`Caps` are fixed when they have no properties with ranges or lists. Use `capsIsFixed` to test for fixed caps. Only fixed caps may be set on a `Pad` or `Buffer`.

# Types

data Caps Source

Instances

Eq Caps |

capsNone :: Caps Source

A `Caps` that represents an undefined media type.

capsAny :: Caps Source

A `Caps` that represents all possible media types.

# Caps Operations

capsSize Source

Arguments

:: Caps | `caps` - a `Caps`
-> Word | the number of structures contained in the `Caps`

Get the number of structures contained in the `Caps`.

capsGetStructure Source

Arguments

:: Caps | `caps` - a `Caps`
-> Word | `index` - the index of the `Structure`
-> Maybe Structure | the `Structure` at the given index, or `Nothing` if `index` is invalid

Get the `Structure` at the given index.

capsIsEmpty Source

Arguments

:: Caps | `caps` - a `Caps`
-> Bool | `True` if `caps` is empty, otherwise `False`

Determine whether `caps` represents no media formats.

capsIsFixed Source

Arguments

:: Caps | `caps` - a `Caps`
-> Bool | `True` if `caps` is fixed, otherwise `False`

Determine whether the `caps` is fixed; that is, if it has exactly one structure, and each field in the structure describes a fixed type.

capsIsEqual Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Bool | `True` if both `Caps` represent the same set of capabilities.

Returns `True` if the caps represent the same set of capabilities.

This function does not work reliably if optional properties for `Caps` are included on one `Caps` but omitted on the other.

capsIsEqualFixed Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Bool | `True` if both `Caps` represent the same set of capabilities

Returns `True` if the caps are equal. The caps must both be fixed.

capsIsAlwaysCompatible Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Bool | `True` if `caps1` is a subset of `caps2`, otherwise `False`

Returns `True` if every media format in the first caps is also contained by the second. That is, the first is a subset of the second.

capsIsSubset Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Bool | `True` if `caps1` is a subset of `caps2`, otherwise `False`

Returns `True` if all caps represented by the first argument are also represented by the second.

This function does not work reliably if optional properties for caps are included on one caps and omitted on the other.

capsIntersect Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Caps | a new `Caps` containing all capabilities present in both `caps1` and `caps2`

Creates a new caps containing all the formats that are common to both of the caps.

capsUnion Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Caps | a new `Caps` containing all capabilities present in either `caps1` and `caps2`

Creates a new caps containing all the formats that are common to either of the caps. If either of the structures are equivalient to `capsAny`, the result will be `capsAny`.

capsSubtract Source

Arguments

:: Caps | `caps1` - the first `Caps`
-> Caps | `caps2` - the second `Caps`
-> Caps | a new `Caps` containing all capabilities present in `caps1` but not `caps2`

Creates a new caps containing all the formats that are in the first but not the second.

capsNormalize Source

Arguments

:: Caps | `caps` - a `Caps`
-> Caps | the new, normalized `Caps`

Creates a new caps that represents the same set of formats as the argument, but that contains no lists.

capsFromString Source

Arguments

:: String | `string` - the string representation of a `Caps`
-> Maybe Caps | the new `Caps`, or `Nothing` if `string` is invalid

Read a caps from a string.

capsToString Source

Arguments

:: Caps | `caps` - a `Caps`
-> String | the string representation of `Caps`

Converts the argument to a string representation. The string can be converted back to a caps using `capsFromString`.

# Caps Mutation

data CapsM a Source

A `Monad` for sequencing modifications to a `Caps`.

Instances

Monad CapsM |
Functor CapsM |

capsCreate Source

Arguments

:: CapsM a | `mutate` - the mutating action
-> (Caps, a) | the new `Caps` and the action's result

Create a caps and mutate it according to the given action.

capsModify Source

Arguments

:: Caps | `caps` - the `Caps` to modify
-> CapsM a | `mutate` - the mutating action
-> (Caps, a) | the new `Caps` and the action's result

Copy a caps and mutate it according to the given action.

capsAppendStructure Source

Arguments

:: Structure | `structure` - the `Structure` to append to the current `Caps`
-> CapsM () |

Append the given structure to the current caps.

capsMergeStructure Source

Arguments

:: Structure | `structure` - the `Structure` to merge with the current `Caps`
-> CapsM () |

Append the structure to the current caps, if it is not already expressed by the caps.

Since 0.10.10.

capsRemoveStructure Source

Arguments

:: Word | `idx` - the index of the `Structure` to remove
-> CapsM () |

Removes the structure at the given index from the current caps.

capsTruncate :: CapsM ()Source

Discard all but the first structure from the current caps.