xref: /haiku/src/tests/kits/media/nodetest/ConsumerNode.h (revision 95c9effd68127df2dce202d5e254a7c86560010a)
1 
2 #include <BufferConsumer.h>
3 #include <MediaEventLooper.h>
4 
5 
6 class ConsumerNode : public virtual BBufferConsumer, BMediaEventLooper {
7 public:
8 								ConsumerNode();
9 	virtual						~ConsumerNode();
10 
11 protected:
12 	/* functionality of BMediaNode */
13 	virtual	void				NodeRegistered();
14 
15 	/* BBufferConsumer */
16 	virtual	status_t			AcceptFormat(const media_destination& dest,
17 									media_format* format);
18 	virtual	status_t			GetNextInput(int32* cookie,
19 									media_input* _input);
20 	virtual	void				DisposeInputCookie(int32 cookie);
21 	virtual	void				BufferReceived(BBuffer* buffer);
22 	virtual	void				ProducerDataStatus(
23 									const media_destination& forWhom,
24 									int32 status, bigtime_t atPerformanceTime);
25 	virtual	status_t			GetLatencyFor(const media_destination& forWhom,
26 									bigtime_t* _latency,
27 									media_node_id* _timesource);
28 	virtual	status_t			Connected(const media_source& producer,
29 									const media_destination& where,
30 									const media_format& withFormat,
31 									media_input* _input);
32 	virtual	void				Disconnected(const media_source& producer,
33 									const media_destination& where);
34 	virtual	status_t			FormatChanged(const media_source& producer,
35 									const media_destination& consumer,
36 									int32 changeTag,
37 									const media_format& format);
38 
39 	virtual status_t			HandleMessage(int32 message,
40 									const void* data, size_t size);
41 
42 	virtual status_t			SeekTagRequested(
43 									const media_destination& destination,
44 									bigtime_t targetTime, uint32 flags,
45 									media_seek_tag* _seekTag,
46 									bigtime_t* _taggedTime, uint32* _flags);
47 
48 	/* from BMediaNode */
49 	virtual	BMediaAddOn*		AddOn(int32* internalID) const;
50 
51 	/* from BMediaEventLooper */
52 	virtual void				HandleEvent(const media_timed_event* event,
53 							 		bigtime_t lateness,
54 							 		bool realTimeEvent = false);
55 
56 	/* our own functionality */
57 	void InitializeInput();
58 
59 private:
60 	media_input fInput;
61 };
62