Instrument Neutral Distributed Interface INDI 2.2.5
v4l2_decode.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2005 by Jasem Mutlaq <[email protected]>
3 Copyright (C) 2014 by geehalel <[email protected]>
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#ifdef __OpenBSD__
33#include <sys/videoio.h>
34#else
35#include <linux/videodev2.h>
36#endif
37
39{
40 public:
42 virtual ~V4L2_Decoder();
43
44 virtual void init() = 0;
45 virtual const char *getName();
46 virtual bool setcrop(struct v4l2_crop c) = 0;
47 virtual void resetcrop() = 0;
48 virtual void usesoftcrop(bool c) = 0;
49 virtual void setformat(struct v4l2_format f, bool use_ext_pix_format) = 0;
50 virtual bool issupportedformat(unsigned int format) = 0;
51 virtual const std::vector<unsigned int> &getsupportedformats() = 0;
52 virtual void decode(unsigned char *frame, struct v4l2_buffer *buf, bool native) = 0;
53 virtual unsigned char *getY() = 0;
54 virtual unsigned char *getU() = 0;
55 virtual unsigned char *getV() = 0;
56 virtual unsigned char *getMJPEGBuffer(int &size) = 0;
57 virtual unsigned char *getRGBBuffer() = 0;
58 virtual float *getLinearY() = 0;
59 virtual int getBpp() = 0;
60 virtual void setQuantization(bool) = 0;
61 virtual void setLinearization(bool) = 0;
62
63 protected:
64 const char *name;
65};
66
68{
69 public:
72 std::vector<V4L2_Decoder *> getDecoderList();
75 void setDecoder(V4L2_Decoder *decoder);
76
77 protected:
78 std::vector<V4L2_Decoder *> decoder_list;
81};
V4L2_Decoder * current_decoder
Definition v4l2_decode.h:79
V4L2_Decoder * getDefaultDecoder()
std::vector< V4L2_Decoder * > decoder_list
Definition v4l2_decode.h:78
V4L2_Decoder * getDecoder()
std::vector< V4L2_Decoder * > getDecoderList()
void setDecoder(V4L2_Decoder *decoder)
V4L2_Decoder * default_decoder
Definition v4l2_decode.h:80
virtual unsigned char * getRGBBuffer()=0
virtual void setQuantization(bool)=0
virtual void resetcrop()=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 float * getLinearY()=0
virtual unsigned char * getMJPEGBuffer(int &size)=0
virtual void init()=0
virtual ~V4L2_Decoder()
virtual unsigned char * getU()=0
virtual int getBpp()=0
const char * name
Definition v4l2_decode.h:64
virtual bool issupportedformat(unsigned int format)=0
virtual bool setcrop(struct v4l2_crop c)=0
virtual unsigned char * getY()=0
virtual unsigned char * getV()=0
virtual void usesoftcrop(bool c)=0
virtual const std::vector< unsigned int > & getsupportedformats()=0
virtual const char * getName()
Interface to the reference INDI C API device implementation on the Device Driver side.