Instrument Neutral Distributed Interface INDI  2.0.2
v4l2_decode.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 by Jasem Mutlaq <mutlaqja@ikarustech.com>
3  Copyright (C) 2014 by geehalel <geehalel@gmail.com>
4 
5  V4L2 Decode
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 */
22 
23 #pragma once
24 
25 #include "indidevapi.h"
26 
27 #include <vector>
28 
29 #include <stdio.h>
30 #include <cstdlib>
31 
32 #include <linux/videodev2.h>
33 
35 {
36  public:
37  V4L2_Decoder();
38  virtual ~V4L2_Decoder();
39 
40  virtual void init() = 0;
41  virtual const char *getName();
42  virtual bool setcrop(struct v4l2_crop c) = 0;
43  virtual void resetcrop() = 0;
44  virtual void usesoftcrop(bool c) = 0;
45  virtual void setformat(struct v4l2_format f, bool use_ext_pix_format) = 0;
46  virtual bool issupportedformat(unsigned int format) = 0;
47  virtual const std::vector<unsigned int> &getsupportedformats() = 0;
48  virtual void decode(unsigned char *frame, struct v4l2_buffer *buf, bool native) = 0;
49  virtual unsigned char *getY() = 0;
50  virtual unsigned char *getU() = 0;
51  virtual unsigned char *getV() = 0;
52  virtual unsigned char *getMJPEGBuffer(int &size) = 0;
53  virtual unsigned char *getRGBBuffer() = 0;
54  virtual float *getLinearY() = 0;
55  virtual int getBpp() = 0;
56  virtual void setQuantization(bool) = 0;
57  virtual void setLinearization(bool) = 0;
58 
59  protected:
60  const char *name;
61 };
62 
64 {
65  public:
66  V4L2_Decode();
67  ~V4L2_Decode();
68  std::vector<V4L2_Decoder *> getDecoderList();
71  void setDecoder(V4L2_Decoder *decoder);
72 
73  protected:
74  std::vector<V4L2_Decoder *> decoder_list;
77 };
V4L2_Decoder * current_decoder
Definition: v4l2_decode.h:75
V4L2_Decoder * getDefaultDecoder()
Definition: v4l2_decode.cpp:64
std::vector< V4L2_Decoder * > decoder_list
Definition: v4l2_decode.h:74
V4L2_Decoder * getDecoder()
Definition: v4l2_decode.cpp:60
std::vector< V4L2_Decoder * > getDecoderList()
Definition: v4l2_decode.cpp:55
void setDecoder(V4L2_Decoder *decoder)
Definition: v4l2_decode.cpp:68
V4L2_Decoder * default_decoder
Definition: v4l2_decode.h:76
virtual unsigned char * getU()=0
virtual void setQuantization(bool)=0
virtual void resetcrop()=0
virtual unsigned char * getMJPEGBuffer(int &size)=0
virtual unsigned char * getV()=0
virtual void decode(unsigned char *frame, struct v4l2_buffer *buf, bool native)=0
virtual void setformat(struct v4l2_format f, bool use_ext_pix_format)=0
virtual void setLinearization(bool)=0
virtual void init()=0
virtual ~V4L2_Decoder()
Definition: v4l2_decode.cpp:30
virtual unsigned char * getY()=0
virtual int getBpp()=0
const char * name
Definition: v4l2_decode.h:60
virtual unsigned char * getRGBBuffer()=0
virtual float * getLinearY()=0
virtual bool issupportedformat(unsigned int format)=0
virtual bool setcrop(struct v4l2_crop c)=0
virtual void usesoftcrop(bool c)=0
virtual const std::vector< unsigned int > & getsupportedformats()=0
virtual const char * getName()
Definition: v4l2_decode.cpp:34
Interface to the reference INDI C API device implementation on the Device Driver side.