1 2 #include <BufferConsumer.h> 3 #include <MediaEventLooper.h> 4 5 class ConsumerNode : public virtual BBufferConsumer, BMediaEventLooper 6 { 7 public: 8 ConsumerNode(); 9 ~ConsumerNode(); 10 11 protected: 12 /* functionality of BMediaNode */ 13 virtual void NodeRegistered(); 14 /* BBufferConsumer */ 15 virtual status_t AcceptFormat( 16 const media_destination & dest, 17 media_format * format); 18 virtual status_t GetNextInput( 19 int32 * cookie, 20 media_input * out_input); 21 virtual void DisposeInputCookie( 22 int32 cookie); 23 virtual void BufferReceived( 24 BBuffer * buffer); 25 virtual void ProducerDataStatus( 26 const media_destination & for_whom, 27 int32 status, 28 bigtime_t at_performance_time); 29 virtual status_t GetLatencyFor( 30 const media_destination & for_whom, 31 bigtime_t * out_latency, 32 media_node_id * out_timesource); 33 virtual status_t Connected( 34 const media_source & producer, 35 const media_destination & where, 36 const media_format & with_format, 37 media_input * out_input); 38 virtual void Disconnected( 39 const media_source & producer, 40 const media_destination & where); 41 virtual status_t FormatChanged( 42 const media_source & producer, 43 const media_destination & consumer, 44 int32 change_tag, 45 const media_format & format); 46 47 virtual status_t HandleMessage(int32 message, 48 const void *data, size_t size); 49 50 virtual status_t SeekTagRequested( 51 const media_destination& destination, 52 bigtime_t in_target_time, 53 uint32 in_flags, 54 media_seek_tag* out_seek_tag, 55 bigtime_t* out_tagged_time, 56 uint32* out_flags); 57 58 /* from BMediaNode */ 59 virtual BMediaAddOn* AddOn( 60 int32 * internal_id) const; 61 62 /* from BMediaEventLooper */ 63 virtual void HandleEvent(const media_timed_event *event, 64 bigtime_t lateness, 65 bool realTimeEvent = false); 66 67 /* our own functionality */ 68 void InitializeInput(); 69 70 media_input mInput; 71 media_format mPreferredFormat; 72 }; 73