2 * Copyright 2014-2016, Dario Casalinuovo
3 * Copyright 1999, Be Incorporated
5 * This file may be used under the terms of the Be Sample Code License.
7 #ifndef _MEDIA_RECORDER_NODE_H
8 #define _MEDIA_RECORDER_NODE_H
11 #include <BufferConsumer.h>
12 #include <MediaEventLooper.h>
13 #include <MediaRecorder.h>
17 namespace BPrivate
{ namespace media
{
20 class BMediaRecorderNode
: public BMediaEventLooper
,
21 public BBufferConsumer
{
23 BMediaRecorderNode(const char* name
,
24 BMediaRecorder
* recorder
,
26 = B_MEDIA_UNKNOWN_TYPE
);
28 // TODO these are not thread safe; we should fix that...
29 void SetAcceptedFormat(const media_format
& format
);
30 const media_format
& AcceptedFormat() const;
32 void GetInput(media_input
* input
);
34 void SetDataEnabled(bool enabled
);
35 void ActivateInternalConnect(bool connectMode
);
39 virtual BMediaAddOn
* AddOn(int32
* id
) const;
41 virtual void NodeRegistered();
43 virtual void SetRunMode(run_mode mode
);
45 virtual void HandleEvent(const media_timed_event
* event
,
49 virtual void Start(bigtime_t performanceTime
);
51 virtual void Stop(bigtime_t performanceTime
,
54 virtual void Seek(bigtime_t mediaTime
,
55 bigtime_t performanceTime
);
57 virtual void TimeWarp(bigtime_t realTime
,
58 bigtime_t performanceTime
);
60 virtual status_t
HandleMessage(int32 message
,
64 // Someone, probably the producer, is asking you about
65 // this format. Give your honest opinion, possibly
66 // modifying *format. Do not ask upstream producer about
67 // the format, since he's synchronously waiting for your
70 virtual status_t
AcceptFormat(const media_destination
& dest
,
71 media_format
* format
);
73 virtual status_t
GetNextInput(int32
* cookie
,
74 media_input
* outInput
);
76 virtual void DisposeInputCookie(int32 cookie
);
78 virtual void BufferReceived(BBuffer
* buffer
);
80 virtual void ProducerDataStatus(
81 const media_destination
& destination
,
83 bigtime_t performanceTime
);
85 virtual status_t
GetLatencyFor(const media_destination
& destination
,
86 bigtime_t
* outLatency
,
87 media_node_id
* outTimesource
);
89 virtual status_t
Connected(const media_source
& producer
,
90 const media_destination
& where
,
91 const media_format
& format
,
92 media_input
* outInput
);
94 virtual void Disconnected(const media_source
& producer
,
95 const media_destination
& where
);
97 virtual status_t
FormatChanged(const media_source
& producer
,
98 const media_destination
& consumer
,
100 const media_format
& format
);
104 virtual ~BMediaRecorderNode();
106 BMediaRecorder
* fRecorder
;
107 media_format fOKFormat
;
116 using namespace BPrivate::media
;
118 #endif // _MEDIA_RECORDER_NODE_H