The functions in this class aren't called by applications or by other nodes; they're called exclusively by the Media Kit to control and obtain information about a buffer consumer.
BBufferConsumer
is the counterpart to the
BBufferProducer
class—it receives
BBuffer
s
from the
BBufferProducer
s
that are connected to it,
manipulates them in some fashion (either by altering the contents of the
buffer or by playing the buffer's data to the speakers or to the screen),
and possibly then passes them along to another
BBufferConsumer
(if the node also inherits from
BBufferProducer
).
The functions in this class aren't called by applications or by other nodes; they're called exclusively by the Media Kit to control and obtain information about a buffer consumer.
A BBufferConsumer
publishes certain inputs, identified by
media_destination
structures, on which connections may be requested by a
client application.
Sometimes you'll find that the producer that's sending buffers to your
BBufferConsumer
is using a different time source than you are. It's
relatively easy to cope with this situation—you just have to be
aware that it can occur and compensate when it does:
bigtime_ttime
; media_nodeproducerNode
; BTimeSource *producerTimeSource
; media_node_idproducerTSID
=buffer
->Header
()->time_source
; if (producerTSID
!=myTSID
) {roster
->GetNodeFor
(producerTSID
, &producerNode
);producerTimeSource
=roster
->MakeTimeSourceFor
(&producerNode
);time
=buffer
->Header
()->start_time
;time
=producerTimeSource
->RealTimeFor
(time
,myLatency
);time
=myTimeSource
->PerformanceTimeFor
(time
); } else {time
=buffer
->Header
()->start_time
;
After this code has executed, time contains the start time for the buffer, in your node's time base.
You should probably, for performance's sake, cache the producer's time
source the first time
BufferReceived()
is called.