00001 /* 00002 * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de> 00003 * 00004 * This file is part of avcap. 00005 * 00006 * avcap is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * avcap is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with avcap. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 /* avcap is free for non-commercial use. 00021 * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>. 00022 */ 00023 00024 00025 #ifndef V4L1_FORMATMANAGER_H_ 00026 #define V4L1_FORMATMANAGER_H_ 00027 00028 #include <linux/videodev.h> 00029 00030 #include "FormatManager.h" 00031 00032 namespace avcap 00033 { 00034 class V4L1_DeviceDescriptor; 00035 00037 00042 class V4L1_FormatManager: public FormatManager 00043 { 00044 private: 00045 struct fmtdesc { 00046 char description[32]; 00047 __u16 palette; 00048 __u32 fourcc; 00049 float sizefactor; 00050 }; 00051 00052 static const int mNumDescriptors = 18; 00053 00054 static const fmtdesc mDescriptors[mNumDescriptors]; 00055 00056 bool mIsOVFX2; 00057 00058 public: 00059 V4L1_FormatManager(V4L1_DeviceDescriptor *dd); 00060 00061 virtual ~V4L1_FormatManager(); 00062 00063 int setFormat(Format *fmt); 00064 00065 int setFormat(unsigned int fourcc); 00066 00067 Format* getFormat(); 00068 00069 int setResolution(int w, int h); 00070 00071 int setBytesPerLine(int bpl); 00072 00073 int getWidth(); 00074 00075 int getHeight(); 00076 00077 int getBytesPerLine(); 00078 00079 int flush(); 00080 00081 size_t getImageSize(); 00082 00083 const VideoStandard* getVideoStandard(); 00084 00085 int setVideoStandard(const VideoStandard* std); 00086 00088 int setFramerate(int fps); 00089 00090 int getFramerate(); 00091 00092 __u16 getPalette(); 00093 00094 void query(); 00095 00096 private: 00097 int getParams(); 00098 00099 void queryResolutions(); 00100 00101 __u16 getPalette(__u32 fourcc); 00102 00103 int updateDimensions(); 00104 }; 00105 } 00106 00107 #endif //V4L1_FORMATMANAGER_H_