BBufferProducer¶
A BBufferProducer
is a BMediaNode
that emits
buffers containing media data that other nodes
(BBufferConsumer
s in particular) will receive and,
potentially, process. If your node wants to emit buffers, it must be
derived from BBufferProducer
and override the hook functions
to implement the BBufferProducer
protocol.
Video Clipping¶
Currently, the only video clipping format supported by the Media Kit is
B_CLIP_SHORT_RUNS
, although there is a function in this
class for converting between this format and BRegion
s.
This format begins with a header, consisting of two int16 values:
Field |
Description |
---|---|
offsetX |
X offset for all following coordinates. |
offsetY |
Y offset for all following coordinates. |
These values indicate the offset for the X and Y coordinates indicated throughout the rest of the clipping data.
The remainder of the clipping data consists of entries indicating each line of video data, as follows:
Field |
Description |
---|---|
numShorts |
The number of values in the coordList. Always an even number. If negative, repeats the previous entry numShorts times. |
coordList… |
List of coordinates. Even entries are left-edge X coordinates, odd entries are right-edge X coordinates. |
The clipping data contains one of these entries for each time the clipping information changes.
For example, if the clipping is a rectangle with the left edge at 100, top edge at 50, right edge at 300, and bottom edge at 200, the clipping data for a 640x480 display might be:
header
offsetX: 0
offsetY: 50
entry 1
numShorts: 2
coordList: 100, 300
entry 2
numShorts: -150
entry 3
numShorts: 2
coordList: 0, 639
entry 4
numShorts: -280
The header indicates that the clipping data begins at row 50.
The first entry indicates that clipping should span from column 100 to column 300 on the first row of clipping (row 50). The second entry says to repeat this 150 times.
Entry 3 indicates that clipping from that point on should be from column 0 to column 639 (the entire width of the display). Entry 4 causes this to repeat 280 times, to the bottom of the display.