2 * Copyright (c) 2004-2007 Marcus Overhagen <marcus@overhagen.de>
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify,
8 * merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef __VIDEO_NODE_H_
25 #define __VIDEO_NODE_H_
28 #include <BufferConsumer.h>
29 #include <MediaEventLooper.h>
35 class VideoNode
: public BMediaEventLooper
, public BBufferConsumer
{
37 VideoNode(const char *name
, VideoView
*view
);
40 void SetOverlayEnabled(bool yesno
);
41 bool IsOverlayActive();
48 BMediaAddOn
* AddOn(int32
*internal_id
) const;
50 void NodeRegistered();
52 void BufferReceived(BBuffer
* buffer
);
54 status_t
GetNextInput(int32
*cookie
, media_input
*out_input
);
55 void DisposeInputCookie(int32 cookie
);
57 status_t
HandleMessage(int32 message
, const void *data
, size_t size
);
59 void HandleEvent(const media_timed_event
*event
,
60 bigtime_t lateness
, bool realTimeEvent
);
62 status_t
AcceptFormat(const media_destination
&dst
,
63 media_format
*format
);
65 void ProducerDataStatus(const media_destination
&dst
,
66 int32 status
, bigtime_t at_media_time
);
68 status_t
GetLatencyFor(const media_destination
&dst
,
69 bigtime_t
*out_latency
, media_node_id
*out_id
);
71 status_t
Connected(const media_source
&src
,
72 const media_destination
&dst
,
73 const media_format
&format
, media_input
*out_input
);
75 void Disconnected(const media_source
&src
,
76 const media_destination
&dst
);
78 status_t
FormatChanged(const media_source
&src
,
79 const media_destination
&dst
, int32 from_change_count
,
80 const media_format
&format
);
83 void HandleBuffer(BBuffer
*buffer
);
84 status_t
CreateBuffers(BRect frame
, color_space cspace
, bool overlay
);
88 VideoView
* fVideoView
;
92 bool fDirectOverlayBuffer
; // If the overlay memory is directly written by the producer node.
94 BLocker
* fBitmapLocker
;
97 #endif // __VIDEO_NODE_H_