v4lframe.h
00001 //========================================================================== 00002 // 00003 // Project: libfg - Frame Grabber interface for Linux 00004 // 00005 // Module: Frame interface 00006 // 00007 // Description: Each frame captured by the FRAMEGRABBER returns a FRAME 00008 // (defined here). It contains the raw frame data, as well 00009 // as information about the frame's size and format. 00010 // 00011 // Author: Gavin Baker <gavinb@antonym.org> 00012 // 00013 // Homepage: http://www.antonym.org/libfg 00014 // 00015 //-------------------------------------------------------------------------- 00016 // 00017 // libfg - Frame Grabber interface for Linux 00018 // Copyright (c) 2002 Gavin Baker 00019 // 00020 // This library is free software; you can redistribute it and/or 00021 // modify it under the terms of the GNU Lesser General Public 00022 // License as published by the Free Software Foundation; either 00023 // version 2.1 of the License, or (at your option) any later version. 00024 // 00025 // This library is distributed in the hope that it will be useful, 00026 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00028 // Lesser General Public License for more details. 00029 // 00030 // You should have received a copy of the GNU Lesser General Public 00031 // License along with this library; if not, write to the Free Software 00032 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00033 // or obtain a copy from the GNU website at http://www.gnu.org/ 00034 // 00035 //========================================================================== 00036 00037 #ifndef __V4LFRAME_H__ 00038 #define __V4LFRAME_H__ 00039 00040 //========================================================================== 00041 // Types 00042 //========================================================================== 00043 00044 #include <stddef.h> 00045 00046 //-------------------------------------------------------------------------- 00047 // 00048 // Type: FRAME 00049 // 00050 // Description: Represents a single image in the output from the 00051 // frame grabber. Carries with it the dimensions, 00052 // format and the data buffer. The type of the data 00053 // depends on the format flag (uses the VIDEO_* flags from 00054 // Video4Linux), so RGB24 would be a triplet of chars, 00055 // while RGB32 would be an int. 00056 // 00057 //-------------------------------------------------------------------------- 00058 00059 #ifndef VIDEO_PALETTE_JPEG 00060 #define VIDEO_PALETTE_JPEG 21 00061 #endif 00062 00063 typedef struct 00064 { 00065 int width; 00066 int height; 00067 int depth; 00068 int format; 00069 size_t size; 00070 void* data; 00071 00072 } FRAME; 00073 00074 00075 typedef struct 00076 { 00077 char red; 00078 char green; 00079 char blue; 00080 } FRAME_RGB; 00081 00082 00083 //========================================================================== 00084 // Prototypes 00085 //========================================================================== 00086 00087 //-------------------------------------------------------------------------- 00088 00089 FRAME* frame_new( int width, int height, int format ); 00090 00091 void frame_release( FRAME* fr ); 00092 00093 void* frame_get_data( FRAME* fr ); 00094 00095 int frame_get_size( FRAME* fr ); 00096 00097 int frame_get_width( FRAME* fr ); 00098 00099 int frame_get_height( FRAME* fr ); 00100 00101 int frame_save( FRAME* fr, const char* filename ); 00102 00103 //========================================================================== 00104 00105 #endif /* __V4LFRAME_H__ */