Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
BitReader
provides a bit reader that can read any number of bits
from a memory buffer. It provides functions for reading any number of bits
into 8, 16, 32 and 64 bit variables.
Synopsis
- newtype BitReader = BitReader (ManagedPtr BitReader)
- newZeroBitReader :: MonadIO m => m BitReader
- noBitReader :: Maybe BitReader
- bitReaderFree :: (HasCallStack, MonadIO m) => BitReader -> m ()
- bitReaderGetBitsUint16 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word16)
- bitReaderGetBitsUint32 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word32)
- bitReaderGetBitsUint64 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word64)
- bitReaderGetBitsUint8 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word8)
- bitReaderGetPos :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- bitReaderGetRemaining :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- bitReaderGetSize :: (HasCallStack, MonadIO m) => BitReader -> m Word32
- bitReaderInit :: (HasCallStack, MonadIO m) => BitReader -> ByteString -> m ()
- bitReaderPeekBitsUint16 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word16)
- bitReaderPeekBitsUint32 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word32)
- bitReaderPeekBitsUint64 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word64)
- bitReaderPeekBitsUint8 :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m (Bool, Word8)
- bitReaderSetPos :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m Bool
- bitReaderSkip :: (HasCallStack, MonadIO m) => BitReader -> Word32 -> m Bool
- bitReaderSkipToByte :: (HasCallStack, MonadIO m) => BitReader -> m Bool
- getBitReaderBit :: MonadIO m => BitReader -> m Word32
- setBitReaderBit :: MonadIO m => BitReader -> Word32 -> m ()
- getBitReaderByte :: MonadIO m => BitReader -> m Word32
- setBitReaderByte :: MonadIO m => BitReader -> Word32 -> m ()
- getBitReaderSize :: MonadIO m => BitReader -> m Word32
- setBitReaderSize :: MonadIO m => BitReader -> Word32 -> m ()
Exported types
Memory-managed wrapper type.
Instances
WrappedPtr BitReader Source # | |
Defined in GI.GstBase.Structs.BitReader wrappedPtrCalloc :: IO (Ptr BitReader) wrappedPtrCopy :: BitReader -> IO BitReader wrappedPtrFree :: Maybe (GDestroyNotify BitReader) | |
tag ~ AttrSet => Constructible BitReader tag Source # | |
newZeroBitReader :: MonadIO m => m BitReader Source #
Construct a BitReader
struct initialized to zero.
Methods
free
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m () |
Frees a BitReader
instance, which was previously allocated by
gst_bit_reader_new()
.
getBitsUint16
bitReaderGetBitsUint16 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word16) |
Read nbits
bits into val
and update the current position.
getBitsUint32
bitReaderGetBitsUint32 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word32) |
Read nbits
bits into val
and update the current position.
getBitsUint64
bitReaderGetBitsUint64 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word64) |
Read nbits
bits into val
and update the current position.
getBitsUint8
bitReaderGetBitsUint8 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word8) |
Read nbits
bits into val
and update the current position.
getPos
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The current position of |
Returns the current position of a BitReader
instance in bits.
getRemaining
bitReaderGetRemaining Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The remaining number of bits of |
Returns the remaining number of bits of a BitReader
instance.
getSize
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Word32 | Returns: The total number of bits of |
Returns the total number of bits of a BitReader
instance.
init
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> ByteString |
|
-> m () |
Initializes a BitReader
instance to read from data
. This function
can be called on already initialized instances.
peekBitsUint16
bitReaderPeekBitsUint16 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word16) |
Read nbits
bits into val
but keep the current position.
peekBitsUint32
bitReaderPeekBitsUint32 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word32) |
Read nbits
bits into val
but keep the current position.
peekBitsUint64
bitReaderPeekBitsUint64 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word64) |
Read nbits
bits into val
but keep the current position.
peekBitsUint8
bitReaderPeekBitsUint8 Source #
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m (Bool, Word8) |
Read nbits
bits into val
but keep the current position.
setPos
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m Bool | Returns: |
Sets the new position of a BitReader
instance to pos
in bits.
skip
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> Word32 |
|
-> m Bool | Returns: |
Skips nbits
bits of the BitReader
instance.
skipToByte
:: (HasCallStack, MonadIO m) | |
=> BitReader |
|
-> m Bool |
Skips until the next byte.
Properties
bit
Bit position in the current byte
getBitReaderBit :: MonadIO m => BitReader -> m Word32 Source #
Get the value of the “bit
” field.
When overloading is enabled, this is equivalent to
get
bitReader #bit
setBitReaderBit :: MonadIO m => BitReader -> Word32 -> m () Source #
Set the value of the “bit
” field.
When overloading is enabled, this is equivalent to
set
bitReader [ #bit:=
value ]
byte
Current byte position
getBitReaderByte :: MonadIO m => BitReader -> m Word32 Source #
Get the value of the “byte
” field.
When overloading is enabled, this is equivalent to
get
bitReader #byte
setBitReaderByte :: MonadIO m => BitReader -> Word32 -> m () Source #
Set the value of the “byte
” field.
When overloading is enabled, this is equivalent to
set
bitReader [ #byte:=
value ]
size
Size of data
in bytes
getBitReaderSize :: MonadIO m => BitReader -> m Word32 Source #
Get the value of the “size
” field.
When overloading is enabled, this is equivalent to
get
bitReader #size
setBitReaderSize :: MonadIO m => BitReader -> Word32 -> m () Source #
Set the value of the “size
” field.
When overloading is enabled, this is equivalent to
set
bitReader [ #size:=
value ]