Commit Graph

81 Commits

Author SHA1 Message Date
Mr-Dave
bd36bacb69 Merge pull request #197 from slokhorst/proper-ipv6
Rewrite sockets to be much simpler and properly support IPv6. Closes #97
2016-09-28 19:02:37 -06:00
Sebastiaan Lokhorst
2c139baaca Tweak variable names. 2016-09-28 11:37:39 +02:00
Sebastiaan Lokhorst
0a7139f928 Rename option back to ipv6_enabled (now only effects localhost) 2016-09-27 01:22:53 +02:00
Joseph Heenan
725008257b Replace "Thread x" with "Camera x" in the web ui
In common with other recent changes, remove another place where
"Thread" is visible to the user.

We also now use the camera_id rather than the thread number. The
camera_id already defaults to the thread number, so this change
won't cause any difference for older config files that don't set
camera_id.
2016-09-26 21:57:13 +01:00
Sebastiaan Lokhorst
69345a4e6f Improve debug output 2016-09-26 16:10:51 +02:00
Sebastiaan Lokhorst
ab12095d4e Rewrite sockets to be much simpler and properly support IPv6.
Remove option ipv6_enabled (IPv6 is always enabled)
Add option localhost_ipv4 (the user must choose to listen to IPv4 and IPv6 localhost, only relevant when the localhost option is set to on)
2016-09-25 18:00:47 +02:00
Joseph Heenan
fcde5a2dfb Merge pull request #184 from slokhorst/html-cleanup
Cleanup HTML.
2016-09-24 09:22:30 +01:00
Sebastiaan Lokhorst
74e9cbe081 Fix another hostname issue, where the hostname would contain the next header line, when the
Hostname header was empty or malformed.
2016-09-23 11:36:50 +02:00
Sebastiaan Lokhorst
aa7ba3984e Cleanup HTML. 2016-09-22 18:36:00 +02:00
Sebastiaan Lokhorst
0a22df1547 Fix string length in memchr call. 2016-09-22 16:34:18 +02:00
Sebastiaan Lokhorst
249967e669 Fix hostname determination for IPv6 addresses in web server. 2016-09-22 16:01:20 +02:00
Mr-Dave
7611f6e9e0 Merge pull request #158 from jogu/camera_name
Add camera_name setting to allow each camera to be given a name
2016-09-11 20:42:26 -06:00
Joseph Heenan
a2b732713d Fix cases where gethostname() returns a name that doesn't work for client
We currently rely on gethostname() to generate the links from the web
control homepage to the camera streams - unfortunately if DNS isn't
set up well the hostname won't be one the web browser can resolve
(often the case on raspberry pi's, where the hostname is set to
"raspberrypi" by default and users access them via IP address).

To cater for these situations we look at the "Host:" header in the
HTTP headers that came from the browser (which indicate which host the
browser has been asked to connect to) and use that to generate the
hostname to use in the links.

If there's no Host: header (unlikely these days) we default back to
the old behaviour.
2016-09-11 13:25:31 +00:00
Joseph Heenan
31ddc67672 Add camera_name setting to allow each camera to be given a name
Based on a commit originally by Chris Roberts <86montecarlo@gmail.com>

camera_name allows naming of threads, is displayed in the motion control
webpage, and a new specifier (%$) added enabling it to be used for
filenames and such.

The changes I have made since Chris's commit:

1. Change format specifier for threadname from %E to %$

This avoids clashing with any known strftime format specifiers.
(According to the Debian stable strftime man page - it seems we've
already used all spare letters to mean other things.)

2. Behaviour if camera_name is not set is now unchanged

(Previous it would display "thread 1 -- NULL" if the thread name was
unset, and I don't believe how printf deals with NULL values for %s
specifiers is guaranteed.)

3. Thread name is reflected into the system thread name

Uses pthread_setname_np. There's a autoconf test for it, which looks
for the version that takes the thread id and thread name. I believe
this should work on all recent linux, and maybe other platforms too.

(It won't work on macOS; autoconf will disable it - but I deliberately
always use the pthread_setname_np(pthread_self(), name) form so that
it could easily be adapted for macOS in the future.)

4. The parameter has been renamed from thread_name to camera_name, as
that seems to better reflect how the user will see it.
2016-09-10 21:50:46 +01:00
Joseph Heenan
454f03159d Fix bad html in server home page
</a/n> was presumably meant to be a </a> followed by a new line.
2016-08-22 09:34:58 +01:00
Mr Dave
383321daa1 Fix send raw error introduced with Chrome preview fix 2015-09-08 21:26:08 -06:00
Mr Dave
33b7d4f045 Clean tabs for issue 071831 patch 2015-09-05 13:08:41 -06:00
Mr Dave
0f45a713a7 Remote preview fixes 2015-09-05 10:09:55 -06:00
Mr Dave
cb7dcc3018 Add preview to webcontrol 2015-09-04 20:39:09 -06:00
David Fries
bab15abfee count webcontrol as a thread to avoid a crash
On a SIGHUP restart the main thread waits to restart until all worker
threads are finished executing, except webcontrol wasn't included.
If it was still running (such as reading a web request), it would
have a dangling context pointer after cnt_list was freed leading to a
crash.  This counts that thread in the running threads, as a
termination webcontrol_finish variable to terminate it indepdent of
the device thread, and creates a webcontrol_running to identify when
it is running.
2015-08-23 16:50:47 -05:00
David Fries
cf88e025ab typo fix, unused variable cleanup, etc
motion.c bad spelling, to "an image"
webhttpd.c consolidate the timeout to the top of the file as I needed
to change it for testing
2015-08-23 16:50:47 -05:00
Alfred Klomp
a36801e6dd free(): remove unnecessary NULL pointer checks
Calling free() on a NULL pointer is a completely harmless. Reduce code
complexity by removing the unnecessary checks.
2014-10-15 23:46:37 +02:00
Alfred Klomp
ccdeee0073 mymalloc(): don't cast return value; void* is always promoted 2014-10-15 21:59:38 +02:00
Dave
976fe425a5 Removed compiler warnings and small bug fix for webhttpd.c 2014-06-13 20:47:13 -06:00
Dave
048791e449 Merge tosiara/rtsp branch (commit 46cfcf31d, 2014/05/21) 2014-06-13 19:52:34 -06:00
Angel Carpintero
05b815771a - Added a new starting option -m to disable motion detection
- Fixed configure for SDL
- Little fix in logging because was broken
- Replaced malloc by calloc in mymalloc()
2012-01-01 20:07:17 +01:00
Angel Carpintero
d8063fb1df - Change default log level to 6 / NTC
- Reviewed log levels to make motion less verbose and move most of them to NTC level.
2010-05-23 00:01:05 +02:00
AngelCarpintero
07f9e36891 fixes in new log system 2010-04-05 03:02:41 +00:00
AngelCarpintero
f7469950d0 Added a macro MOTION_LOG , no need to add __FUNCTION__ anymore. 2010-04-04 21:50:50 +00:00
AngelCarpintero
79cf297cd4 Implemented http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionLog 2010-04-03 19:34:23 +00:00
AngelCarpintero
6d35a01104 Make cosmetic changes in comments, description of functions and fix some code to be compliant with CODE STANDARD 2010-03-29 19:24:57 +00:00
AngelCarpintero
4bca8c16c0 Fix print of size_t using %Zu 2009-12-03 18:47:13 +00:00
AngelCarpintero
62c3e2db4a Added ipv6_enabled and little patch for BSD 2009-07-20 10:53:36 +00:00
AngelCarpintero
0f71dabed4 Added the option logfile to log message to text file. Removed level -1 to log to stderr, don't use always short 2009-03-09 04:36:17 +00:00
AngelCarpintero
a0d2151a3e http://www.lavrsen.dk/twiki/bin/view/Motion/UvcvideoMjpegPatch, Code Standard, extpipe (experimental) 2008-07-28 04:22:45 +00:00
AngelCarpintero
c2044fbe09 Apply new code standard ( chuck 2 ) 2008-07-16 20:34:23 +00:00
AngelCarpintero
406ade0aa8 - Fix round robin in BSD switching to METEOR_CAP_SINGLE
- Some improvements in capture code , added better logging
- Disable IPV6 in BSD  
- Free mutex in web control on error
2008-07-09 11:05:22 +00:00
AngelCarpintero
dc27136cbe Update log adding function name , remove setup_mode as a login level. Added servo_position() and check limits to avoid overflow maxN , minN 2008-07-07 13:53:42 +00:00
AngelCarpintero
716b5f171e Fix a typo , more debug stuff in track , fix not open port resetting fd to -1 2008-07-03 06:39:46 +00:00
AngelCarpintero
48aa7acbee Fix typos , log message , track_move no need to be called from motion when no active ( auto tracking ) , reverse center 2008-07-03 02:09:30 +00:00
AngelCarpintero
29fe6c47f3 Basic Servo API implementation , auto track might be broken yet 2008-07-02 03:58:03 +00:00
AngelCarpintero
2dafe96627 Added a new option name change and replace malloc/strdup by mymalloc and mystrdup 2008-06-15 23:27:49 +00:00
AngelCarpintero
e892397a1d http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x06x11x183727 ( support encode videos 1280x1024) 2008-06-13 08:56:15 +00:00
AngelCarpintero
6190728875 Added write_nonblock and read_noblock functions that use a limit of 1 second writes/reads 2008-06-12 05:52:22 +00:00
AngelCarpintero
fa6e94cba9 Fix a security issue in web control interface and update CHANGELOG & CREDITS from 3.2.10.1 2008-06-10 23:19:31 +00:00
AngelCarpintero
1594641b6e Security fix 2008-06-06 08:07:04 +00:00
AngelCarpintero
be4a74c7a8 Makeking changes according to http://www.lavrsen.dk/twiki/bin/view/Motion/IntuitiveOptionNamesDiscussion ( locate_motion, sql_log_movie , webcontrol_*, despeckle_filter. Add a wrapped #ifdef / #endif for FFMPEG in motion.c 2008-05-21 12:53:43 +00:00
AngelCarpintero
568b7752bb Major clean up code , apply CODE_STANDARD rules, add partially IPV6 http://www.lavrsen.dk/twiki/bin/view/Motion/IPv6 ( webcam and http-control , not netcam yet ) 2008-05-12 02:39:58 +00:00
AngelCarpintero
638114a49f Added a missing space in detection status 2008-05-03 02:22:09 +00:00
AngelCarpintero
bafef960f6 Avoid Conditional jump or move depends on uninitialised value(2) in alg_update_reference_frame (alg.c:1092), make sure that http control exits fine 2008-02-23 14:14:01 +00:00