Skip to content

Commit

Permalink
Moved bWindowResizedFromServer in RemoteWebcamCli.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
lebarsfa committed Aug 6, 2015
1 parent d41d784 commit 76e36d1
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
14
Minor modifications.
Moved bWindowResizedFromServer in RemoteWebcamCli.txt.
Harmonization of RemoteWebcamCli w.r.t. Video in UxVCtrl.

13
Added bForceSoftwareResize, hscale, vscale parameters in place of scale for the server.

Expand Down
2 changes: 1 addition & 1 deletion RemoteWebcamCli/Globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ int videoimgwidth = 0;
int videoimgheight = 0;
int captureperiod = 0;
int timeout = 0;
BOOL bUDP = FALSE;
BOOL bWindowResizedFromServer = FALSE;
BOOL bUDP = FALSE;
2 changes: 1 addition & 1 deletion RemoteWebcamCli/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EXTERN_C int videoimgwidth;
EXTERN_C int videoimgheight;
EXTERN_C int captureperiod;
EXTERN_C int timeout;
EXTERN_C BOOL bUDP;
EXTERN_C BOOL bWindowResizedFromServer;
EXTERN_C BOOL bUDP;

#endif // GLOBALS_H
36 changes: 18 additions & 18 deletions RemoteWebcamCli/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ int LoadConfig()
videoimgheight = 480;
captureperiod = 5;
timeout = 0;
bUDP = FALSE;
bWindowResizedFromServer = FALSE;
bWindowResizedFromServer = 0;
bUDP = 0;

file = fopen("RemoteWebcamCli.txt", "r");
if (file != NULL)
Expand All @@ -33,10 +33,9 @@ int LoadConfig()
if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &timeout) != 1) printf("Invalid configuration file.\n");
if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &bUDP) != 1) printf("Invalid configuration file.\n");
if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &bWindowResizedFromServer) != 1) printf("Invalid configuration file.\n");

if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &bUDP) != 1) printf("Invalid configuration file.\n");
if (fclose(file) != EXIT_SUCCESS) printf("fclose() failed.\n");
}
else
Expand Down Expand Up @@ -74,6 +73,7 @@ int recvdecode(void)
CvMat* mat = NULL;
IplImage* imagenew = image;
char* databufnew = databuf;
int curframewidth = image->width, curframeheight = image->height;

if (recvall(s1, (char*)header, 3*sizeof(unsigned int)) != EXIT_SUCCESS)
{
Expand Down Expand Up @@ -120,12 +120,12 @@ int recvdecode(void)
cvReleaseMat(&mat);

// Resolution changed by server.
if ((image->width != videoimgwidth)||(image->height != videoimgheight))
if ((image->width != curframewidth)||(image->height != curframeheight))
{
videoimgwidth = image->width;
videoimgheight = image->height;
curframewidth = image->width;
curframeheight = image->height;

if (bWindowResizedFromServer) cvResizeWindow("Client", videoimgwidth, videoimgheight);
if (bWindowResizedFromServer) cvResizeWindow("Client", curframewidth, curframeheight);

databufnew = (char*)calloc(image->imageSize+3*sizeof(unsigned int), sizeof(char));
if (!databufnew)
Expand Down Expand Up @@ -202,12 +202,12 @@ int recvdecode(void)
cvReleaseMat(&mat);

// Resolution changed by server.
if ((image->width != videoimgwidth)||(image->height != videoimgheight))
if ((image->width != curframewidth)||(image->height != curframeheight))
{
videoimgwidth = image->width;
videoimgheight = image->height;
curframewidth = image->width;
curframeheight = image->height;

if (bWindowResizedFromServer) cvResizeWindow("Client", videoimgwidth, videoimgheight);
if (bWindowResizedFromServer) cvResizeWindow("Client", curframewidth, curframeheight);

databufnew = (char*)calloc(image->imageSize+3*sizeof(unsigned int), sizeof(char));
if (!databufnew)
Expand All @@ -230,13 +230,13 @@ int recvdecode(void)
return EXIT_FAILURE;
}

videoimgwidth = header[1];
videoimgheight = header[2];
curframewidth = header[1];
curframeheight = header[2];

// Resolution changed by server.
if ((image->width != videoimgwidth)||(image->height != videoimgheight))
if ((image->width != curframewidth)||(image->height != curframeheight))
{
imagenew = cvCreateImage(cvSize(videoimgwidth, videoimgheight), IPL_DEPTH_8U, 3);
imagenew = cvCreateImage(cvSize(curframewidth, curframeheight), IPL_DEPTH_8U, 3);
if (imagenew == NULL)
{
printf("cvCreateImage() failed.\n");
Expand All @@ -245,7 +245,7 @@ int recvdecode(void)
cvReleaseImage(&image);
image = imagenew;

if (bWindowResizedFromServer) cvResizeWindow("Client", videoimgwidth, videoimgheight);
if (bWindowResizedFromServer) cvResizeWindow("Client", curframewidth, curframeheight);

databufnew = (char*)calloc(image->imageSize+3*sizeof(unsigned int), sizeof(char));
if (!databufnew)
Expand Down
4 changes: 2 additions & 2 deletions RemoteWebcamCli/RemoteWebcamCli.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
5
% timeout (in ms)
5
% bUDP
0
% bWindowResizedFromServer
0
% bUDP
0
7 changes: 3 additions & 4 deletions RemoteWebcamMultiSrv/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ int LoadConfig()
videoimgheight = 480;
captureperiod = 100;
timeout = 0;
bForceSoftwareResize = TRUE;
bForceSoftwareResize = 1;
hscale = 1;
vscale = 1;
angle = 0*M_PI/180.0;
bFlip = 0;
bUDP = FALSE;
bUDP = 0;
pixcolorchgthreshold = 3;
timecompressiondividerthreshold = 4;
fullimgperiod = 1000;
encodequality = 95;
memset(encodetype, 0, sizeof(encodetype));
sprintf(encodetype, ".JPEG");
method = 0;
bDisableVideoRecording = FALSE;
bDisableVideoRecording = 0;

#ifdef __ANDROID__
file = fopen("/storage/sdcard0/download/RemoteWebcamMultiSrv.txt", "r");
Expand Down Expand Up @@ -76,7 +76,6 @@ int LoadConfig()
if (sscanf(line, "%d", &method) != 1) printf("Invalid configuration file.\n");
if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &bDisableVideoRecording) != 1) printf("Invalid configuration file.\n");

if (fclose(file) != EXIT_SUCCESS) printf("fclose() failed.\n");
}
else
Expand Down
5 changes: 2 additions & 3 deletions RemoteWebcamSrv/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ int LoadConfig()
videoimgheight = 480;
captureperiod = 100;
timeout = 0;
bForceSoftwareResize = TRUE;
bForceSoftwareResize = 1;
hscale = 1;
vscale = 1;
angle = 0*M_PI/180.0;
bFlip = 0;
bUDP = FALSE;
bUDP = 0;
pixcolorchgthreshold = 3;
timecompressiondividerthreshold = 4;
fullimgperiod = 1000;
Expand Down Expand Up @@ -73,7 +73,6 @@ int LoadConfig()
if (sscanf(line, "%31s", encodetype) != 1) printf("Invalid configuration file.\n");
if (fgets3(file, line, sizeof(line)) == NULL) printf("Invalid configuration file.\n");
if (sscanf(line, "%d", &method) != 1) printf("Invalid configuration file.\n");

if (fclose(file) != EXIT_SUCCESS) printf("fclose() failed.\n");
}
else
Expand Down

0 comments on commit 76e36d1

Please sign in to comment.