iceWing
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
grab.h
Go to the documentation of this file.
1 /* -*- mode: C; tab-width: 4; c-basic-offset: 4; -*- */
2 
3 /*
4  * Author: Frank Loemker
5  *
6  * Copyright (C) 1999-2009
7  * Frank Loemker, Applied Computer Science, Faculty of Technology,
8  * Bielefeld University, Germany
9  *
10  * This file is part of iceWing, a graphical plugin shell.
11  *
12  * iceWing is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * iceWing is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25  */
26 
27 #ifndef iw_grab_types_H
28 #define iw_grab_types_H
29 
30 #include "gui/Gimage.h"
31 #include "gui/Gpreview.h"
32 #include "dacs.h"
33 #include "tools/tools.h"
34 
35 #define IW_DACSNAME "icewing" /* Default DACS name */
36 
37 /* Used as a source for the default preview window size */
38 #define IW_PAL_WIDTH 768
39 #define IW_PAL_HEIGHT 576
40 
41 #define IW_OUTPUT_NONE 0
42 #define IW_OUTPUT_FUNCTION (1<<0)
43 #define IW_OUTPUT_STREAM (1<<1)
44 #define IW_OUTPUT_STATUS (1<<2)
45 
46 #define IW_GRAB_IDENT "image"
47 #define IW_GRAB_RGB_IDENT "imageRGB"
48 
49 /* Type of the data the grabbing plugin is providing for other plugins
50  under the identifiers "image" and "imageRGB" */
51 typedef struct grabImageData {
52  iwImage img; /* The image data */
53  struct timeval time; /* Time the image was grabbed */
54  int img_number; /* Consecutive number of the grabbed image */
55  char *fname; /* If image was read from a file, the name of the file */
56  int frame_number; /* Image from video file -> frame number, 0 otherwise */
57  float downw, downh; /* Down sampling, which was applied to the image */
58  void *reserved1;
59  void *reserved2;
61 
62 typedef struct grabParameter {
63  char *dname; /* Name for DACS registration */
64  int output; /* What to output via DACS (see IW_OUTPUT_...) */
66  char **rcfile; /* rc-files to load additionaly */
67  char *session; /* Session-file to load additionaly */
68  int time_cnt; /* How often time measurements are given out */
70 
71 #endif /* iw_grab_types_H */
72 
73 #ifndef IW_GRAB_TYPES
74 #ifndef iw_grab_protos_H
75 #define iw_grab_protos_H
76 
77 #include "plugin.h"
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 /*********************************************************************
84  The iceWing mainloop creates one preview window, where e.g. the grab
85  plugin displays the first image. Return a pointer to this window,
86  so that other plugins can display additional data in this window.
87 *********************************************************************/
89 
90 /*********************************************************************
91  Free img including all substructures.
92 *********************************************************************/
93 void grab_image_free (grabImageData *img);
94 
95 /*********************************************************************
96  Allocate a new image and init everything. -> Do NOT allocate any
97  image data.
98 *********************************************************************/
100 
101 /*********************************************************************
102  Return a deep copy of img.
103 *********************************************************************/
105 
106 /*********************************************************************
107  Return the grabbed image with
108  time!=NULL: a grab-time most similar to time
109  time==NULL: number img_num (0: last grabbed image) if still in
110  memory or NULL otherwise.
111  img_num<=0: return a full size image, if available
112  grab_get_image(): Use the first registered grabbing plugin.
113 *********************************************************************/
114 grabImageData* grab_get_image (int img_num, const struct timeval *time);
116  int img_num, const struct timeval *time);
117 
118 /*********************************************************************
119  Indicate that the img obtained with grab_get_image() is not needed
120  any longer.
121  grab_release_image(): Use the first registered grabbing plugin.
122 *********************************************************************/
123 void grab_release_image (const grabImageData *img);
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif /* iw_grab_protos_H */
131 #endif /* IW_GRAB_TYPES */