Motion - Netcam Code Rewrite Patch

Netcam Code Rewrite Patch


A complete rewrite of the Motion Netcam code.

Patch topic created by Kenneth Lavrsen on behalf of Bill Brack.

Description of Patch

Module for handling network cameras.

This code was inspired by the original netcam.c module written by Jeroen Vreeken and enhanced by several Motion project contributors, particularly Angel Carpintero and Christopher Price.

Copyright 2005, William M. Brack

This software is distributed under the GNU Public license

When a netcam has been configured, instead of using the routines within video.c (which handle a CCTV-type camera) the routines within this module are used. There are only three entry points - one for "starting up" the camera (netcam_start), for "fetching a picture" from it (netcam_next), and one for cleanup at the end of a run (netcam_cleanup).

Two quite different types of netcams are handled. The simplest one is the type which supplies a single JPEG frame each time it is accessed. The other type is one which supplies an mjpeg stream of data.

In order to work with the second type, the thread which is taking care of the netcam will start up a completely separate thread (which I call the "camera handler thread" within subsequent comments). This handler will receive the mjpeg stream of data from the camera, and save the latest complete image when it begins to work on the next one.

Installation of Patch

  • Already included in motion-3.2.2_snap9

Change History of Patch

Changelog for netcam2 beta release:

30 July 2005 - netcam2-1.0b.tgz Initial release

31 July 2005 - netcam2-1.1b.tgz Fixed a problem concerning HTTP header information, found when testing with Toshiba netcams (netcam2.c).

The Toshiba cameras I found with Google seem to have a relatively high error rate, and it's not unusual for the connection to be (temporarily) lost. When this happens, the logs show "Connection timed out", "error sending 1st comand Bad file descriptor". The software eventually recovers, but I shall try to put some more clever code to detect and (attempt to) retry when this happens (probably in 1.2b, coming soon).

01 Aug 2005 - Included in motion-3.2.2_snap8

Discussion and Comments

Topic revision: r3 - 13 Aug 2005, KennethLavrsen
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.