mjpg_streamer.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 #                                                                              #
00003 #      MJPG-streamer allows to stream JPG frames from an input-plugin          #
00004 #      to several output plugins                                               #
00005 #                                                                              #
00006 #      Copyright (C) 2007 Tom Stöveken                                         #
00007 #                                                                              #
00008 # This program is free software; you can redistribute it and/or modify         #
00009 # it under the terms of the GNU General Public License as published by         #
00010 # the Free Software Foundation; version 2 of the License.                      #
00011 #                                                                              #
00012 # This program is distributed in the hope that it will be useful,              #
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of               #
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
00015 # GNU General Public License for more details.                                 #
00016 #                                                                              #
00017 # You should have received a copy of the GNU General Public License            #
00018 # along with this program; if not, write to the Free Software                  #
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    #
00020 #                                                                              #
00021 *******************************************************************************/
00022 
00023 #ifndef MJPG_STREAMER_H
00024 #define MJPG_STREAMER_H
00025 #define SOURCE_VERSION "2.0"
00026 
00027 /* FIXME take a look to the output_http clients thread marked with fixme if you want to set more then 10 plugins */
00028 #define MAX_INPUT_PLUGINS 10
00029 #define MAX_OUTPUT_PLUGINS 10
00030 #define MAX_PLUGIN_ARGUMENTS 32
00031 
00032 #include <linux/types.h>          /* for videodev2.h */
00033 #include <linux/videodev2.h>
00034 
00035 #ifdef DEBUG
00036 #define DBG(...) fprintf(stderr, " DBG(%s, %s(), %d): ", __FILE__, __FUNCTION__, __LINE__); fprintf(stderr, __VA_ARGS__)
00037 #else
00038 #define DBG(...)
00039 #endif
00040 
00041 #define LOG(...) { char _bf[1024] = {0}; snprintf(_bf, sizeof(_bf)-1, __VA_ARGS__); fprintf(stderr, "%s", _bf); syslog(LOG_INFO, "%s", _bf); }
00042 
00043 #include "input.h"
00044 #include "output.h"
00045 
00046 /* global variables that are accessed by all plugins */
00047 typedef struct _globals globals;
00048 
00049 /* an enum to identify the commands destination*/
00050 typedef enum {
00051     Dest_Input = 0,
00052     Dest_Output = 1,
00053     Dest_Program = 2,
00054 } command_dest;
00055 
00056 /* commands which can be send to the input plugin */
00057 typedef enum _cmd_group {
00058     IN_CMD_GENERIC =        0, // if you use non V4L2 input plugin you not need to deal the groups.
00059     IN_CMD_V4L2 =           1,
00060     IN_CMD_RESOLUTION =     2,
00061     IN_CMD_JPEG_QUALITY =   3,
00062     IN_CMD_PWC =            4,
00063 } cmd_group;
00064 
00065 typedef struct _control {
00066     struct v4l2_queryctrl ctrl;
00067     int value;
00068     struct v4l2_querymenu *menuitems;
00069     /*  In the case the control a V4L2 ctrl this variable will specify
00070         that the control is a V4L2_CTRL_CLASS_USER control or not.
00071         For non V4L2 control it is not acceptable, leave it 0.
00072     */
00073     int class_id;
00074     int group;
00075 } control;
00076 
00077 struct _globals {
00078     int stop;
00079 
00080     /* input plugin */
00081     input in[MAX_INPUT_PLUGINS];
00082     int incnt;
00083 
00084     /* output plugin */
00085     output out[MAX_OUTPUT_PLUGINS];
00086     int outcnt;
00087 
00088     /* pointer to control functions */
00089     //int (*control)(int command, char *details);
00090 };
00091 
00092 #endif


corobot_pantilt
Author(s):
autogenerated on Wed Aug 26 2015 11:10:04