mediabus-0.4.0.1: Multimedia streaming on top of Conduit

Safe HaskellNone
LanguageHaskell2010

Data.MediaBus.Media.Buffer

Description

Media with a content stored in a Vector

Synopsis

Documentation

type CanBeSample i = (Typeable i, Eq i, NFData i, Storable i) Source #

Always recurring contraints on Sample types.

class HasMediaBuffer s t where Source #

Types containing a MediaBuffer

Minimal complete definition

mediaBuffer

Associated Types

type MediaBufferFrom s Source #

The media buffer type contained in s

type MediaBufferTo t Source #

The type that results from changing the media buffer type in s to b

Methods

mediaBuffer :: Lens s t (MediaBufferFrom s) (MediaBufferTo t) Source #

A lens for converting the media buffer

Instances

(CanBeSample (Pcm ca a), CanBeSample (Pcm cb b)) => HasMediaBuffer (Audio r ca (Raw * a)) (Audio r' cb (Raw * b)) Source # 

Associated Types

type MediaBufferFrom (Audio r ca (Raw * a)) :: * Source #

type MediaBufferTo (Audio r' cb (Raw * b)) :: * Source #

Methods

mediaBuffer :: Lens (Audio r ca (Raw * a)) (Audio r' cb (Raw * b)) (MediaBufferFrom (Audio r ca (Raw * a))) (MediaBufferTo (Audio r' cb (Raw * b))) Source #

type HasMediaBuffer' s = (HasMediaBuffer s s, MediaBufferFrom s ~ MediaBufferTo s) Source #

Like HasMediaBuffer but with s ~ t and MediaBufferFrom s ~ MediaBufferTo t

type HasMediaBufferL s t a b = (HasMediaBuffer s t, MediaBufferFrom s ~ a, MediaBufferTo t ~ b) Source #

Like HasMediaBuffer but with the typical lens type parameters s t a b

type HasMediaBufferL' s a = (HasMediaBuffer s s, MediaBufferFrom s ~ a, MediaBufferTo s ~ a) Source #

Like HasMediaBufferL but with the typical **simple** lens type parameters s a

mediaBuffer' :: HasMediaBuffer' s => Lens' s (MediaBufferFrom s) Source #

Like mediaBuffer but with s ~ t and MediaBufferFrom s ~ MediaBufferTo t

newtype MediaBuffer t Source #

A buffer for media data. This is just a newtype wrapper around Vector.

Constructors

MkMediaBuffer (Vector t) 

Instances

CanBeSample s => IsList (MediaBuffer s) Source # 

Associated Types

type Item (MediaBuffer s) :: * #

(Eq t, Storable t) => Eq (MediaBuffer t) Source # 
(Show a, CanBeSample a) => Show (MediaBuffer a) Source # 
Generic (MediaBuffer t) Source # 

Associated Types

type Rep (MediaBuffer t) :: * -> * #

Methods

from :: MediaBuffer t -> Rep (MediaBuffer t) x #

to :: Rep (MediaBuffer t) x -> MediaBuffer t #

Storable t => Monoid (MediaBuffer t) Source # 
CanBeSample sampleType => Default (MediaBuffer sampleType) Source # 

Methods

def :: MediaBuffer sampleType #

NFData (MediaBuffer t) Source # 

Methods

rnf :: MediaBuffer t -> () #

(Storable a, Storable b) => Each (MediaBuffer a) (MediaBuffer b) a b Source #

Traversal instance

Methods

each :: Traversal (MediaBuffer a) (MediaBuffer b) a b #

type Rep (MediaBuffer t) Source # 
type Rep (MediaBuffer t) = D1 (MetaData "MediaBuffer" "Data.MediaBus.Media.Buffer" "mediabus-0.4.0.1-KxOztWIrQ7SL9k5ZMcQI4H" True) (C1 (MetaCons "MkMediaBuffer" PrefixI True) (S1 (MetaSel (Just Symbol "_mediaBufferVector") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Vector t))))
type Item (MediaBuffer s) Source # 
type Item (MediaBuffer s) = s

mediaBufferVector :: Iso (MediaBuffer s) (MediaBuffer t) (Vector s) (Vector t) Source #

MediaBuffer to Vector isomorphism

mediaBufferLength :: CanBeSample t => MediaBuffer t -> Int Source #

Return the number of BufferElements in the MediaBuffer buffer.

mediaBufferFromList :: CanBeSample s => [s] -> MediaBuffer s Source #

Create a MediaBuffer from a list in O(n).

mediaBufferToList :: CanBeSample s => MediaBuffer s -> [s] Source #

Convert the media buffer vector contents to a list in O(n).

mediaBufferFromByteString :: CanBeSample a => ByteString -> MediaBuffer a Source #

An efficient conversion of a ByteString to a MediaBuffer

mediaBufferToByteString :: CanBeSample a => MediaBuffer a -> ByteString Source #

An efficient conversion of a MediaBuffer to a ByteString

createMediaBuffer :: CanBeSample t => (forall s. ST s (MVector s t)) -> MediaBuffer t Source #

Create a new MediaBuffer using an ST action that returns a mutable MVector.

modifyMediaBuffer :: CanBeSample a => (forall s. MVector s a -> ST s ()) -> MediaBuffer a -> MediaBuffer a Source #

Modify the underlying Vector of some MediaBuffer with a function that is applied to the mutable vector of that MediaBuffer. The function must result in a ST action that does the modifications.

unsafeModifyMediaBuffer :: CanBeSample a => (forall s. MVector s a -> ST s r) -> MediaBuffer a -> (r, MediaBuffer a) Source #

Modify the underlying Vector of some MediaBuffer with a function that is applied to the mutable vector of that MediaBuffer. The function must result in a ST action that does the modifications.

Unsafe because results can be returned, so the thawn mutable vector might escape.