Netcam Code Overview
The Camera Thread Side
The netcam code is initiated from video.c function vid_start() by calling the function
Each video frame is fetched from video.c function vid_next() by calling function
- ret = netcam_next(cnt, map);
where ret is the same pointer as map pointing to the buffer containing the video frame
Netcam context struct
Defined in motion.h
struct netcam_context |
Description |
pthread_t thread |
|
pthread_attr_t thread_attr |
|
pthread_mutex_t mutex |
|
int threadnr |
|
int state |
|
struct rbuf *response |
|
struct url_t url |
|
char *userpass |
|
char *boundary |
|
struct netcam_caps |
int streaming |
1 - supported 0 - unsupported |
int contentlength |
1 - supported 0 - unsupported |
int which |
|
pthread_cond_t which_cond |
|
pthread_cond_t dirty_cond |
|
struct netcam_image image[2] |
pthread_mutex_t mutex |
|
struct netcam_image_buffer buffer |
char *ptr |
|
size_t size |
|
size_t used |
|
int dirty |
|
int (*read)(struct context *) |
|
The Netcam Thread Side - netcam_start(cnt)
- Report to console and syslog that netcam is starting IF setup_mode
- Reserve memory for a netcam contect struct called cnt->netcam with local pointer name netcam
- Parse the URL given in cnt->conf.netcam_url (config option). Put result in netcam->url which is a struct type url_t.
- parse_url->service = http
- parse_url->userpass = username:password
- parse_url->port = port number
- parse_url->path = path on the server
- Initialize these mutexes insert what each is used for when you find out
- netcam->mutex
- netcam->image[0].mutex
- netcam->image[1].mutex
- netcam->which_cond
- netcam->dirty_cond
- Initialize more netcam struct variables
Topic not finished. I take a little at a time
--
KennethLavrsen - 26 May 2005