Breaks data into chunks matching a required chunk rate
Send data, such as binary strings to this component and it will break it down to roughly constant sized chunks, to match a required 'rate' of chunk emission.
This is not about 'real time' chunking of a live data source, but is instead about precisely chunking data that you know has been generated, or will be consumed, at a particular rate.
You specify the 'rate' of the incoming data and the rate you want chunks sent out at. RateChunker will determine what size the chunks need to be, applying dynamic rounding to precisely match the rate without drift over time.
Chunking a stream of 48KHz 16bit stereo audio into 25 chunks per second of audio data (one chunk for each frame of a corresponding piece of 25fps video):
bps = bytesPerSample = 2*2 Pipeline( AudioSource(), RateChunker(datarate=48000*bps, quantasize=bps, chunkrate=25), ... )
The quanta size ensures that the chunks RateChunker sends out always contain a whole number of samples (4 bytes per sample).
At initialisation, specify:
Send slicable data items, such as strings containing binary data to the "inbox" inbox. The same data is sent out of the "outbox" outbox, rechunked to meet the required chunk rate.
The outgoing chunk sizes are dynamically varied to match the required chunk rate as accurately as possible. The quantasize parameter dictates the minimum unit by which the chunksize will be varied.
For example, for 16bit stereo audio data, there are 4 bytes per sample, so a quantasize of 4 should be specified, to make sure samples remain whole.
If a producerFinished or shutdownMicroprocess message is received on the "control" inbox. It is immediately sent on out of the "signal" outbox and the component then immediately terminates.
RateChunker(datarate,quantasize,chunkrate) -> new Chunk component.
Alters the chunksize of incoming data to match a desired chunkrate.
Methods defined here
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.