1 #ifndef CODYCAM_H 2 #define CODYCAM_H 3 4 5 #include "Settings.h" 6 #include "VideoConsumer.h" 7 8 #include <string.h> 9 10 #include <Application.h> 11 #include <Box.h> 12 #include <Catalog.h> 13 #include <CheckBox.h> 14 #include <Locale.h> 15 #include <Menu.h> 16 #include <MenuField.h> 17 #include <StringView.h> 18 #include <TextControl.h> 19 #include <Window.h> 20 21 22 class BMediaRoster; 23 24 25 enum { 26 msg_filename = 'file', 27 28 msg_rate_15s = 'r15s', 29 msg_rate_30s = 'r30s', 30 msg_rate_1m = 'r1m ', 31 msg_rate_5m = 'r5m ', 32 msg_rate_10m = 'r10m', 33 msg_rate_15m = 'r15m', 34 msg_rate_30m = 'r30m', 35 msg_rate_1h = 'r1h ', 36 msg_rate_2h = 'r2h ', 37 msg_rate_4h = 'r4h ', 38 msg_rate_8h = 'r8h ', 39 msg_rate_24h = 'r24h', 40 msg_rate_never = 'nevr', 41 42 msg_translate = 'tran', 43 44 msg_upl_client = 'ucli', 45 msg_server = 'srvr', 46 msg_login = 'lgin', 47 msg_password = 'pswd', 48 msg_directory = 'drct', 49 msg_passiveftp = 'pasv', 50 msg_pswrd_text = 'pstx', 51 52 msg_start = 'strt', 53 msg_stop = 'stop', 54 55 msg_about = 'abut', 56 msg_setup = 'setp', 57 msg_video = 'vdeo', 58 59 msg_control_win = 'ctlw' 60 }; 61 62 63 const char* kCaptureRate[] = { 64 // NOTE: These are translated once the app catalog is loaded. 65 "Every 15 seconds", 66 "Every 30 seconds", 67 "Every minute", 68 "Every 5 minutes", 69 "Every 10 minutes", 70 "Every 15 minutes", 71 "Every 30 minutes", 72 "Every hour", 73 "Every 2 hours", 74 "Every 4 hours", 75 "Every 8 hours", 76 "Every 24 hours", 77 "Never", 78 0 79 }; 80 81 82 const char* kUploadClient[] = { 83 // NOTE: These are translated once the app catalog is loaded. 84 "FTP", 85 "SFTP", 86 "Local", 87 0 88 }; 89 90 91 class CodyCam : public BApplication { 92 public: 93 CodyCam(); 94 virtual ~CodyCam(); 95 96 void ReadyToRun(); 97 virtual bool QuitRequested(); 98 virtual void MessageReceived(BMessage* message); 99 100 private: 101 status_t _SetUpNodes(); 102 void _TearDownNodes(); 103 104 BMediaRoster* fMediaRoster; 105 media_node fTimeSourceNode; 106 media_node fProducerNode; 107 VideoConsumer* fVideoConsumer; 108 media_output fProducerOut; 109 media_input fConsumerIn; 110 BWindow* fWindow; 111 port_id fPort; 112 BWindow* fVideoControlWindow; 113 }; 114 115 116 class VideoWindow : public BWindow { 117 public: 118 VideoWindow(BRect frame, const char* title, 119 window_type type, uint32 flags, 120 port_id* consumerport); 121 ~VideoWindow(); 122 123 virtual bool QuitRequested(); 124 virtual void MessageReceived(BMessage* message); 125 126 void ApplyControls(); 127 128 BView* VideoView(); 129 BStringView* StatusLine(); 130 131 private: 132 void _BuildCaptureControls(BView* theView); 133 134 void _SetUpSettings(const char* filename, 135 const char* dirname); 136 void _UploadClientChanged(); 137 void _QuitSettings(); 138 139 private: 140 media_node* fProducer; 141 port_id* fPortPtr; 142 143 BView* fView; 144 BView* fVideoView; 145 146 BTextControl* fFileName; 147 BBox* fCaptureSetupBox; 148 BMenu* fCaptureRateMenu; 149 BMenuField* fCaptureRateSelector; 150 BMenu* fImageFormatMenu; 151 BMenuField* fImageFormatSelector; 152 BMenu* fUploadClientMenu; 153 BMenuField* fUploadClientSelector; 154 BBox* fFtpSetupBox; 155 BTextControl* fServerName; 156 BTextControl* fLoginId; 157 BTextControl* fPassword; 158 BTextControl* fDirectory; 159 BCheckBox* fPassiveFtp; 160 BBox* fStatusBox; 161 BStringView* fStatusLine; 162 163 ftp_msg_info fFtpInfo; 164 165 Settings* fSettings; 166 167 StringValueSetting* fServerSetting; 168 StringValueSetting* fLoginSetting; 169 StringValueSetting* fPasswordSetting; 170 StringValueSetting* fDirectorySetting; 171 BooleanValueSetting* fPassiveFtpSetting; 172 StringValueSetting* fFilenameSetting; 173 StringValueSetting* fImageFormatSettings; 174 175 EnumeratedStringValueSetting* fUploadClientSetting; 176 EnumeratedStringValueSetting* fCaptureRateSetting; 177 }; 178 179 180 class ControlWindow : public BWindow { 181 public: 182 ControlWindow(const BRect& frame, BView* controls, 183 media_node node); 184 void MessageReceived(BMessage* message); 185 bool QuitRequested(); 186 187 private: 188 BView* fView; 189 media_node fNode; 190 }; 191 192 #endif // CODYCAM_H 193 194