Automatic whitespace cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -247,7 +247,7 @@ CodyCam::MessageReceived(BMessage *message)
|
|||||||
BRect(2 * WINDOW_OFFSET_X + WINDOW_SIZE_X, WINDOW_OFFSET_Y,
|
BRect(2 * WINDOW_OFFSET_X + WINDOW_SIZE_X, WINDOW_OFFSET_Y,
|
||||||
2 * WINDOW_OFFSET_X + WINDOW_SIZE_X + view->Bounds().right,
|
2 * WINDOW_OFFSET_X + WINDOW_SIZE_X + view->Bounds().right,
|
||||||
WINDOW_OFFSET_Y + view->Bounds().bottom), view, node);
|
WINDOW_OFFSET_Y + view->Bounds().bottom), view, node);
|
||||||
fMediaRoster->StartWatching(BMessenger(NULL,
|
fMediaRoster->StartWatching(BMessenger(NULL,
|
||||||
fVideoControlWindow), node, B_MEDIA_WEB_CHANGED);
|
fVideoControlWindow), node, B_MEDIA_WEB_CHANGED);
|
||||||
fVideoControlWindow->Show();
|
fVideoControlWindow->Show();
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ CodyCam::_SetUpNodes()
|
|||||||
/* find the media roster */
|
/* find the media roster */
|
||||||
fMediaRoster = BMediaRoster::Roster(&status);
|
fMediaRoster = BMediaRoster::Roster(&status);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot find the media roster"), status,
|
ErrorAlert(B_TRANSLATE("Cannot find the media roster"), status,
|
||||||
fWindow);
|
fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -302,11 +302,11 @@ CodyCam::_SetUpNodes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create the video consumer node */
|
/* create the video consumer node */
|
||||||
fVideoConsumer = new VideoConsumer("CodyCam",
|
fVideoConsumer = new VideoConsumer("CodyCam",
|
||||||
((VideoWindow*)fWindow)->VideoView(),
|
((VideoWindow*)fWindow)->VideoView(),
|
||||||
((VideoWindow*)fWindow)->StatusLine(), NULL, 0);
|
((VideoWindow*)fWindow)->StatusLine(), NULL, 0);
|
||||||
if (!fVideoConsumer) {
|
if (!fVideoConsumer) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot create a video window"), B_ERROR,
|
ErrorAlert(B_TRANSLATE("Cannot create a video window"), B_ERROR,
|
||||||
fWindow);
|
fWindow);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ CodyCam::_SetUpNodes()
|
|||||||
/* register the node */
|
/* register the node */
|
||||||
status = fMediaRoster->RegisterNode(fVideoConsumer);
|
status = fMediaRoster->RegisterNode(fVideoConsumer);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot register the video window"), status,
|
ErrorAlert(B_TRANSLATE("Cannot register the video window"), status,
|
||||||
fWindow);
|
fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -322,18 +322,18 @@ CodyCam::_SetUpNodes()
|
|||||||
|
|
||||||
/* find free producer output */
|
/* find free producer output */
|
||||||
int32 cnt = 0;
|
int32 cnt = 0;
|
||||||
status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1,
|
status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1,
|
||||||
&cnt, B_MEDIA_RAW_VIDEO);
|
&cnt, B_MEDIA_RAW_VIDEO);
|
||||||
if (status != B_OK || cnt < 1) {
|
if (status != B_OK || cnt < 1) {
|
||||||
status = B_RESOURCE_UNAVAILABLE;
|
status = B_RESOURCE_UNAVAILABLE;
|
||||||
ErrorAlert(B_TRANSLATE("Cannot find an available video stream"),
|
ErrorAlert(B_TRANSLATE("Cannot find an available video stream"),
|
||||||
status, fWindow);
|
status, fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find free consumer input */
|
/* find free consumer input */
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(),
|
status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(),
|
||||||
&fConsumerIn, 1, &cnt, B_MEDIA_RAW_VIDEO);
|
&fConsumerIn, 1, &cnt, B_MEDIA_RAW_VIDEO);
|
||||||
if (status != B_OK || cnt < 1) {
|
if (status != B_OK || cnt < 1) {
|
||||||
status = B_RESOURCE_UNAVAILABLE;
|
status = B_RESOURCE_UNAVAILABLE;
|
||||||
@@ -350,7 +350,7 @@ CodyCam::_SetUpNodes()
|
|||||||
format.u.raw_video = vid_format;
|
format.u.raw_video = vid_format;
|
||||||
|
|
||||||
/* connect producer to consumer */
|
/* connect producer to consumer */
|
||||||
status = fMediaRoster->Connect(fProducerOut.source,
|
status = fMediaRoster->Connect(fProducerOut.source,
|
||||||
fConsumerIn.destination, &format, &fProducerOut, &fConsumerIn);
|
fConsumerIn.destination, &format, &fProducerOut, &fConsumerIn);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot connect the video source to the video "
|
ErrorAlert(B_TRANSLATE("Cannot connect the video source to the video "
|
||||||
@@ -360,7 +360,7 @@ CodyCam::_SetUpNodes()
|
|||||||
|
|
||||||
|
|
||||||
/* set time sources */
|
/* set time sources */
|
||||||
status = fMediaRoster->SetTimeSourceFor(fProducerNode.node,
|
status = fMediaRoster->SetTimeSourceFor(fProducerNode.node,
|
||||||
fTimeSourceNode.node);
|
fTimeSourceNode.node);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
||||||
@@ -368,7 +368,7 @@ CodyCam::_SetUpNodes()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
|
status = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
|
||||||
fTimeSourceNode.node);
|
fTimeSourceNode.node);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
||||||
@@ -413,7 +413,7 @@ CodyCam::_SetUpNodes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bigtime_t perf = timeSource->PerformanceTimeFor(real + latency
|
bigtime_t perf = timeSource->PerformanceTimeFor(real + latency
|
||||||
+ initLatency);
|
+ initLatency);
|
||||||
timeSource->Release();
|
timeSource->Release();
|
||||||
|
|
||||||
@@ -490,19 +490,19 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type,
|
|||||||
BMenuItem* menuItem;
|
BMenuItem* menuItem;
|
||||||
BMenu* menu = new BMenu(B_TRANSLATE("File"));
|
BMenu* menu = new BMenu(B_TRANSLATE("File"));
|
||||||
|
|
||||||
menuItem = new BMenuItem(B_TRANSLATE("Video settings"),
|
menuItem = new BMenuItem(B_TRANSLATE("Video settings"),
|
||||||
new BMessage(msg_video), 'P');
|
new BMessage(msg_video), 'P');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menuItem = new BMenuItem(B_TRANSLATE("Start video"),
|
menuItem = new BMenuItem(B_TRANSLATE("Start video"),
|
||||||
new BMessage(msg_start), 'A');
|
new BMessage(msg_start), 'A');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menuItem = new BMenuItem(B_TRANSLATE("Stop video"),
|
menuItem = new BMenuItem(B_TRANSLATE("Stop video"),
|
||||||
new BMessage(msg_stop), 'O');
|
new BMessage(msg_stop), 'O');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
@@ -516,7 +516,7 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type,
|
|||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menuItem = new BMenuItem(B_TRANSLATE("Quit"),
|
menuItem = new BMenuItem(B_TRANSLATE("Quit"),
|
||||||
new BMessage(B_QUIT_REQUESTED), 'Q');
|
new BMessage(B_QUIT_REQUESTED), 'Q');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
@@ -812,7 +812,7 @@ VideoWindow::_SetUpSettings(const char* filename, const char* dirname)
|
|||||||
fLoginSetting = new StringValueSetting("Login", "loginID",
|
fLoginSetting = new StringValueSetting("Login", "loginID",
|
||||||
B_TRANSLATE("login ID expected"));
|
B_TRANSLATE("login ID expected"));
|
||||||
|
|
||||||
fPasswordSetting = new StringValueSetting("Password",
|
fPasswordSetting = new StringValueSetting("Password",
|
||||||
B_TRANSLATE("password"), B_TRANSLATE("password expected"));
|
B_TRANSLATE("password"), B_TRANSLATE("password expected"));
|
||||||
|
|
||||||
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
||||||
@@ -832,7 +832,7 @@ VideoWindow::_SetUpSettings(const char* filename, const char* dirname)
|
|||||||
"unrecognized capture rate specified");
|
"unrecognized capture rate specified");
|
||||||
|
|
||||||
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
||||||
B_TRANSLATE("FTP"), &UploadClientAt,
|
B_TRANSLATE("FTP"), &UploadClientAt,
|
||||||
B_TRANSLATE("upload client name expected"),
|
B_TRANSLATE("upload client name expected"),
|
||||||
B_TRANSLATE("unrecognized upload client specified"));
|
B_TRANSLATE("unrecognized upload client specified"));
|
||||||
|
|
||||||
@@ -883,10 +883,10 @@ VideoWindow::_QuitSettings()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ControlWindow::ControlWindow(const BRect& frame, BView* controls,
|
ControlWindow::ControlWindow(const BRect& frame, BView* controls,
|
||||||
media_node node)
|
media_node node)
|
||||||
:
|
:
|
||||||
BWindow(frame, B_TRANSLATE("Video settings"), B_TITLED_WINDOW,
|
BWindow(frame, B_TRANSLATE("Video settings"), B_TITLED_WINDOW,
|
||||||
B_ASYNCHRONOUS_CONTROLS)
|
B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
fView = controls;
|
fView = controls;
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ enum {
|
|||||||
msg_directory = 'drct',
|
msg_directory = 'drct',
|
||||||
msg_passiveftp = 'pasv',
|
msg_passiveftp = 'pasv',
|
||||||
msg_pswrd_text = 'pstx',
|
msg_pswrd_text = 'pstx',
|
||||||
|
|
||||||
msg_start = 'strt',
|
msg_start = 'strt',
|
||||||
msg_stop = 'stop',
|
msg_stop = 'stop',
|
||||||
|
|
||||||
msg_about = 'abut',
|
msg_about = 'abut',
|
||||||
msg_setup = 'setp',
|
msg_setup = 'setp',
|
||||||
msg_video = 'vdeo',
|
msg_video = 'vdeo',
|
||||||
|
|
||||||
msg_control_win = 'ctlw'
|
msg_control_win = 'ctlw'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ FtpClient::ChangeDir(const string& dir)
|
|||||||
string cmd = "CWD ", replyString;
|
string cmd = "CWD ", replyString;
|
||||||
|
|
||||||
cmd += dir;
|
cmd += dir;
|
||||||
|
|
||||||
if (dir.length() == 0)
|
if (dir.length() == 0)
|
||||||
cmd += '/';
|
cmd += '/';
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ FtpClient::ListDirContents(string& listing)
|
|||||||
string cmd, replyString;
|
string cmd, replyString;
|
||||||
int code, codeType, numRead;
|
int code, codeType, numRead;
|
||||||
char buf[513];
|
char buf[513];
|
||||||
|
|
||||||
cmd = "TYPE A";
|
cmd = "TYPE A";
|
||||||
|
|
||||||
if (_SendRequest(cmd))
|
if (_SendRequest(cmd))
|
||||||
_GetReply(replyString, code, codeType);
|
_GetReply(replyString, code, codeType);
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ FtpClient::PrintWorkingDir(string& dir)
|
|||||||
int code, codeType;
|
int code, codeType;
|
||||||
string cmd = "PWD", replyString;
|
string cmd = "PWD", replyString;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
if (_SendRequest(cmd) == true) {
|
if (_SendRequest(cmd) == true) {
|
||||||
if (_GetReply(replyString, code, codeType) == true) {
|
if (_GetReply(replyString, code, codeType) == true) {
|
||||||
if (codeType == 2) {
|
if (codeType == 2) {
|
||||||
@@ -125,10 +125,10 @@ FtpClient::Connect(const string& server, const string& login, const string& pass
|
|||||||
int code, codeType;
|
int code, codeType;
|
||||||
string cmd, replyString;
|
string cmd, replyString;
|
||||||
BNetAddress addr;
|
BNetAddress addr;
|
||||||
|
|
||||||
delete fControl;
|
delete fControl;
|
||||||
delete fData;
|
delete fData;
|
||||||
|
|
||||||
fControl = new BNetEndpoint;
|
fControl = new BNetEndpoint;
|
||||||
|
|
||||||
if (fControl->InitCheck() != B_NO_ERROR)
|
if (fControl->InitCheck() != B_NO_ERROR)
|
||||||
@@ -137,7 +137,7 @@ FtpClient::Connect(const string& server, const string& login, const string& pass
|
|||||||
addr.SetTo(server.c_str(), "tcp", "ftp");
|
addr.SetTo(server.c_str(), "tcp", "ftp");
|
||||||
if (fControl->Connect(addr) == B_NO_ERROR) {
|
if (fControl->Connect(addr) == B_NO_ERROR) {
|
||||||
// read the welcome message, do the login
|
// read the welcome message, do the login
|
||||||
|
|
||||||
if (_GetReply(replyString, code, codeType)) {
|
if (_GetReply(replyString, code, codeType)) {
|
||||||
if (code != 421 && codeType != 5) {
|
if (code != 421 && codeType != 5) {
|
||||||
cmd = "USER ";
|
cmd = "USER ";
|
||||||
@@ -146,8 +146,8 @@ FtpClient::Connect(const string& server, const string& login, const string& pass
|
|||||||
|
|
||||||
if (_GetReply(replyString, code, codeType)) {
|
if (_GetReply(replyString, code, codeType)) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 230:
|
case 230:
|
||||||
case 202:
|
case 202:
|
||||||
rc = true;
|
rc = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -163,12 +163,12 @@ FtpClient::Connect(const string& server, const string& login, const string& pass
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc == true)
|
if (rc == true)
|
||||||
_SetState(ftp_connected);
|
_SetState(ftp_connected);
|
||||||
@@ -189,7 +189,7 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
int code, codeType, rlen, slen, i;
|
int code, codeType, rlen, slen, i;
|
||||||
BFile infile(local.c_str(), B_READ_ONLY);
|
BFile infile(local.c_str(), B_READ_ONLY);
|
||||||
char buf[8192], sbuf[16384], *stmp;
|
char buf[8192], sbuf[16384], *stmp;
|
||||||
|
|
||||||
if (infile.InitCheck() != B_NO_ERROR)
|
if (infile.InitCheck() != B_NO_ERROR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
cmd = "TYPE I";
|
cmd = "TYPE I";
|
||||||
else
|
else
|
||||||
cmd = "TYPE A";
|
cmd = "TYPE A";
|
||||||
|
|
||||||
if (_SendRequest(cmd))
|
if (_SendRequest(cmd))
|
||||||
_GetReply(replyString, code, codeType);
|
_GetReply(replyString, code, codeType);
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
throw "bail";
|
throw "bail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +247,7 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
catch(const char* errorString)
|
catch(const char* errorString)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fData;
|
delete fData;
|
||||||
@@ -257,7 +257,7 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
_GetReply(replyString, code, codeType);
|
_GetReply(replyString, code, codeType);
|
||||||
rc = codeType <= 2;
|
rc = codeType <= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ FtpClient::GetFile(const string& remote, const string& local, ftp_mode mode)
|
|||||||
if (_OpenDataConnection()) {
|
if (_OpenDataConnection()) {
|
||||||
cmd = "RETR ";
|
cmd = "RETR ";
|
||||||
cmd += remote;
|
cmd += remote;
|
||||||
|
|
||||||
if (_SendRequest(cmd)) {
|
if (_SendRequest(cmd)) {
|
||||||
if (_GetReply(replyString, code, codeType)) {
|
if (_GetReply(replyString, code, codeType)) {
|
||||||
if (codeType <= 2) {
|
if (codeType <= 2) {
|
||||||
@@ -297,7 +297,7 @@ FtpClient::GetFile(const string& remote, const string& local, ftp_mode mode)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
memset(sbuf, 0, sizeof(sbuf));
|
memset(sbuf, 0, sizeof(sbuf));
|
||||||
rlen = fData->Receive(buf, sizeof(buf));
|
rlen = fData->Receive(buf, sizeof(buf));
|
||||||
|
|
||||||
if (rlen > 0) {
|
if (rlen > 0) {
|
||||||
|
|
||||||
slen = rlen;
|
slen = rlen;
|
||||||
@@ -317,7 +317,7 @@ FtpClient::GetFile(const string& remote, const string& local, ftp_mode mode)
|
|||||||
|
|
||||||
if (slen > 0) {
|
if (slen > 0) {
|
||||||
if (outfile.Write(stmp, slen) < 0)
|
if (outfile.Write(stmp, slen) < 0)
|
||||||
writeError = true;
|
writeError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,8 +329,8 @@ FtpClient::GetFile(const string& remote, const string& local, ftp_mode mode)
|
|||||||
|
|
||||||
delete fData;
|
delete fData;
|
||||||
fData = 0;
|
fData = 0;
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
_GetReply(replyString, code, codeType);
|
_GetReply(replyString, code, codeType);
|
||||||
rc = (codeType <= 2 && writeError == false);
|
rc = (codeType <= 2 && writeError == false);
|
||||||
}
|
}
|
||||||
@@ -378,7 +378,7 @@ FtpClient::Chmod(const string& path, const string& mod)
|
|||||||
cmd += mod;
|
cmd += mod;
|
||||||
cmd += " ";
|
cmd += " ";
|
||||||
cmd += path;
|
cmd += path;
|
||||||
|
|
||||||
if (path.length() == 0)
|
if (path.length() == 0)
|
||||||
cmd += '/';
|
cmd += '/';
|
||||||
printf(B_TRANSLATE("cmd: '%s'\n"), cmd.c_str());
|
printf(B_TRANSLATE("cmd: '%s'\n"), cmd.c_str());
|
||||||
@@ -429,7 +429,7 @@ FtpClient::_SendRequest(const string& cmd)
|
|||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
string ccmd = cmd;
|
string ccmd = cmd;
|
||||||
|
|
||||||
if (fControl != 0) {
|
if (fControl != 0) {
|
||||||
if (cmd.find("PASS") != string::npos)
|
if (cmd.find("PASS") != string::npos)
|
||||||
printf(B_TRANSLATE("PASS <suppressed> (real password sent)\n"));
|
printf(B_TRANSLATE("PASS <suppressed> (real password sent)\n"));
|
||||||
@@ -440,7 +440,7 @@ FtpClient::_SendRequest(const string& cmd)
|
|||||||
if (fControl->Send(ccmd.c_str(), ccmd.length()) >= 0)
|
if (fControl->Send(ccmd.c_str(), ccmd.length()) >= 0)
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ FtpClient::_GetReplyLine(string& line)
|
|||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
line = ""; // Thanks to Stephen van Egmond for catching a bug here
|
line = ""; // Thanks to Stephen van Egmond for catching a bug here
|
||||||
|
|
||||||
if (fControl != 0) {
|
if (fControl != 0) {
|
||||||
rc = true;
|
rc = true;
|
||||||
while (done == false && fControl->Receive(&c, 1) > 0) {
|
while (done == false && fControl->Receive(&c, 1) > 0) {
|
||||||
@@ -482,12 +482,12 @@ FtpClient::_GetReplyLine(string& line)
|
|||||||
treply[2] = c;
|
treply[2] = c;
|
||||||
fControl->Send(treply, 3);
|
fControl->Send(treply, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOF:
|
case EOF:
|
||||||
case xEOF:
|
case xEOF:
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
line += c;
|
line += c;
|
||||||
break;
|
break;
|
||||||
@@ -498,9 +498,9 @@ FtpClient::_GetReplyLine(string& line)
|
|||||||
line += c;
|
line += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,11 +510,11 @@ FtpClient::_GetReply(string& outString, int& outCode, int& codeType)
|
|||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
string line, tempString;
|
string line, tempString;
|
||||||
|
|
||||||
//
|
//
|
||||||
// comment from the ncftp source:
|
// comment from the ncftp source:
|
||||||
//
|
//
|
||||||
|
|
||||||
/* RFC 959 states that a reply may span multiple lines. A single
|
/* RFC 959 states that a reply may span multiple lines. A single
|
||||||
* line message would have the 3-digit code <space> then the msg.
|
* line message would have the 3-digit code <space> then the msg.
|
||||||
* A multi-line message would have the code <dash> and the first
|
* A multi-line message would have the code <dash> and the first
|
||||||
@@ -534,10 +534,10 @@ FtpClient::_GetReply(string& outString, int& outCode, int& codeType)
|
|||||||
printf(outString.c_str());
|
printf(outString.c_str());
|
||||||
tempString = line.substr(0, 3);
|
tempString = line.substr(0, 3);
|
||||||
outCode = atoi(tempString.c_str());
|
outCode = atoi(tempString.c_str());
|
||||||
|
|
||||||
if (line[3] == '-') {
|
if (line[3] == '-') {
|
||||||
while ((rc = _GetReplyLine(line)) == true) {
|
while ((rc = _GetReplyLine(line)) == true) {
|
||||||
outString += line;
|
outString += line;
|
||||||
outString += '\n';
|
outString += '\n';
|
||||||
printf(outString.c_str());
|
printf(outString.c_str());
|
||||||
// we're done with nnn when we get to a "nnn blahblahblah"
|
// we're done with nnn when we get to a "nnn blahblahblah"
|
||||||
@@ -546,20 +546,20 @@ FtpClient::_GetReply(string& outString, int& outCode, int& codeType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rc && outCode != 421) {
|
if (!rc && outCode != 421) {
|
||||||
outString += B_TRANSLATE("Remote host has closed the connection.\n");
|
outString += B_TRANSLATE("Remote host has closed the connection.\n");
|
||||||
outCode = 421;
|
outCode = 421;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outCode == 421) {
|
if (outCode == 421) {
|
||||||
delete fControl;
|
delete fControl;
|
||||||
fControl = 0;
|
fControl = 0;
|
||||||
_ClearState(ftp_connected);
|
_ClearState(ftp_connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
codeType = outCode / 100;
|
codeType = outCode / 100;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,12 +573,12 @@ FtpClient::_OpenDataConnection()
|
|||||||
int i, code, codeType;
|
int i, code, codeType;
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
|
|
||||||
delete fData;
|
delete fData;
|
||||||
fData = 0;
|
fData = 0;
|
||||||
|
|
||||||
fData = new BNetEndpoint;
|
fData = new BNetEndpoint;
|
||||||
|
|
||||||
if (_TestState(ftp_passive)) {
|
if (_TestState(ftp_passive)) {
|
||||||
// Here we send a "pasv" command and connect to the remote server
|
// Here we send a "pasv" command and connect to the remote server
|
||||||
// on the port it sends back to us
|
// on the port it sends back to us
|
||||||
@@ -597,7 +597,7 @@ FtpClient::_OpenDataConnection()
|
|||||||
|
|
||||||
replyString = replyString.substr(i, replyString.find(')') - i);
|
replyString = replyString.substr(i, replyString.find(')') - i);
|
||||||
if (sscanf(replyString.c_str(), "%d,%d,%d,%d,%d,%d",
|
if (sscanf(replyString.c_str(), "%d,%d,%d,%d,%d,%d",
|
||||||
&paddr[0], &paddr[1], &paddr[2], &paddr[3],
|
&paddr[0], &paddr[1], &paddr[2], &paddr[3],
|
||||||
&paddr[4], &paddr[5]) != 6) {
|
&paddr[4], &paddr[5]) != 6) {
|
||||||
// cannot do passive. Do a little harmless rercursion here
|
// cannot do passive. Do a little harmless rercursion here
|
||||||
_ClearState(ftp_passive);
|
_ClearState(ftp_passive);
|
||||||
@@ -649,7 +649,7 @@ FtpClient::_OpenDataConnection()
|
|||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,19 +660,19 @@ FtpClient::_AcceptDataConnection()
|
|||||||
BNetEndpoint* endPoint;
|
BNetEndpoint* endPoint;
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
|
|
||||||
if (_TestState(ftp_passive) == false) {
|
if (_TestState(ftp_passive) == false) {
|
||||||
if (fData != 0) {
|
if (fData != 0) {
|
||||||
endPoint = fData->Accept();
|
endPoint = fData->Accept();
|
||||||
if (endPoint != 0) {
|
if (endPoint != 0) {
|
||||||
delete fData;
|
delete fData;
|
||||||
fData = endPoint;
|
fData = endPoint;
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rc = true;
|
rc = true;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ using std::string;
|
|||||||
/*
|
/*
|
||||||
* Definitions for the TELNET protocol. Snarfed from the BSD source.
|
* Definitions for the TELNET protocol. Snarfed from the BSD source.
|
||||||
*/
|
*/
|
||||||
#define IAC 255
|
#define IAC 255
|
||||||
#define DONT 254
|
#define DONT 254
|
||||||
#define DO 253
|
#define DO 253
|
||||||
#define WONT 252
|
#define WONT 252
|
||||||
#define WILL 251
|
#define WILL 251
|
||||||
#define xEOF 236
|
#define xEOF 236
|
||||||
|
|
||||||
|
|
||||||
class FtpClient : public FileUploadClient {
|
class FtpClient : public FileUploadClient {
|
||||||
@@ -44,7 +44,7 @@ class FtpClient : public FileUploadClient {
|
|||||||
bool Chmod(const string& path, const string& mod);
|
bool Chmod(const string& path, const string& mod);
|
||||||
|
|
||||||
void SetPassive(bool on);
|
void SetPassive(bool on);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
ftp_complete = 1UL,
|
ftp_complete = 1UL,
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ StringValueSetting::~StringValueSetting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StringValueSetting::ValueChanged(const char* newValue)
|
StringValueSetting::ValueChanged(const char* newValue)
|
||||||
{
|
{
|
||||||
if (newValue == fValue)
|
if (newValue == fValue)
|
||||||
// guard against self assingment
|
// guard against self assingment
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(fValue);
|
free(fValue);
|
||||||
fValue = strdup(newValue);
|
fValue = strdup(newValue);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ StringValueSetting::Value() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StringValueSetting::SaveSettingValue(Settings* settings)
|
StringValueSetting::SaveSettingValue(Settings* settings)
|
||||||
{
|
{
|
||||||
printf("-----StringValueSetting::SaveSettingValue %s %s\n", Name(), fValue);
|
printf("-----StringValueSetting::SaveSettingValue %s %s\n", Name(), fValue);
|
||||||
@@ -62,7 +62,7 @@ StringValueSetting::SaveSettingValue(Settings* settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringValueSetting::NeedsSaving() const
|
StringValueSetting::NeedsSaving() const
|
||||||
{
|
{
|
||||||
// needs saving if different than default
|
// needs saving if different than default
|
||||||
@@ -73,10 +73,10 @@ StringValueSetting::NeedsSaving() const
|
|||||||
const char*
|
const char*
|
||||||
StringValueSetting::Handle(const char *const *argv)
|
StringValueSetting::Handle(const char *const *argv)
|
||||||
{
|
{
|
||||||
if (!*++argv)
|
if (!*++argv)
|
||||||
return fValueExpectedErrorString;
|
return fValueExpectedErrorString;
|
||||||
|
|
||||||
ValueChanged(*argv);
|
ValueChanged(*argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ EnumeratedStringValueSetting::EnumeratedStringValueSetting(const char* name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EnumeratedStringValueSetting::ValueChanged(const char* newValue)
|
EnumeratedStringValueSetting::ValueChanged(const char* newValue)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -110,14 +110,14 @@ EnumeratedStringValueSetting::ValueChanged(const char* newValue)
|
|||||||
const char*
|
const char*
|
||||||
EnumeratedStringValueSetting::Handle(const char *const *argv)
|
EnumeratedStringValueSetting::Handle(const char *const *argv)
|
||||||
{
|
{
|
||||||
if (!*++argv)
|
if (!*++argv)
|
||||||
return fValueExpectedErrorString;
|
return fValueExpectedErrorString;
|
||||||
|
|
||||||
printf("---EnumeratedStringValueSetting::Handle %s %s\n", *(argv-1), *argv);
|
printf("---EnumeratedStringValueSetting::Handle %s %s\n", *(argv-1), *argv);
|
||||||
if (!_ValidateString(*argv))
|
if (!_ValidateString(*argv))
|
||||||
return fWrongValueErrorString;
|
return fWrongValueErrorString;
|
||||||
|
|
||||||
ValueChanged(*argv);
|
ValueChanged(*argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ ScalarValueSetting::~ScalarValueSetting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScalarValueSetting::ValueChanged(int32 newValue)
|
ScalarValueSetting::ValueChanged(int32 newValue)
|
||||||
{
|
{
|
||||||
ASSERT(newValue > fMin);
|
ASSERT(newValue > fMin);
|
||||||
@@ -174,7 +174,7 @@ ScalarValueSetting::Value() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScalarValueSetting::GetValueAsString(char* buffer) const
|
ScalarValueSetting::GetValueAsString(char* buffer) const
|
||||||
{
|
{
|
||||||
sprintf(buffer, "%ld", fValue);
|
sprintf(buffer, "%ld", fValue);
|
||||||
@@ -184,26 +184,26 @@ ScalarValueSetting::GetValueAsString(char* buffer) const
|
|||||||
const char*
|
const char*
|
||||||
ScalarValueSetting::Handle(const char *const *argv)
|
ScalarValueSetting::Handle(const char *const *argv)
|
||||||
{
|
{
|
||||||
if (!*++argv)
|
if (!*++argv)
|
||||||
return fValueExpectedErrorString;
|
return fValueExpectedErrorString;
|
||||||
|
|
||||||
int32 newValue = atoi(*argv);
|
int32 newValue = atoi(*argv);
|
||||||
if (newValue < fMin || newValue > fMax)
|
if (newValue < fMin || newValue > fMax)
|
||||||
return fWrongValueErrorString;
|
return fWrongValueErrorString;
|
||||||
|
|
||||||
fValue = newValue;
|
fValue = newValue;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ScalarValueSetting::SaveSettingValue(Settings* settings)
|
ScalarValueSetting::SaveSettingValue(Settings* settings)
|
||||||
{
|
{
|
||||||
settings->Write("%d", fValue);
|
settings->Write("%d", fValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ScalarValueSetting::NeedsSaving() const
|
ScalarValueSetting::NeedsSaving() const
|
||||||
{
|
{
|
||||||
return fValue != fDefaultValue;
|
return fValue != fDefaultValue;
|
||||||
@@ -224,7 +224,7 @@ BooleanValueSetting::~BooleanValueSetting()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BooleanValueSetting::Value() const
|
BooleanValueSetting::Value() const
|
||||||
{
|
{
|
||||||
return fValue;
|
return fValue;
|
||||||
@@ -252,7 +252,7 @@ BooleanValueSetting::Handle(const char *const *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BooleanValueSetting::SaveSettingValue(Settings* settings)
|
BooleanValueSetting::SaveSettingValue(Settings* settings)
|
||||||
{
|
{
|
||||||
settings->Write(fValue ? "on" : "off");
|
settings->Write(fValue ? "on" : "off");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class StringValueSetting : public SettingsArgvDispatcher {
|
|||||||
// simple string setting
|
// simple string setting
|
||||||
public:
|
public:
|
||||||
StringValueSetting(const char* name,
|
StringValueSetting(const char* name,
|
||||||
const char* defaultValue,
|
const char* defaultValue,
|
||||||
const char* valueExpectedErrorString,
|
const char* valueExpectedErrorString,
|
||||||
const char* wrongValueErrorString = "");
|
const char* wrongValueErrorString = "");
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
void ValueChanged(const char* newValue);
|
void ValueChanged(const char* newValue);
|
||||||
const char* Value() const;
|
const char* Value() const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings*);
|
virtual void SaveSettingValue(Settings*);
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
const char* wrongValueErrorString);
|
const char* wrongValueErrorString);
|
||||||
|
|
||||||
void ValueChanged(const char* newValue);
|
void ValueChanged(const char* newValue);
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _ValidateString(const char* string);
|
bool _ValidateString(const char* string);
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
void ValueChanged(int32 newValue);
|
void ValueChanged(int32 newValue);
|
||||||
int32 Value() const;
|
int32 Value() const;
|
||||||
void GetValueAsString(char*) const;
|
void GetValueAsString(char*) const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings*);
|
virtual void SaveSettingValue(Settings*);
|
||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
virtual ~BooleanValueSetting();
|
virtual ~BooleanValueSetting();
|
||||||
|
|
||||||
bool Value() const;
|
bool Value() const;
|
||||||
virtual const char* Handle(const char *const *argv);
|
virtual const char* Handle(const char *const *argv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SaveSettingValue(Settings *);
|
virtual void SaveSettingValue(Settings *);
|
||||||
|
|||||||
@@ -82,18 +82,18 @@ ArgvParser::~ArgvParser()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArgvParser::MakeArgvEmpty()
|
ArgvParser::MakeArgvEmpty()
|
||||||
{
|
{
|
||||||
// done with current argv, free it up
|
// done with current argv, free it up
|
||||||
for (int32 index = 0; index < fArgc; index++)
|
for (int32 index = 0; index < fArgc; index++)
|
||||||
delete fCurrentArgv[index];
|
delete fCurrentArgv[index];
|
||||||
|
|
||||||
fArgc = 0;
|
fArgc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
|
ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
|
||||||
{
|
{
|
||||||
if (fArgc) {
|
if (fArgc) {
|
||||||
@@ -111,7 +111,7 @@ ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArgvParser::NextArgv()
|
ArgvParser::NextArgv()
|
||||||
{
|
{
|
||||||
if (fSawBackslash) {
|
if (fSawBackslash) {
|
||||||
@@ -120,7 +120,7 @@ ArgvParser::NextArgv()
|
|||||||
}
|
}
|
||||||
fCurrentArgs[++fCurrentArgsPos] = '\0';
|
fCurrentArgs[++fCurrentArgsPos] = '\0';
|
||||||
// terminate current arg pos
|
// terminate current arg pos
|
||||||
|
|
||||||
// copy it as a string to the current argv slot
|
// copy it as a string to the current argv slot
|
||||||
fCurrentArgv[fArgc] = new char [strlen(fCurrentArgs) + 1];
|
fCurrentArgv[fArgc] = new char [strlen(fCurrentArgs) + 1];
|
||||||
strcpy(fCurrentArgv[fArgc], fCurrentArgs);
|
strcpy(fCurrentArgv[fArgc], fCurrentArgs);
|
||||||
@@ -129,7 +129,7 @@ ArgvParser::NextArgv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ArgvParser::NextArgvIfNotEmpty()
|
ArgvParser::NextArgvIfNotEmpty()
|
||||||
{
|
{
|
||||||
if (!fSawBackslash && fCurrentArgsPos < 0)
|
if (!fSawBackslash && fCurrentArgsPos < 0)
|
||||||
@@ -139,7 +139,7 @@ ArgvParser::NextArgvIfNotEmpty()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char
|
char
|
||||||
ArgvParser::GetCh()
|
ArgvParser::GetCh()
|
||||||
{
|
{
|
||||||
if (fPos < 0 || fBuffer[fPos] == 0) {
|
if (fPos < 0 || fBuffer[fPos] == 0) {
|
||||||
@@ -153,8 +153,8 @@ ArgvParser::GetCh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
|
ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
|
||||||
void* passThru)
|
void* passThru)
|
||||||
{
|
{
|
||||||
ArgvParser parser(name);
|
ArgvParser parser(name);
|
||||||
@@ -162,7 +162,7 @@ ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
||||||
void* passThru)
|
void* passThru)
|
||||||
{
|
{
|
||||||
@@ -191,7 +191,7 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
|||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fLineNo++;
|
fLineNo++;
|
||||||
if (fSawBackslash) {
|
if (fSawBackslash) {
|
||||||
fSawBackslash = false;
|
fSawBackslash = false;
|
||||||
continue;
|
continue;
|
||||||
@@ -202,7 +202,7 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
|||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fEatComment)
|
if (fEatComment)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ SettingsArgvDispatcher::SettingsArgvDispatcher(const char* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
|
SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
|
||||||
{
|
{
|
||||||
if (!onlyIfNonDefault || NeedsSaving()) {
|
if (!onlyIfNonDefault || NeedsSaving()) {
|
||||||
@@ -271,7 +271,7 @@ SettingsArgvDispatcher::SaveSettings(Settings* settings, bool onlyIfNonDefault)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const *argv,
|
SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const *argv,
|
||||||
bool printError)
|
bool printError)
|
||||||
{
|
{
|
||||||
@@ -303,7 +303,7 @@ SettingsArgvDispatcher::HandleRectValue(BRect &result, const char* const *argv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SettingsArgvDispatcher::WriteRectValue(Settings* setting, BRect rect)
|
SettingsArgvDispatcher::WriteRectValue(Settings* setting, BRect rect)
|
||||||
{
|
{
|
||||||
setting->Write("%d %d %d %d", (int32)rect.left, (int32)rect.top,
|
setting->Write("%d %d %d %d", (int32)rect.left, (int32)rect.top,
|
||||||
@@ -340,7 +340,7 @@ Settings::~Settings()
|
|||||||
{
|
{
|
||||||
for (int32 index = 0; index < fCount; index++)
|
for (int32 index = 0; index < fCount; index++)
|
||||||
delete fList[index];
|
delete fList[index];
|
||||||
|
|
||||||
free(fList);
|
free(fList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ Settings::TryReadingSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::SaveSettings(bool onlyIfNonDefault)
|
Settings::SaveSettings(bool onlyIfNonDefault)
|
||||||
{
|
{
|
||||||
ASSERT(SettingsHandler());
|
ASSERT(SettingsHandler());
|
||||||
@@ -418,13 +418,13 @@ Settings::SaveSettings(bool onlyIfNonDefault)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::_MakeSettingsDirectory(BDirectory *resultingSettingsDir)
|
Settings::_MakeSettingsDirectory(BDirectory *resultingSettingsDir)
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// make sure there is a directory
|
// make sure there is a directory
|
||||||
path.Append(fSettingsDir);
|
path.Append(fSettingsDir);
|
||||||
mkdir(path.Path(), 0777);
|
mkdir(path.Path(), 0777);
|
||||||
@@ -432,7 +432,7 @@ Settings::_MakeSettingsDirectory(BDirectory *resultingSettingsDir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::_SaveCurrentSettings(bool onlyIfNonDefault)
|
Settings::_SaveCurrentSettings(bool onlyIfNonDefault)
|
||||||
{
|
{
|
||||||
BDirectory fSettingsDir;
|
BDirectory fSettingsDir;
|
||||||
@@ -445,7 +445,7 @@ Settings::_SaveCurrentSettings(bool onlyIfNonDefault)
|
|||||||
// nuke old settings
|
// nuke old settings
|
||||||
BEntry entry(&fSettingsDir, fFileName);
|
BEntry entry(&fSettingsDir, fFileName);
|
||||||
entry.Remove();
|
entry.Remove();
|
||||||
|
|
||||||
BFile prefs(&entry, O_RDWR | O_CREAT);
|
BFile prefs(&entry, O_RDWR | O_CREAT);
|
||||||
if (prefs.InitCheck() != B_OK)
|
if (prefs.InitCheck() != B_OK)
|
||||||
return;
|
return;
|
||||||
@@ -459,7 +459,7 @@ Settings::_SaveCurrentSettings(bool onlyIfNonDefault)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::Write(const char* format, ...)
|
Settings::Write(const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
@@ -470,7 +470,7 @@ Settings::Write(const char* format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::VSWrite(const char* format, va_list arg)
|
Settings::VSWrite(const char* format, va_list arg)
|
||||||
{
|
{
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class SettingsArgvDispatcher {
|
|||||||
virtual ~SettingsArgvDispatcher() {};
|
virtual ~SettingsArgvDispatcher() {};
|
||||||
|
|
||||||
void SaveSettings(Settings* settings, bool onlyIfNonDefault);
|
void SaveSettings(Settings* settings, bool onlyIfNonDefault);
|
||||||
|
|
||||||
const char* Name() const
|
const char* Name() const
|
||||||
{
|
{
|
||||||
return fName;
|
return fName;
|
||||||
@@ -85,7 +85,7 @@ class SettingsArgvDispatcher {
|
|||||||
// override this adding an argv parser that reads in the
|
// override this adding an argv parser that reads in the
|
||||||
// values in argv format for this setting
|
// values in argv format for this setting
|
||||||
// return a pointer to an error message or null if parsed OK
|
// return a pointer to an error message or null if parsed OK
|
||||||
|
|
||||||
bool HandleRectValue(BRect&, const char* const *argv,
|
bool HandleRectValue(BRect&, const char* const *argv,
|
||||||
bool printError = true);
|
bool printError = true);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ SftpClient::PrintWorkingDir(string& dir)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SftpClient::Connect(const string& server, const string& login,
|
SftpClient::Connect(const string& server, const string& login,
|
||||||
const string& passwd)
|
const string& passwd)
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
@@ -88,7 +88,7 @@ SftpClient::Connect(const string& server, const string& login,
|
|||||||
rc = SpawningUploadClient::Connect(server, login, passwd);
|
rc = SpawningUploadClient::Connect(server, login, passwd);
|
||||||
BString reply;
|
BString reply;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, _GetLongReadText(), len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
@@ -96,7 +96,7 @@ SftpClient::Connect(const string& server, const string& login,
|
|||||||
fprintf(stderr, _GetReplyText(), reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("Connecting to ") != 0)
|
if (reply.FindFirst("Connecting to ") != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, _GetLongReadText(), len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
@@ -104,10 +104,10 @@ SftpClient::Connect(const string& server, const string& login,
|
|||||||
fprintf(stderr, _GetReplyText(), reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst(/*[pP]*/"assword:") < 0)
|
if (reply.FindFirst(/*[pP]*/"assword:") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
write(OutputPipe(), passwd.c_str(), strlen(passwd.c_str()));
|
write(OutputPipe(), passwd.c_str(), strlen(passwd.c_str()));
|
||||||
write(OutputPipe(), "\n", 1);
|
write(OutputPipe(), "\n", 1);
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, _GetLongReadText(), len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
@@ -115,7 +115,7 @@ SftpClient::Connect(const string& server, const string& login,
|
|||||||
fprintf(stderr, _GetReplyText(), reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply != "\n")
|
if (reply != "\n")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, _GetLongReadText(), len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
@@ -175,7 +175,7 @@ SftpClient::MoveFile(const string& oldPath, const string& newPath)
|
|||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
// sftpd can't rename to an existing file...
|
// sftpd can't rename to an existing file...
|
||||||
BString cmd("rm");
|
BString cmd("rm");
|
||||||
cmd << " " << newPath.c_str() << "\n";
|
cmd << " " << newPath.c_str() << "\n";
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
bool Chmod(const string& path, const string& mod);
|
bool Chmod(const string& path, const string& mod);
|
||||||
|
|
||||||
void SetPassive(bool on);
|
void SetPassive(bool on);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* _GetLongReadText() const;
|
const char* _GetLongReadText() const;
|
||||||
const char* _GetReadText() const;
|
const char* _GetReadText() const;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ SpawningUploadClient::getpty(char *pty, char *tty)
|
|||||||
static const char minor[] = "0123456789abcdef";
|
static const char minor[] = "0123456789abcdef";
|
||||||
uint32 i, j;
|
uint32 i, j;
|
||||||
int32 fd = -1;
|
int32 fd = -1;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(major); i++)
|
for (i = 0; i < sizeof(major); i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < sizeof(minor); j++)
|
for (j = 0; j < sizeof(minor); j++)
|
||||||
@@ -125,7 +125,7 @@ SpawningUploadClient::getpty(char *pty, char *tty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ const media_raw_video_format vid_format = {29.97, 1, 0, 239,
|
|||||||
B_VIDEO_TOP_LEFT_RIGHT, 1, 1, {B_RGB16, 320, 240, 320 * 4, 0, 0}};
|
B_VIDEO_TOP_LEFT_RIGHT, 1, 1, {B_RGB16, 320, 240, 320 * 4, 0, 0}};
|
||||||
|
|
||||||
|
|
||||||
VideoConsumer::VideoConsumer(const char* name, BView* view,
|
VideoConsumer::VideoConsumer(const char* name, BView* view,
|
||||||
BStringView* statusLine,
|
BStringView* statusLine,
|
||||||
BMediaAddOn* addon, const uint32 internalId)
|
BMediaAddOn* addon, const uint32 internalId)
|
||||||
: BMediaNode(name),
|
: BMediaNode(name),
|
||||||
BMediaEventLooper(),
|
BMediaEventLooper(),
|
||||||
BBufferConsumer(B_MEDIA_RAW_VIDEO),
|
BBufferConsumer(B_MEDIA_RAW_VIDEO),
|
||||||
fStatusLine(statusLine),
|
fStatusLine(statusLine),
|
||||||
fInternalID(internalId),
|
fInternalID(internalId),
|
||||||
@@ -72,7 +72,7 @@ VideoConsumer::VideoConsumer(const char* name, BView* view,
|
|||||||
AddNodeKind(B_PHYSICAL_OUTPUT);
|
AddNodeKind(B_PHYSICAL_OUTPUT);
|
||||||
SetEventLatency(0);
|
SetEventLatency(0);
|
||||||
fWindow = fView->Window();
|
fWindow = fView->Window();
|
||||||
|
|
||||||
for (uint32 j = 0; j < 3; j++) {
|
for (uint32 j = 0; j < 3; j++) {
|
||||||
fBitmap[j] = NULL;
|
fBitmap[j] = NULL;
|
||||||
fBufferMap[j] = 0;
|
fBufferMap[j] = 0;
|
||||||
@@ -91,7 +91,7 @@ VideoConsumer::VideoConsumer(const char* name, BView* view,
|
|||||||
VideoConsumer::~VideoConsumer()
|
VideoConsumer::~VideoConsumer()
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::~VideoConsumer\n");
|
FUNCTION("VideoConsumer::~VideoConsumer\n");
|
||||||
|
|
||||||
Quit();
|
Quit();
|
||||||
|
|
||||||
if (fWindow) {
|
if (fWindow) {
|
||||||
@@ -110,12 +110,12 @@ VideoConsumer::~VideoConsumer()
|
|||||||
snooze(1000000);
|
snooze(1000000);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 30)
|
if (count == 30)
|
||||||
kill_thread(fFtpThread);
|
kill_thread(fFtpThread);
|
||||||
|
|
||||||
DeleteBuffers();
|
DeleteBuffers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
@@ -136,35 +136,35 @@ VideoConsumer::AddOn(long* cookie) const
|
|||||||
// This implementation is required to get around a bug in
|
// This implementation is required to get around a bug in
|
||||||
// the ppc compiler.
|
// the ppc compiler.
|
||||||
|
|
||||||
void
|
void
|
||||||
VideoConsumer::Start(bigtime_t performanceTime)
|
VideoConsumer::Start(bigtime_t performanceTime)
|
||||||
{
|
{
|
||||||
BMediaEventLooper::Start(performanceTime);
|
BMediaEventLooper::Start(performanceTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VideoConsumer::Stop(bigtime_t performanceTime, bool immediate)
|
VideoConsumer::Stop(bigtime_t performanceTime, bool immediate)
|
||||||
{
|
{
|
||||||
BMediaEventLooper::Stop(performanceTime, immediate);
|
BMediaEventLooper::Stop(performanceTime, immediate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VideoConsumer::Seek(bigtime_t mediaTime, bigtime_t performanceTime)
|
VideoConsumer::Seek(bigtime_t mediaTime, bigtime_t performanceTime)
|
||||||
{
|
{
|
||||||
BMediaEventLooper::Seek(mediaTime, performanceTime);
|
BMediaEventLooper::Seek(mediaTime, performanceTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VideoConsumer::TimeWarp(bigtime_t atRealTime, bigtime_t toPerformanceTime)
|
VideoConsumer::TimeWarp(bigtime_t atRealTime, bigtime_t toPerformanceTime)
|
||||||
{
|
{
|
||||||
BMediaEventLooper::TimeWarp(atRealTime, toPerformanceTime);
|
BMediaEventLooper::TimeWarp(atRealTime, toPerformanceTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VideoConsumer::DeleteHook(BMediaNode* node)
|
VideoConsumer::DeleteHook(BMediaNode* node)
|
||||||
{
|
{
|
||||||
return BMediaEventLooper::DeleteHook(node);
|
return BMediaEventLooper::DeleteHook(node);
|
||||||
@@ -235,7 +235,7 @@ VideoConsumer::HandleMessage(int32 message, const void* data, size_t size)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ VideoConsumer::ProducerDataStatus(const media_destination& forWhom, int32 status
|
|||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::ProducerDataStatus\n");
|
FUNCTION("VideoConsumer::ProducerDataStatus\n");
|
||||||
|
|
||||||
if (forWhom != fIn.destination)
|
if (forWhom != fIn.destination)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,14 +272,14 @@ VideoConsumer::CreateBuffers(const media_format& withFormat)
|
|||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::CreateBuffers\n");
|
FUNCTION("VideoConsumer::CreateBuffers\n");
|
||||||
|
|
||||||
DeleteBuffers();
|
DeleteBuffers();
|
||||||
// delete any old buffers
|
// delete any old buffers
|
||||||
|
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
// create a buffer group
|
// create a buffer group
|
||||||
uint32 xSize = withFormat.u.raw_video.display.line_width;
|
uint32 xSize = withFormat.u.raw_video.display.line_width;
|
||||||
uint32 ySize = withFormat.u.raw_video.display.line_count;
|
uint32 ySize = withFormat.u.raw_video.display.line_count;
|
||||||
color_space colorspace = withFormat.u.raw_video.display.format;
|
color_space colorspace = withFormat.u.raw_video.display.format;
|
||||||
PROGRESS("VideoConsumer::CreateBuffers - Colorspace = %d\n", colorspace);
|
PROGRESS("VideoConsumer::CreateBuffers - Colorspace = %d\n", colorspace);
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ VideoConsumer::CreateBuffers(const media_format& withFormat)
|
|||||||
for (uint32 j = 0; j < 3; j++) {
|
for (uint32 j = 0; j < 3; j++) {
|
||||||
fBitmap[j] = new BBitmap(BRect(0, 0, (xSize - 1), (ySize - 1)), colorspace,
|
fBitmap[j] = new BBitmap(BRect(0, 0, (xSize - 1), (ySize - 1)), colorspace,
|
||||||
false, true);
|
false, true);
|
||||||
if (fBitmap[j]->IsValid()) {
|
if (fBitmap[j]->IsValid()) {
|
||||||
buffer_clone_info info;
|
buffer_clone_info info;
|
||||||
if ((info.area = area_for(fBitmap[j]->Bits())) == B_ERROR)
|
if ((info.area = area_for(fBitmap[j]->Bits())) == B_ERROR)
|
||||||
ERROR("VideoConsumer::CreateBuffers - ERROR IN AREA_FOR\n");
|
ERROR("VideoConsumer::CreateBuffers - ERROR IN AREA_FOR\n");
|
||||||
@@ -319,7 +319,7 @@ VideoConsumer::CreateBuffers(const media_format& withFormat)
|
|||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
buffList[j] = 0;
|
buffList[j] = 0;
|
||||||
|
|
||||||
if ((status = fBuffers->GetBufferList(3, buffList)) == B_OK)
|
if ((status = fBuffers->GetBufferList(3, buffList)) == B_OK)
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
if (buffList[j] != NULL) {
|
if (buffList[j] != NULL) {
|
||||||
fBufferMap[j] = (uint32)buffList[j];
|
fBufferMap[j] = (uint32)buffList[j];
|
||||||
@@ -362,7 +362,7 @@ VideoConsumer::Connected(const media_source& producer, const media_destination&
|
|||||||
const media_format& withFormat, media_input* outInput)
|
const media_format& withFormat, media_input* outInput)
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::Connected\n");
|
FUNCTION("VideoConsumer::Connected\n");
|
||||||
|
|
||||||
fIn.source = producer;
|
fIn.source = producer;
|
||||||
fIn.format = withFormat;
|
fIn.format = withFormat;
|
||||||
fIn.node = Node();
|
fIn.node = Node();
|
||||||
@@ -370,9 +370,9 @@ VideoConsumer::Connected(const media_source& producer, const media_destination&
|
|||||||
*outInput = fIn;
|
*outInput = fIn;
|
||||||
|
|
||||||
uint32 userData = 0;
|
uint32 userData = 0;
|
||||||
int32 changeTag = 1;
|
int32 changeTag = 1;
|
||||||
if (CreateBuffers(withFormat) == B_OK)
|
if (CreateBuffers(withFormat) == B_OK)
|
||||||
BBufferConsumer::SetOutputBuffersFor(producer, fDestination,
|
BBufferConsumer::SetOutputBuffersFor(producer, fDestination,
|
||||||
fBuffers, (void *)&userData, &changeTag, true);
|
fBuffers, (void *)&userData, &changeTag, true);
|
||||||
else {
|
else {
|
||||||
ERROR("VideoConsumer::Connected - COULDN'T CREATE BUFFERS\n");
|
ERROR("VideoConsumer::Connected - COULDN'T CREATE BUFFERS\n");
|
||||||
@@ -405,15 +405,15 @@ status_t
|
|||||||
VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format)
|
VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format)
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::AcceptFormat\n");
|
FUNCTION("VideoConsumer::AcceptFormat\n");
|
||||||
|
|
||||||
if (dest != fIn.destination) {
|
if (dest != fIn.destination) {
|
||||||
ERROR("VideoConsumer::AcceptFormat - BAD DESTINATION\n");
|
ERROR("VideoConsumer::AcceptFormat - BAD DESTINATION\n");
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format->type == B_MEDIA_NO_TYPE)
|
if (format->type == B_MEDIA_NO_TYPE)
|
||||||
format->type = B_MEDIA_RAW_VIDEO;
|
format->type = B_MEDIA_RAW_VIDEO;
|
||||||
|
|
||||||
if (format->type != B_MEDIA_RAW_VIDEO) {
|
if (format->type != B_MEDIA_RAW_VIDEO) {
|
||||||
ERROR("VideoConsumer::AcceptFormat - BAD FORMAT\n");
|
ERROR("VideoConsumer::AcceptFormat - BAD FORMAT\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
@@ -423,7 +423,7 @@ VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format)
|
|||||||
&& format->u.raw_video.display.format != B_RGB16
|
&& format->u.raw_video.display.format != B_RGB16
|
||||||
&& format->u.raw_video.display.format != B_RGB15
|
&& format->u.raw_video.display.format != B_RGB15
|
||||||
&& format->u.raw_video.display.format != B_GRAY8
|
&& format->u.raw_video.display.format != B_GRAY8
|
||||||
&&
|
&&
|
||||||
format->u.raw_video.display.format != media_raw_video_format::wildcard.display.format) {
|
format->u.raw_video.display.format != media_raw_video_format::wildcard.display.format) {
|
||||||
ERROR("AcceptFormat - not a format we know about!\n");
|
ERROR("AcceptFormat - not a format we know about!\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
@@ -433,7 +433,7 @@ VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format)
|
|||||||
format->u.raw_video.display.format = B_RGB16;
|
format->u.raw_video.display.format = B_RGB16;
|
||||||
}
|
}
|
||||||
|
|
||||||
char formatString[256];
|
char formatString[256];
|
||||||
string_for_format(*format, formatString, 256);
|
string_for_format(*format, formatString, 256);
|
||||||
FUNCTION("VideoConsumer::AcceptFormat: %s\n", formatString);
|
FUNCTION("VideoConsumer::AcceptFormat: %s\n", formatString);
|
||||||
|
|
||||||
@@ -474,10 +474,10 @@ VideoConsumer::GetLatencyFor(const media_destination& forWhom, bigtime_t* outLat
|
|||||||
media_node_id* out_timesource)
|
media_node_id* out_timesource)
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::GetLatencyFor\n");
|
FUNCTION("VideoConsumer::GetLatencyFor\n");
|
||||||
|
|
||||||
if (forWhom != fIn.destination)
|
if (forWhom != fIn.destination)
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
|
|
||||||
*outLatency = fMyLatency;
|
*outLatency = fMyLatency;
|
||||||
*out_timesource = TimeSource()->ID();
|
*out_timesource = TimeSource()->ID();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -485,7 +485,7 @@ VideoConsumer::GetLatencyFor(const media_destination& forWhom, bigtime_t* outLat
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
VideoConsumer::FormatChanged(const media_source& producer, const media_destination& consumer,
|
VideoConsumer::FormatChanged(const media_source& producer, const media_destination& consumer,
|
||||||
int32 fromChangeCount, const media_format& format)
|
int32 fromChangeCount, const media_format& format)
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::FormatChanged\n");
|
FUNCTION("VideoConsumer::FormatChanged\n");
|
||||||
@@ -507,7 +507,7 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
|||||||
bool realTimeEvent)
|
bool realTimeEvent)
|
||||||
{
|
{
|
||||||
LOOP("VideoConsumer::HandleEvent\n");
|
LOOP("VideoConsumer::HandleEvent\n");
|
||||||
|
|
||||||
BBuffer* buffer;
|
BBuffer* buffer;
|
||||||
|
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
@@ -552,14 +552,14 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
|||||||
fOurBuffers = false;
|
fOurBuffers = false;
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fFtpComplete && fTimeToFtp) {
|
if (fFtpComplete && fTimeToFtp) {
|
||||||
PROGRESS("VidConsumer::HandleEvent - SPAWNING FTP THREAD\n");
|
PROGRESS("VidConsumer::HandleEvent - SPAWNING FTP THREAD\n");
|
||||||
fTimeToFtp = false;
|
fTimeToFtp = false;
|
||||||
fFtpComplete = false;
|
fFtpComplete = false;
|
||||||
memcpy(fFtpBitmap->Bits(), buffer->Data(), fFtpBitmap->BitsLength());
|
memcpy(fFtpBitmap->Bits(), buffer->Data(), fFtpBitmap->BitsLength());
|
||||||
fFtpThread = spawn_thread(FtpRun, "Video Window Ftp", B_NORMAL_PRIORITY, this);
|
fFtpThread = spawn_thread(FtpRun, "Video Window Ftp", B_NORMAL_PRIORITY, this);
|
||||||
resume_thread(fFtpThread);
|
resume_thread(fFtpThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((RunMode() == B_OFFLINE)
|
if ((RunMode() == B_OFFLINE)
|
||||||
@@ -578,7 +578,7 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
|||||||
int32 size = fBitmap[index]->BitsLength();
|
int32 size = fBitmap[index]->BitsLength();
|
||||||
uint32* end = start + size / 4;
|
uint32* end = start + size / 4;
|
||||||
for (uint32* p = start; p < end; p++)
|
for (uint32* p = start; p < end; p++)
|
||||||
*p = (*p >> 3) & 0x1f1f1f1f;
|
*p = (*p >> 3) & 0x1f1f1f1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
fView->DrawBitmap(fBitmap[index], fView->Bounds());
|
fView->DrawBitmap(fBitmap[index], fView->Bounds());
|
||||||
@@ -597,7 +597,7 @@ VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
|||||||
default:
|
default:
|
||||||
ERROR("VideoConsumer::HandleEvent - BAD EVENT\n");
|
ERROR("VideoConsumer::HandleEvent - BAD EVENT\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ status_t
|
|||||||
VideoConsumer::FtpRun(void* data)
|
VideoConsumer::FtpRun(void* data)
|
||||||
{
|
{
|
||||||
FUNCTION("VideoConsumer::FtpRun\n");
|
FUNCTION("VideoConsumer::FtpRun\n");
|
||||||
|
|
||||||
((VideoConsumer *)data)->FtpThread();
|
((VideoConsumer *)data)->FtpThread();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -633,15 +633,15 @@ VideoConsumer::FtpThread()
|
|||||||
b->Lock();
|
b->Lock();
|
||||||
v->DrawBitmap(fFtpBitmap, v->Frame());
|
v->DrawBitmap(fFtpBitmap, v->Frame());
|
||||||
v->Sync();
|
v->Sync();
|
||||||
b->Unlock();
|
b->Unlock();
|
||||||
|
|
||||||
if (LocalSave("small.jpg", b) == B_OK)
|
if (LocalSave("small.jpg", b) == B_OK)
|
||||||
FtpSave("small.jpg");
|
FtpSave("small.jpg");
|
||||||
|
|
||||||
delete b;
|
delete b;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fFtpComplete = true;
|
fFtpComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -684,7 +684,7 @@ VideoConsumer::LocalSave(char* filename, BBitmap* bitmap)
|
|||||||
} else {
|
} else {
|
||||||
UpdateFtpStatus(B_TRANSLATE("Error creating output file"));
|
UpdateFtpStatus(B_TRANSLATE("Error creating output file"));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -692,7 +692,7 @@ status_t
|
|||||||
VideoConsumer::FtpSave(char* filename)
|
VideoConsumer::FtpSave(char* filename)
|
||||||
{
|
{
|
||||||
FileUploadClient *ftp;
|
FileUploadClient *ftp;
|
||||||
|
|
||||||
//XXX: make that cleaner
|
//XXX: make that cleaner
|
||||||
switch (fUploadClient) {
|
switch (fUploadClient) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -704,7 +704,7 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
case 2:
|
case 2:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, B_TRANSLATE("invalid upload client %ld\n"),
|
fprintf(stderr, B_TRANSLATE("invalid upload client %ld\n"),
|
||||||
fUploadClient);
|
fUploadClient);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -713,7 +713,7 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
// ftp the local file to our web site
|
// ftp the local file to our web site
|
||||||
|
|
||||||
UpdateFtpStatus(B_TRANSLATE("Logging in" B_UTF8_ELLIPSIS));
|
UpdateFtpStatus(B_TRANSLATE("Logging in" B_UTF8_ELLIPSIS));
|
||||||
if (ftp->Connect((string)fServerText, (string)fLoginText,
|
if (ftp->Connect((string)fServerText, (string)fLoginText,
|
||||||
(string)fPasswordText)) {
|
(string)fPasswordText)) {
|
||||||
// connect to server
|
// connect to server
|
||||||
UpdateFtpStatus(B_TRANSLATE("Connected" B_UTF8_ELLIPSIS));
|
UpdateFtpStatus(B_TRANSLATE("Connected" B_UTF8_ELLIPSIS));
|
||||||
@@ -760,8 +760,8 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
SetFileType(BFile* file, int32 translator, uint32 type)
|
SetFileType(BFile* file, int32 translator, uint32 type)
|
||||||
{
|
{
|
||||||
translation_format* formats;
|
translation_format* formats;
|
||||||
int32 count;
|
int32 count;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ typedef struct {
|
|||||||
char fileNameText[64];
|
char fileNameText[64];
|
||||||
char serverText[64];
|
char serverText[64];
|
||||||
char loginText[64];
|
char loginText[64];
|
||||||
char passwordText[64];
|
char passwordText[64];
|
||||||
char directoryText[64];
|
char directoryText[64];
|
||||||
} ftp_msg_info;
|
} ftp_msg_info;
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer {
|
|||||||
private:
|
private:
|
||||||
virtual void ProducerDataStatus(const media_destination &forWhom,
|
virtual void ProducerDataStatus(const media_destination &forWhom,
|
||||||
int32 status, bigtime_t atMediaTime);
|
int32 status, bigtime_t atMediaTime);
|
||||||
|
|
||||||
virtual status_t GetLatencyFor(const media_destination& forWhom,
|
virtual status_t GetLatencyFor(const media_destination& forWhom,
|
||||||
bigtime_t* outLatency, media_node_id* outId);
|
bigtime_t* outLatency, media_node_id* outId);
|
||||||
|
|
||||||
virtual status_t Connected(const media_source& producer,
|
virtual status_t Connected(const media_source& producer,
|
||||||
const media_destination& where, const media_format& withFormat,
|
const media_destination& where, const media_format& withFormat,
|
||||||
media_input* outInput);
|
media_input* outInput);
|
||||||
@@ -101,11 +101,11 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer {
|
|||||||
status_t CreateBuffers(const media_format& withFormat);
|
status_t CreateBuffers(const media_format& withFormat);
|
||||||
|
|
||||||
void DeleteBuffers();
|
void DeleteBuffers();
|
||||||
|
|
||||||
static status_t FtpRun(void* data);
|
static status_t FtpRun(void* data);
|
||||||
|
|
||||||
void FtpThread();
|
void FtpThread();
|
||||||
|
|
||||||
void UpdateFtpStatus(const char* status);
|
void UpdateFtpStatus(const char* status);
|
||||||
|
|
||||||
status_t LocalSave(char* filename, BBitmap* bitmap);
|
status_t LocalSave(char* filename, BBitmap* bitmap);
|
||||||
@@ -129,11 +129,11 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer {
|
|||||||
BBitmap* fBitmap[3];
|
BBitmap* fBitmap[3];
|
||||||
bool fOurBuffers;
|
bool fOurBuffers;
|
||||||
BBufferGroup* fBuffers;
|
BBufferGroup* fBuffers;
|
||||||
uint32 fBufferMap[3];
|
uint32 fBufferMap[3];
|
||||||
|
|
||||||
BBitmap* fFtpBitmap;
|
BBitmap* fFtpBitmap;
|
||||||
volatile bool fTimeToFtp;
|
volatile bool fTimeToFtp;
|
||||||
volatile bool fFtpComplete;
|
volatile bool fFtpComplete;
|
||||||
|
|
||||||
bigtime_t fRate;
|
bigtime_t fRate;
|
||||||
uint32 fImageFormat;
|
uint32 fImageFormat;
|
||||||
@@ -143,7 +143,7 @@ class VideoConsumer : public BMediaEventLooper, public BBufferConsumer {
|
|||||||
char fFileNameText[64];
|
char fFileNameText[64];
|
||||||
char fServerText[64];
|
char fServerText[64];
|
||||||
char fLoginText[64];
|
char fLoginText[64];
|
||||||
char fPasswordText[64];
|
char fPasswordText[64];
|
||||||
char fDirectoryText[64];
|
char fDirectoryText[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -20,7 +20,7 @@ TYPE= APP
|
|||||||
# to fill in generic makefile
|
# to fill in generic makefile
|
||||||
|
|
||||||
#%{
|
#%{
|
||||||
# @src->@
|
# @src->@
|
||||||
|
|
||||||
# specify the source files to use
|
# specify the source files to use
|
||||||
# full paths or paths relative to the makefile can be included
|
# full paths or paths relative to the makefile can be included
|
||||||
@@ -41,7 +41,7 @@ SRCS= \
|
|||||||
# full path or a relative path to the resource file can be used.
|
# full path or a relative path to the resource file can be used.
|
||||||
RSRCS= codycam.rsrc
|
RSRCS= codycam.rsrc
|
||||||
|
|
||||||
# @<-src@
|
# @<-src@
|
||||||
#%}
|
#%}
|
||||||
|
|
||||||
# end support for Pe and Eddie
|
# end support for Pe and Eddie
|
||||||
@@ -51,7 +51,7 @@ RSRCS= codycam.rsrc
|
|||||||
# - if your library follows the naming pattern of:
|
# - if your library follows the naming pattern of:
|
||||||
# libXXX.so or libXXX.a you can simply specify XXX
|
# libXXX.so or libXXX.a you can simply specify XXX
|
||||||
# library: libbe.so entry: be
|
# library: libbe.so entry: be
|
||||||
#
|
#
|
||||||
# - if your library does not follow the standard library
|
# - if your library does not follow the standard library
|
||||||
# naming scheme you need to specify the path to the library
|
# naming scheme you need to specify the path to the library
|
||||||
# and it's name
|
# and it's name
|
||||||
@@ -69,17 +69,17 @@ endif
|
|||||||
# be recursive, so include all of the paths where libraries can
|
# be recursive, so include all of the paths where libraries can
|
||||||
# be found. Directories where source files are found are
|
# be found. Directories where source files are found are
|
||||||
# automatically included.
|
# automatically included.
|
||||||
LIBPATHS=
|
LIBPATHS=
|
||||||
|
|
||||||
# additional paths to look for system headers
|
# additional paths to look for system headers
|
||||||
# thes use the form: #include <header>
|
# thes use the form: #include <header>
|
||||||
# source file directories are NOT auto-included here
|
# source file directories are NOT auto-included here
|
||||||
SYSTEM_INCLUDE_PATHS =
|
SYSTEM_INCLUDE_PATHS =
|
||||||
|
|
||||||
# additional paths to look for local headers
|
# additional paths to look for local headers
|
||||||
# thes use the form: #include "header"
|
# thes use the form: #include "header"
|
||||||
# source file directories are automatically included
|
# source file directories are automatically included
|
||||||
LOCAL_INCLUDE_PATHS =
|
LOCAL_INCLUDE_PATHS =
|
||||||
|
|
||||||
# specify the level of optimization that you desire
|
# specify the level of optimization that you desire
|
||||||
# NONE, SOME, FULL
|
# NONE, SOME, FULL
|
||||||
@@ -90,23 +90,23 @@ OPTIMIZE= FULL
|
|||||||
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
|
||||||
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
|
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
|
||||||
# would pass "-DDEBUG" on the compiler's command line.
|
# would pass "-DDEBUG" on the compiler's command line.
|
||||||
DEFINES=
|
DEFINES=
|
||||||
|
|
||||||
# specify special warning levels
|
# specify special warning levels
|
||||||
# if unspecified default warnings will be used
|
# if unspecified default warnings will be used
|
||||||
# NONE = supress all warnings
|
# NONE = supress all warnings
|
||||||
# ALL = enable all warnings
|
# ALL = enable all warnings
|
||||||
WARNINGS =
|
WARNINGS =
|
||||||
|
|
||||||
# specify whether image symbols will be created
|
# specify whether image symbols will be created
|
||||||
# so that stack crawls in the debugger are meaningful
|
# so that stack crawls in the debugger are meaningful
|
||||||
# if TRUE symbols will be created
|
# if TRUE symbols will be created
|
||||||
SYMBOLS =
|
SYMBOLS =
|
||||||
|
|
||||||
# specify debug settings
|
# specify debug settings
|
||||||
# if TRUE will allow application to be run from a source-level
|
# if TRUE will allow application to be run from a source-level
|
||||||
# debugger. Note that this will disable all optimzation.
|
# debugger. Note that this will disable all optimzation.
|
||||||
DEBUGGER =
|
DEBUGGER =
|
||||||
|
|
||||||
# specify additional compiler flags for all files
|
# specify additional compiler flags for all files
|
||||||
COMPILER_FLAGS =
|
COMPILER_FLAGS =
|
||||||
|
|||||||
Reference in New Issue
Block a user