6 #include "VideoConsumer.h"
10 #include <Application.h>
16 #include <MenuField.h>
17 #include <StringView.h>
18 #include <TextControl.h>
26 msg_filename
= 'file',
28 msg_rate_changed
= 'rate',
30 msg_translate
= 'tran',
32 msg_upl_client
= 'ucli',
35 msg_password
= 'pswd',
36 msg_directory
= 'drct',
37 msg_passiveftp
= 'pasv',
38 msg_pswrd_text
= 'pstx',
46 msg_control_win
= 'ctlw'
56 // NOTE: These are translated once the app catalog is loaded.
57 capture_rate kCaptureRates
[] = {
58 {"Every 15 seconds", 15 },
59 {"Every 30 seconds", 30 },
60 {"Every minute", 60 },
61 {"Every 5 minutes", 5 * 60 },
62 {"Every 10 minutes", 10 * 60 },
63 {"Every 15 minutes", 15 * 60 },
64 {"Every 30 minutes", 30 * 60 },
65 {"Every hour", 60 * 60 },
66 {"Every 2 hours", 2 * 60 * 60 },
67 {"Every 4 hours", 4 * 60 * 60 },
68 {"Every 8 hours", 8 * 60 * 60 },
69 {"Every 24 hours", 24 * 60 * 60 },
74 const int32 kCaptureRatesCount
= sizeof(kCaptureRates
) / sizeof(capture_rate
);
77 const char* kUploadClients
[] = {
78 // NOTE: These are translated once the app catalog is loaded.
85 const int32 kUploadClientsCount
= sizeof(kUploadClients
) / sizeof(char*);
90 class CodyCam
: public BApplication
{
96 virtual bool QuitRequested();
97 virtual void MessageReceived(BMessage
* message
);
100 status_t
_SetUpNodes();
101 void _TearDownNodes();
103 BMediaRoster
* fMediaRoster
;
104 media_node fTimeSourceNode
;
105 media_node fProducerNode
;
106 VideoConsumer
* fVideoConsumer
;
107 media_output fProducerOut
;
108 media_input fConsumerIn
;
109 VideoWindow
* fWindow
;
111 ControlWindow
* fVideoControlWindow
;
115 class VideoWindow
: public BWindow
{
117 VideoWindow(const char* title
,
118 window_type type
, uint32 flags
,
119 port_id
* consumerport
);
122 virtual bool QuitRequested();
123 virtual void MessageReceived(BMessage
* message
);
125 void ApplyControls();
128 BStringView
* StatusLine();
129 void ToggleMenuOnOff();
131 void ErrorAlert(const char*, status_t
);
134 void _BuildCaptureControls();
136 void _SetUpSettings(const char* filename
,
137 const char* dirname
);
138 void _UploadClientChanged();
139 void _QuitSettings();
142 media_node
* fProducer
;
146 BTextView
* fErrorView
;
148 BTextControl
* fFileName
;
149 BBox
* fCaptureSetupBox
;
150 BMenu
* fCaptureRateMenu
;
151 BMenuField
* fCaptureRateSelector
;
152 BMenu
* fImageFormatMenu
;
153 BMenuField
* fImageFormatSelector
;
154 BMenu
* fUploadClientMenu
;
155 BMenuField
* fUploadClientSelector
;
157 BTextControl
* fServerName
;
158 BTextControl
* fLoginId
;
159 BTextControl
* fPassword
;
160 BTextControl
* fDirectory
;
161 BCheckBox
* fPassiveFtp
;
163 BStringView
* fStatusLine
;
165 ftp_msg_info fFtpInfo
;
171 StringValueSetting
* fServerSetting
;
172 StringValueSetting
* fLoginSetting
;
173 StringValueSetting
* fPasswordSetting
;
174 StringValueSetting
* fDirectorySetting
;
175 BooleanValueSetting
* fPassiveFtpSetting
;
176 StringValueSetting
* fFilenameSetting
;
177 StringValueSetting
* fImageFormatSettings
;
179 EnumeratedStringValueSetting
* fUploadClientSetting
;
180 EnumeratedStringValueSetting
* fCaptureRateSetting
;
184 class ControlWindow
: public BWindow
{
186 ControlWindow(BView
* controls
,
188 void MessageReceived(BMessage
* message
);
189 bool QuitRequested();