input.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 #include <syslog.h>
00024 #include "mjpg_streamer.h"
00025 #define INPUT_PLUGIN_PREFIX " i: "
00026 #define IPRINT(...) { char _bf[1024] = {0}; snprintf(_bf, sizeof(_bf)-1, __VA_ARGS__); fprintf(stderr, "%s", INPUT_PLUGIN_PREFIX); fprintf(stderr, "%s", _bf); syslog(LOG_INFO, "%s", _bf); }
00027 
00028 /* parameters for input plugin */
00029 typedef struct _input_parameter input_parameter;
00030 struct _input_parameter {
00031     int id;
00032     char *parameters;
00033     int argc;
00034     char *argv[MAX_PLUGIN_ARGUMENTS];
00035     struct _globals *global;
00036 };
00037 
00038 typedef struct _input_resolution input_resolution;
00039 struct _input_resolution {
00040     unsigned int width;
00041     unsigned int height;
00042 };
00043 
00044 typedef struct _input_format input_format;
00045 struct _input_format {
00046     struct v4l2_fmtdesc format;
00047     input_resolution *supportedResolutions;
00048     int resolutionCount;
00049     char currentResolution;
00050 };
00051 
00052 /* structure to store variables/functions for input plugin */
00053 typedef struct _input input;
00054 struct _input {
00055     char *plugin;
00056     void *handle;
00057 
00058     input_parameter param; // this holds the command line arguments
00059 
00060     // input plugin parameters
00061     struct _control *in_parameters;
00062     int parametercount;
00063 
00064 
00065     struct v4l2_jpegcompression jpegcomp;
00066 
00067     /* signal fresh frames */
00068     pthread_mutex_t db;
00069     pthread_cond_t  db_update;
00070 
00071     /* global JPG frame, this is more or less the "database" */
00072     unsigned char *buf;
00073     int size;
00074 
00075     /* v4l2_buffer timestamp */
00076     struct timeval timestamp;
00077 
00078     input_format *in_formats;
00079     int formatCount;
00080     int currentFormat; // holds the current format number
00081 
00082     int (*init)(input_parameter *, int id);
00083     int (*stop)(int);
00084     int (*run)(int);
00085     int (*cmd)(int plugin, unsigned int control_id, unsigned int group, int value);
00086 };


corobot_pantilt
Author(s):
autogenerated on Sun Oct 5 2014 23:18:21