v4lframe.h
1 //==========================================================================
2 //
3 // Project: libfg - Frame Grabber interface for Linux
4 //
5 // Module: Frame interface
6 //
7 // Description: Each frame captured by the FRAMEGRABBER returns a FRAME
8 // (defined here). It contains the raw frame data, as well
9 // as information about the frame's size and format.
10 //
11 // Author: Gavin Baker <gavinb@antonym.org>
12 //
13 // Homepage: http://www.antonym.org/libfg
14 //
15 //--------------------------------------------------------------------------
16 //
17 // libfg - Frame Grabber interface for Linux
18 // Copyright (c) 2002 Gavin Baker
19 //
20 // This library is free software; you can redistribute it and/or
21 // modify it under the terms of the GNU Lesser General Public
22 // License as published by the Free Software Foundation; either
23 // version 2.1 of the License, or (at your option) any later version.
24 //
25 // This library is distributed in the hope that it will be useful,
26 // but WITHOUT ANY WARRANTY; without even the implied warranty of
27 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 // Lesser General Public License for more details.
29 //
30 // You should have received a copy of the GNU Lesser General Public
31 // License along with this library; if not, write to the Free Software
32 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 // or obtain a copy from the GNU website at http://www.gnu.org/
34 //
35 //==========================================================================
36 
37 #ifndef __V4LFRAME_H__
38 #define __V4LFRAME_H__
39 
40 //==========================================================================
41 // Types
42 //==========================================================================
43 
44 #include <stddef.h>
45 
46 //--------------------------------------------------------------------------
47 //
48 // Type: FRAME
49 //
50 // Description: Represents a single image in the output from the
51 // frame grabber. Carries with it the dimensions,
52 // format and the data buffer. The type of the data
53 // depends on the format flag (uses the VIDEO_* flags from
54 // Video4Linux), so RGB24 would be a triplet of chars,
55 // while RGB32 would be an int.
56 //
57 //--------------------------------------------------------------------------
58 
59 #ifndef VIDEO_PALETTE_JPEG
60 #define VIDEO_PALETTE_JPEG 21
61 #endif
62 
63 typedef struct
64 {
65  int width;
66  int height;
67  int depth;
68  int format;
69  size_t size;
70  void* data;
71 
72 } FRAME;
73 
74 
75 typedef struct
76 {
77  char red;
78  char green;
79  char blue;
80 } FRAME_RGB;
81 
82 
83 //==========================================================================
84 // Prototypes
85 //==========================================================================
86 
87 //--------------------------------------------------------------------------
88 
89 FRAME* frame_new( int width, int height, int format );
90 
91 void frame_release( FRAME* fr );
92 
93 void* frame_get_data( FRAME* fr );
94 
95 int frame_get_size( FRAME* fr );
96 
97 int frame_get_width( FRAME* fr );
98 
99 int frame_get_height( FRAME* fr );
100 
101 int frame_save( FRAME* fr, const char* filename );
102 
103 //==========================================================================
104 
105 #endif /* __V4LFRAME_H__ */
Definition: v4lframe.h:75
Definition: v4lframe.h:63