Maintainer | gtk2hs-devel@lists.sourceforge.net |
---|---|
Stability | alpha |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
Data-passing buffer type, supporting sub-buffers.
- data Buffer
- class MiniObjectClass o => BufferClass o
- castToBuffer :: MiniObjectClass obj => obj -> Buffer
- gTypeBuffer :: GType
- data BufferFlags
- bufferOffsetNone :: BufferOffset
- bufferGetFlags :: BufferClass bufferT => bufferT -> [BufferFlags]
- bufferGetFlagsM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m [BufferFlags]
- bufferSetFlagsM :: (BufferClass bufferT, MonadIO m) => [BufferFlags] -> MiniObjectT bufferT m ()
- bufferUnsetFlagsM :: (BufferClass bufferT, MonadIO m) => [BufferFlags] -> MiniObjectT bufferT m ()
- bufferGetSize :: BufferClass bufferT => bufferT -> Word
- bufferGetSizeM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m Word
- bufferGetData :: BufferClass bufferT => bufferT -> ByteString
- bufferGetDataM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m ByteString
- bufferSetDataM :: (BufferClass bufferT, MonadIO m) => ByteString -> MiniObjectT bufferT m ()
- unsafeBufferGetPtrM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Ptr Word8)
- bufferGetTimestamp :: BufferClass bufferT => bufferT -> Maybe ClockTime
- bufferGetTimestampM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Maybe ClockTime)
- bufferSetTimestampM :: (BufferClass bufferT, MonadIO m) => Maybe ClockTime -> MiniObjectT bufferT m ()
- bufferGetDuration :: BufferClass bufferT => bufferT -> Maybe ClockTime
- bufferGetDurationM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Maybe ClockTime)
- bufferSetDurationM :: (BufferClass bufferT, MonadIO m) => Maybe ClockTime -> MiniObjectT bufferT m ()
- bufferGetCaps :: BufferClass bufferT => bufferT -> Maybe Caps
- bufferGetCapsM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Maybe Caps)
- bufferSetCapsM :: (BufferClass bufferT, MonadIO m) => Maybe Caps -> MiniObjectT bufferT m ()
- bufferGetOffset :: BufferClass bufferT => bufferT -> Maybe Word64
- bufferGetOffsetM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Maybe Word64)
- bufferSetOffsetM :: (BufferClass bufferT, MonadIO m) => Maybe Word64 -> MiniObjectT bufferT m ()
- bufferGetOffsetEnd :: BufferClass bufferT => bufferT -> Maybe Word64
- bufferGetOffsetEndM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m (Maybe Word64)
- bufferSetOffsetEndM :: (BufferClass bufferT, MonadIO m) => Maybe Word64 -> MiniObjectT bufferT m ()
- bufferIsDiscont :: BufferClass bufferT => bufferT -> Bool
- bufferIsDiscontM :: (BufferClass bufferT, MonadIO m) => MiniObjectT bufferT m Bool
- bufferCreateEmpty :: MonadIO m => MiniObjectT Buffer m a -> m (Buffer, a)
- bufferCreate :: MonadIO m => Word -> MiniObjectT Buffer m a -> m (Buffer, a)
- bufferCreateSub :: BufferClass bufferT => bufferT -> Word -> Word -> Maybe Buffer
- bufferIsSpanFast :: (BufferClass bufferT1, BufferClass bufferT2) => bufferT1 -> bufferT2 -> Bool
- bufferSpan :: (BufferClass bufferT1, BufferClass bufferT2) => bufferT1 -> Word32 -> bufferT2 -> Word32 -> Maybe Buffer
- bufferMerge :: (BufferClass bufferT1, BufferClass bufferT2) => bufferT1 -> bufferT2 -> Buffer
Types
Buffer
s are the basic unit of data transfer in GStreamer. The
Buffer
type provides all the state necessary to define a
region of memory as part of a stream. Sub-buffers are also
supported, allowing a smaller region of a Buffer
to become its
own Buffer
, with mechansims in place to ensure that neither
memory space goes away prematurely.
class MiniObjectClass o => BufferClass o Source #
castToBuffer :: MiniObjectClass obj => obj -> Buffer Source #
gTypeBuffer :: GType Source #
data BufferFlags Source #
The flags a Buffer
may have.
BufferPreroll | the buffer is part of a preroll and should not be displayed |
BufferDiscont | the buffer marks a discontinuity in the stream |
BufferInCaps | the buffer has been added as a field in a |
BufferGap | the buffer has been created to fill a gap in the stream |
BufferDeltaUnit | the buffer cannot be decoded independently |
Buffer Operations
bufferOffsetNone :: BufferOffset Source #
The undefined BufferOffset
value.
:: BufferClass bufferT | |
=> bufferT |
|
-> [BufferFlags] | the flags set on |
Get the flags set on buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m [BufferFlags] | the flags set on the current |
Get the flags set on the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> [BufferFlags] |
|
-> MiniObjectT bufferT m () |
Set flags on the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> [BufferFlags] |
|
-> MiniObjectT bufferT m () |
Unset flags on the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Word | the size of |
Get buffer
's size in bytes.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m Word | the size of the current |
Get the size of the current Buffer
in bytes.
:: BufferClass bufferT | |
=> bufferT |
|
-> ByteString | the data stored in |
Make an O(n) copy of the data stored in buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m ByteString | the data stored in the current |
Make an O(n) copy of the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> ByteString |
|
-> MiniObjectT bufferT m () |
Store an O(n) copy of the provided data in the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Ptr Word8) | a pointer to the data stored in the current |
Get a raw pointer to the internal data area for the current
buffer. The pointer may be used to write into the data area if
desired. This function is unsafe in that the pointer should not
be used once the Buffer
is returned.
:: BufferClass bufferT | |
=> bufferT |
|
-> Maybe ClockTime | the timestamp on |
Get the timestamp on buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Maybe ClockTime) | the timestamp on the current |
Get the timestamp on the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> Maybe ClockTime |
|
-> MiniObjectT bufferT m () |
Set the timestamp on the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Maybe ClockTime | the duration of |
Get the duration of buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Maybe ClockTime) | the duration of the current |
Get the duration of the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> Maybe ClockTime |
|
-> MiniObjectT bufferT m () |
Set the duration of the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Maybe Caps |
Get the Caps
of buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Maybe Caps) |
Get the caps of the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> Maybe Caps |
|
-> MiniObjectT bufferT m () |
Set the caps of the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Maybe Word64 | the start offset of |
Get the start offset of the Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Maybe Word64) | the start offset of the current
|
Get the start offset of the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> Maybe Word64 |
|
-> MiniObjectT bufferT m () |
Set the start offset of the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Maybe Word64 | the end offset of |
Get the end offset of the Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m (Maybe Word64) | the start offset of the current
|
Get the end offset of the current Buffer
.
:: (BufferClass bufferT, MonadIO m) | |
=> Maybe Word64 |
|
-> MiniObjectT bufferT m () |
Set the end offset of the current Buffer
.
:: BufferClass bufferT | |
=> bufferT |
|
-> Bool |
|
:: (BufferClass bufferT, MonadIO m) | |
=> MiniObjectT bufferT m Bool |
|
:: MonadIO m | |
=> MiniObjectT Buffer m a |
|
-> m (Buffer, a) | the new buffer and the action's result |
:: MonadIO m | |
=> Word |
|
-> MiniObjectT Buffer m a |
|
-> m (Buffer, a) | the new |
Create and mutate a Buffer
of the given size.
:: BufferClass bufferT | |
=> bufferT |
|
-> Word |
|
-> Word |
|
-> Maybe Buffer | the new sub-buffer |
Create a sub-buffer from an existing Buffer
with the given offset
and size. This sub-buffer uses the actual memory space of the
parent buffer. Thus function will copy the offset and timestamp
fields when the offset is 0. Otherwise, they will both be set to
Nothing
. If the offset is 0 and the size is the total size of
the parent, the duration and offset end fields are also
copied. Otherwise they will be set to Nothing
.
:: (BufferClass bufferT1, BufferClass bufferT2) | |
=> bufferT1 |
|
-> bufferT2 |
|
-> Bool |
|
Return True
if bufferSpan
can be done without copying the
data, or False
otherwise.
:: (BufferClass bufferT1, BufferClass bufferT2) | |
=> bufferT1 |
|
-> Word32 |
|
-> bufferT2 |
|
-> Word32 |
|
-> Maybe Buffer | the spanning buffer, or |
Create a new Buffer
that consists of a span across the given
buffers. Logically, the buffers are concatenated to make a larger
buffer, and a new buffer is created at the given offset and with
the given size.
If the two buffers are children of the same larger buffer, and
are contiguous, no copying is necessary. You can use
bufferIsSpanFast
to determine if copying is needed.
:: (BufferClass bufferT1, BufferClass bufferT2) | |
=> bufferT1 |
|
-> bufferT2 |
|
-> Buffer | the concatenation of the buffers |
Concatenate two buffers. If the buffers point to contiguous memory areas, no copying will occur.