-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmjpg_streamer.h
executable file
·58 lines (47 loc) · 2.44 KB
/
mjpg_streamer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*******************************************************************************
# #
# MJPG-streamer allows to stream JPG frames from an input-plugin #
# to several output plugins #
# #
# Copyright (C) 2007 Tom Stöveken #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
*******************************************************************************/
#define SOURCE_VERSION "2.0"
#define MAX_OUTPUT_PLUGINS 10
#ifdef DEBUG
#define DBG(...) fprintf(stderr, " DBG(%s, %s(), %d): ", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, __VA_ARGS__)
#else
#define DBG(...)
#endif
#define LOG(...) { char _bf[1024] = {0}; snprintf(_bf, sizeof(_bf)-1, __VA_ARGS__); fprintf(stderr, "%s", _bf); syslog(LOG_INFO, "%s", _bf); }
#include "plugins/input.h"
#include "plugins/output.h"
typedef struct _globals globals;
struct _globals {
int stop;
/* signal fresh frames */
pthread_mutex_t db;
pthread_cond_t db_update;
/* global JPG frame, this is more or less the "database" */
unsigned char *buf;
int size;
/* input plugin */
input in;
/* output plugin */
output out[MAX_OUTPUT_PLUGINS];
int outcnt;
int clients_num;
};