aboutsummaryrefslogtreecommitdiffstats
path: root/src/v4l.h
blob: 89260c63ec527d3ac1a03f9b06c41f28d58f244c (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef CAMORAMA_V4L_H
#define CAMORAMA_V4L_H

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <gio/gio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <gtk/gtk.h>
#include <linux/types.h>
#include <linux/videodev2.h>
#include <libv4l2.h>
#include <signal.h>
#include <png.h>
#include <gconf/gconf-client.h>

#include "camorama-filter-chain.h"

typedef enum {
   PICMAX = 0,
   PICMIN = 1,
   PICHALF = 2
} CamoImageSize;

enum {
   JPEG = 0,
   PNG = 1,
   PPM = 2
};

struct buffer_start_len {
   void   *start;
   size_t length;
};

struct resolutions {
    int x, y;
};

typedef struct camera {
   int dev;
   int width;
   int height;
   int bpp;
   int desk_depth;
   CamoImageSize size;
   char name[32];
   int contrast, brightness, whiteness, colour, hue, bytesperline;
   unsigned int pixformat;
   int frame_number;

   int min_width, min_height, max_width, max_height;

   int n_res;
   struct resolutions *res;

   char *video_dev;
   unsigned char *image;
   gchar *capturefile, *rcapturefile;
   gchar *pixdir, *host, *proto, *rdir, *uri;
   int savetype, rsavetype;
   gchar *ts_string;
   gchar *date_format;
   gboolean debug, read, hidden;
   gboolean cap, rcap, acap, show_adjustments, show_effects;
   gboolean timestamp, rtimestamp, usedate, usestring;
   gboolean rtimefn, timefn;
   GtkWidget *da, *tray_tooltip, *status;
   unsigned char *pic_buf, *tmp;
   guint timeout_id, idle_id;
   guint32 timeout_interval;
   GConfClient *gc;
   GtkBuilder *xml;
   GtkStatusIcon *tray_icon;

   CamoramaFilterChain* filter_chain;

   gboolean rdir_ok;
   GFile *rdir_file;
   GMountOperation *rdir_mop;

   /* Buffer handling - should be used only inside v4l.c */
   struct v4l2_requestbuffers req;
   unsigned int n_buffers;
   struct  {
      void   *start;
      size_t length;
   } *buffers;
} cam;

void camera_cap (cam *);
void print_cam (cam *);
void try_set_win_info(cam * cam, int *x, int *y);
void set_win_info (cam * cam);
void get_pic_info (cam *);
void get_win_info (cam *);
void get_supported_resolutions(cam * cam);
void start_streaming(cam * cam);
void capture_buffers(cam * cam, unsigned char *outbuf, int len);
void stop_streaming(cam * cam);

#endif /* !CAMORAMA_V4L_H */

Privacy Policy