Skip to content

Commit

Permalink
Improved Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
lebarsfa committed Apr 28, 2016
1 parent c691b1c commit 711ee91
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
19
Improved Linux support.

18
Corrected bug in code reading RemoteWebcamSrv.txt.

Expand Down
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
PROGS = RemoteWebcamMultiSrv RemoteWebcamSrv RemoteWebcamCli

CC = gcc
CFLAGS += -Wall -Winline -Wextra -g -fpermissive
#CFLAGS += -Wall -O3 -fpermissive
CXX = g++
#CFLAGS += -Wall -Winline -Wextra -g
CFLAGS += -Wall -O3
CFLAGS += -I. -I../OSUtils -I../Extensions/Img
CFLAGS += -D _DEBUG -D _DEBUG_DISPLAY -D _DEBUG_MESSAGES
#CFLAGS += -D _DEBUG -D _DEBUG_DISPLAY -D _DEBUG_MESSAGES
CFLAGS += -D DISABLE_GUI_REMOTEWEBCAMSRV -D DISABLE_GUI_REMOTEWEBCAMMULTISRV -D USE_ALTERNATE_RECORDING
CFLAGS += -D OPENCV249
CXXFLAGS += $(CFLAGS) -fpermissive
LDFLAGS += -lopencv_core -lopencv_highgui -lopencv_imgproc
LDFLAGS += -lpthread -lrt -lm

Expand Down Expand Up @@ -62,14 +65,14 @@ CvDisp.o: ../Extensions/Img/CvDisp.c ../Extensions/Img/CvDisp.h CvCore.o

############################# PROGS #############################

RemoteWebcamMultiSrv/Globals.o: RemoteWebcamMultiSrv/Globals.c CvDisp.o CvDraw.o CvProc.o CvFiles.o CvCore.o OSNet.o OSTimer.o OSEv.o OSCriticalSection.o OSThread.o OSMisc.o OSTime.o OSCore.o
$(CC) $(CFLAGS) -c $< -o $@
RemoteWebcamMultiSrv/Globals.o: RemoteWebcamMultiSrv/Globals.cpp CvDisp.o CvDraw.o CvProc.o CvFiles.o CvCore.o OSNet.o OSTimer.o OSEv.o OSCriticalSection.o OSThread.o OSMisc.o OSTime.o OSCore.o
$(CXX) $(CXXFLAGS) -c $< -o $@

RemoteWebcamMultiSrv/Main.o: RemoteWebcamMultiSrv/Main.c RemoteWebcamMultiSrv/Globals.o
$(CC) $(CFLAGS) -c $< -o $@
RemoteWebcamMultiSrv/Main.o: RemoteWebcamMultiSrv/Main.cpp RemoteWebcamMultiSrv/Globals.o
$(CXX) $(CXXFLAGS) -c $< -o $@

RemoteWebcamMultiSrv: RemoteWebcamMultiSrv/Main.o RemoteWebcamMultiSrv/Globals.o CvDisp.o CvDraw.o CvProc.o CvFiles.o CvCore.o OSNet.o OSTimer.o OSEv.o OSCriticalSection.o OSThread.o OSMisc.o OSTime.o OSCore.o
$(CC) $(CFLAGS) -o RemoteWebcamMultiSrv/$@ $^ $(LDFLAGS)
$(CXX) $(CXXFLAGS) -o RemoteWebcamMultiSrv/$@ $^ $(LDFLAGS)

RemoteWebcamSrv/Globals.o: RemoteWebcamSrv/Globals.c CvDisp.o CvDraw.o CvProc.o CvFiles.o CvCore.o OSNet.o OSMisc.o OSTime.o OSCore.o
$(CC) $(CFLAGS) -c $< -o $@
Expand All @@ -90,4 +93,4 @@ RemoteWebcamCli: RemoteWebcamCli/Main.o RemoteWebcamCli/Globals.o CvDisp.o CvDra
$(CC) $(CFLAGS) -o RemoteWebcamCli/$@ $^ $(LDFLAGS)

clean:
rm -f *.o *.obj core *.gch RemoteWebcamMultiSrv/RemoteWebcamMultiSrv RemoteWebcamSrv/RemoteWebcamSrv RemoteWebcamCli/RemoteWebcamCli
rm -f *.o *.obj core *.gch RemoteWebcamMultiSrv/*.o RemoteWebcamSrv/*.o RemoteWebcamCli/*.o RemoteWebcamMultiSrv/RemoteWebcamMultiSrv RemoteWebcamSrv/RemoteWebcamSrv RemoteWebcamCli/RemoteWebcamCli
10 changes: 9 additions & 1 deletion RemoteWebcamMultiSrv/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ int main(int argc, char* argv[])

cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1, 8);

if ((strlen(szDevPath) == 1)&&(isdigit((unsigned char)szDevPath[0])))
if ((strlen(szDevPath) == 1)&&(isdigit(szDevPath[0])))
{
webcam = cvCreateCameraCapture(atoi(szDevPath));
}
Expand Down Expand Up @@ -809,10 +809,18 @@ int main(int argc, char* argv[])
CV_FOURCC('M','J','P','G'), // Might work starting with OpenCV 3 for Android?
//CV_FOURCC('D','I','V','X'),
//CV_FOURCC('I', 'Y', 'U', 'V'),
#else
#ifdef USE_ALTERNATE_RECORDING
sprintf(videorecordfilename, "video_%.64s.avi", strtime_fns());
videorecordfile = cvCreateVideoWriter(videorecordfilename,
CV_FOURCC('M','J','P','G'),
//CV_FOURCC('D','I','V','X'),
//CV_FOURCC('I', 'Y', 'U', 'V'),
#else
sprintf(videorecordfilename, "video_%.64s.wmv", strtime_fns());
videorecordfile = cvCreateVideoWriter(videorecordfilename,
CV_FOURCC('W','M','V','2'),
#endif // USE_ALTERNATE_RECORDING
#endif // __ANDROID__
#ifdef DISABLE_TIMER_RECORDING
1000.0/(double)(captureperiod+20), // 20 ms is an approximation of the extra time spent for computations...
Expand Down
2 changes: 1 addition & 1 deletion RemoteWebcamSrv/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ int main(int argc, char* argv[])

cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 0.5, 0.5, 0, 1, 8);

if ((strlen(szDevPath) == 1)&&(isdigit((unsigned char)szDevPath[0])))
if ((strlen(szDevPath) == 1)&&(isdigit(szDevPath[0])))
{
webcam = cvCreateCameraCapture(atoi(szDevPath));
}
Expand Down
2 changes: 1 addition & 1 deletion RemoteWebcamSrv/RemoteWebcamSrv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
% encodetype (.JPEG or .PNG)
.JPEG
% method (0, 1 : static and dynamic compression based on movement detection, 2 : no compression, 3 : MJPEG (compatible with e.g. VLC, Firefox, Chrome (modify mjpeg.html to test)))
1
3

0 comments on commit 711ee91

Please sign in to comment.