1 #include <BufferProducer.h> 2 #include <MediaEventLooper.h> 3 4 class ProducerNode : public virtual BBufferProducer, BMediaEventLooper 5 { 6 public: 7 ProducerNode(); 8 ~ProducerNode(); 9 10 protected: 11 12 /* functionality of BMediaNode */ 13 virtual BMediaAddOn* AddOn( 14 int32 * internal_id) const; 15 16 virtual void NodeRegistered(); 17 18 virtual status_t GetNodeAttributes( 19 media_node_attribute* attributes, 20 size_t count); 21 22 /* functionality of BBufferProducer */ 23 virtual status_t FormatSuggestionRequested( 24 media_type type, 25 int32 quality, 26 media_format * format); 27 virtual status_t FormatProposal( 28 const media_source & output, 29 media_format * format); 30 virtual status_t FormatChangeRequested( 31 const media_source & source, 32 const media_destination & destination, 33 media_format * io_format, 34 int32 * _deprecated_); 35 virtual status_t GetNextOutput( /* cookie starts as 0 */ 36 int32 * cookie, 37 media_output * out_output); 38 virtual status_t DisposeOutputCookie( 39 int32 cookie); 40 virtual status_t SetBufferGroup( 41 const media_source & for_source, 42 BBufferGroup * group); 43 virtual status_t VideoClippingChanged( 44 const media_source & for_source, 45 int16 num_shorts, 46 int16 * clip_data, 47 const media_video_display_info & display, 48 int32 * _deprecated_); 49 virtual status_t GetLatency( 50 bigtime_t * out_lantency); 51 virtual status_t PrepareToConnect( 52 const media_source & what, 53 const media_destination & where, 54 media_format * format, 55 media_source * out_source, 56 char * out_name); 57 virtual void Connect( 58 status_t error, 59 const media_source & source, 60 const media_destination & destination, 61 const media_format & format, 62 char * io_name); 63 virtual void Disconnect( 64 const media_source & what, 65 const media_destination & where); 66 virtual void LateNoticeReceived( 67 const media_source & what, 68 bigtime_t how_much, 69 bigtime_t performance_time); 70 virtual void EnableOutput( 71 const media_source & what, 72 bool enabled, 73 int32 * _deprecated_); 74 75 virtual status_t HandleMessage(int32 message, 76 const void *data, size_t size); 77 78 virtual void AdditionalBufferRequested( 79 const media_source & source, 80 media_buffer_id prev_buffer, 81 bigtime_t prev_time, 82 const media_seek_tag * prev_tag); 83 84 virtual void LatencyChanged( 85 const media_source & source, 86 const media_destination & destination, 87 bigtime_t new_latency, 88 uint32 flags); 89 90 /* functionality of BMediaEventLooper */ 91 virtual void HandleEvent( 92 const media_timed_event *event, 93 bigtime_t lateness, 94 bool realTimeEvent = false); 95 96 /* our own functionality */ 97 void InitializeOutput(); 98 99 static int32 _bufferproducer(void *arg); 100 void BufferProducer(); 101 102 BBufferGroup *mBufferGroup; 103 sem_id mBufferProducerSem; 104 thread_id mBufferProducer; 105 106 bool mOutputEnabled; 107 media_output mOutput; 108 }; 109 110