btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / mediaplayer / media_node_framework / NodeManager.h
blob21b1dd478dc0bd616c3f95fa8ff04b4031e74b89
1 /*
2 * Copyright (c) 2000-2008, Ingo Weinhold <ingo_weinhold@gmx.de>,
3 * Copyright (c) 2000-2008, Stephan Aßmus <superstippi@gmx.de>,
4 * All Rights Reserved. Distributed under the terms of the MIT license.
5 */
6 #ifndef NODE_MANAGER_H
7 #define NODE_MANAGER_H
10 #include <MediaNode.h>
12 #include "PlaybackManager.h"
15 class BMediaRoster;
16 class AudioProducer;
17 class VideoTarget;
18 class VideoProducer;
19 class VideoConsumer;
20 class AudioSupplier;
21 class VideoSupplier;
24 class NodeManager : public PlaybackManager {
25 public:
26 NodeManager();
27 virtual ~NodeManager();
29 // must be implemented in derived classes
30 virtual VideoTarget* CreateVideoTarget() = 0;
31 virtual VideoSupplier* CreateVideoSupplier() = 0;
32 virtual AudioSupplier* CreateAudioSupplier() = 0;
34 // NodeManager
35 enum {
36 AUDIO_AND_VIDEO = 0,
37 VIDEO_ONLY,
38 AUDIO_ONLY
41 status_t Init(BRect videoBounds, float videoFrameRate,
42 color_space preferredVideoFormat,
43 float audioFrameRate, uint32 audioChannels,
44 int32 loopingMode, bool loopingEnabled,
45 float speed, uint32 enabledNodes,
46 bool useOverlays);
47 status_t InitCheck();
48 // only call this if the
49 // media_server has died!
50 status_t CleanupNodes();
52 status_t FormatChanged(BRect videoBounds,
53 float videoFrameRate,
54 color_space preferredVideoFormat,
55 float audioFrameRate, uint32 audioChannels,
56 uint32 enabledNodes,
57 bool useOverlays,
58 bool force = false);
60 virtual void SetPlayMode(int32 mode,
61 bool continuePlaying = true);
63 virtual bigtime_t RealTimeForTime(bigtime_t time) const;
64 virtual bigtime_t TimeForRealTime(bigtime_t time) const;
66 virtual void SetCurrentAudioTime(bigtime_t time);
68 void SetVideoBounds(BRect bounds);
69 virtual BRect VideoBounds() const;
71 void SetVideoTarget(VideoTarget* vcTarget);
72 VideoTarget* GetVideoTarget() const;
74 virtual void SetVolume(float percent);
76 void SetPeakListener(BHandler* handler);
78 private:
79 status_t _SetUpNodes(color_space preferredVideoFormat,
80 uint32 enabledNodes, bool useOverlays,
81 float audioFrameRate,
82 uint32 audioChannels);
83 status_t _SetUpVideoNodes(
84 color_space preferredVideoFormat,
85 bool useOverlays);
86 status_t _SetUpAudioNodes(float audioFrameRate,
87 uint32 audioChannels);
88 status_t _TearDownNodes(bool disconnect = true);
89 status_t _StartNodes();
90 void _StopNodes();
92 private:
93 struct Connection {
94 Connection();
96 media_node producer;
97 media_node consumer;
98 media_source source;
99 media_destination destination;
100 media_format format;
101 bool connected;
104 private:
105 BMediaRoster* fMediaRoster;
107 // media nodes
108 AudioProducer* fAudioProducer;
109 VideoConsumer* fVideoConsumer;
110 VideoProducer* fVideoProducer;
111 media_node fTimeSource;
113 Connection fAudioConnection;
114 Connection fVideoConnection;
116 bigtime_t fPerformanceTimeBase;
118 status_t fStatus;
120 VideoTarget* fVideoTarget;
121 AudioSupplier* fAudioSupplier;
122 VideoSupplier* fVideoSupplier;
123 BRect fVideoBounds;
125 BHandler* fPeakListener;
129 #endif // NODE_MANAGER_H