Instrument Neutral Distributed Interface INDI  2.0.2
mjpegencoder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2017 by Jasem Mutlaq <mutlaqja@ikarustech.com>
3 
4  MJPEG Encoder Interface
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 */
21 
22 #pragma once
23 
24 #include "encoderinterface.h"
25 
26 namespace INDI
27 {
28 
35 {
36  public:
37  MJPEGEncoder();
38  ~MJPEGEncoder();
39 
40  virtual bool upload(INDI::WidgetViewBlob *bp, const uint8_t *buffer, uint32_t nbytes, bool isCompressed = false) override;
41 
42  private:
43  const char *getDeviceName();
44  int jpeg_compress_8u_gray (const uint8_t * src, uint16_t width, uint16_t height, int stride, int scale, uint8_t * dest,
45  int * destsize, int quality);
46  int jpeg_compress_8u_rgb (const uint8_t * src, uint16_t width, uint16_t height, int stride, int scale, uint8_t * dest,
47  int * destsize, int quality);
48  uint8_t *jpegBuffer = nullptr;
49  uint16_t jpegBufferSize = 1;
50 
51  static const int SCALE_WIDTH = 640;
52 
53 };
54 
55 }
The EncoderInterface class is the base class for video streaming encoders.
The MJPEGEncoder class encodes frames in JPEG format before transmitting them to the client.
Definition: mjpegencoder.h:35
virtual bool upload(INDI::WidgetViewBlob *bp, const uint8_t *buffer, uint32_t nbytes, bool isCompressed=false) override
std::vector< uint8_t > buffer
Namespace to encapsulate INDI client, drivers, and mediator classes.