Fawkes API  Fawkes Development Version
jpeg_compressor_mmal.h
1 
2 /***************************************************************************
3  * jpeg_compressor_mmal.h - JPEG image compressor interface (using MMAL)
4  *
5  * Created: Wed Feb 05 15:12:28 2014
6  * Copyright 2005-2014 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _FIREVISION_UTILS_COMPRESSION_JPEG_COMPRESSOR_MMAL_H_
25 #define _FIREVISION_UTILS_COMPRESSION_JPEG_COMPRESSOR_MMAL_H_
26 
27 #ifndef _FIREVISION_UTILS_COMPRESSION_JPEG_COMPRESSOR_H_
28 # error Do not include jpeg_compressor_mmal.h directly, use jpeg_compressor.h
29 #endif
30 
31 #ifndef HAVE_MMAL
32 # error Cannot use MMAL JPEG Encoder without MMAL
33 #endif
34 
35 #include <fvutils/compression/imagecompressor.h>
36 
37 namespace firevision {
38 
39 class JpegImageCompressorMMAL : public ImageCompressor
40 {
41 public:
42  JpegImageCompressorMMAL(unsigned int quality = 80);
44 
45  virtual void set_image_dimensions(unsigned int width, unsigned int height);
46  virtual void set_image_buffer(colorspace_t cspace, unsigned char *buffer);
47  virtual void set_destination_buffer(unsigned char *buf, unsigned int buf_size);
48  virtual size_t compressed_size();
49  virtual void set_filename(const char *filename);
52  virtual void compress();
53  virtual size_t recommended_compressed_buffer_size();
54 
55  virtual bool supports_vflip();
56  virtual void set_vflip(bool enable);
57 
58  class State;
59 
60 private:
61  void create_encoder_component();
62  void destroy_encoder_component();
63 
64 private:
65  unsigned char *buffer_;
66 
67  unsigned int quality_;
68 
69  unsigned int width_;
70  unsigned int height_;
71 
72  const char *filename_;
73 
74  State *state_;
75  bool vflip_;
76 };
77 
78 } // end namespace firevision
79 
80 #endif
firevision::JpegImageCompressorMMAL::set_vflip
virtual void set_vflip(bool enable)
Definition: jpeg_compressor_mmal.cpp:214
firevision::JpegImageCompressorMMAL::JpegImageCompressorMMAL
JpegImageCompressorMMAL(unsigned int quality=80)
Constructor.
Definition: jpeg_compressor_mmal.cpp:190
firevision::JpegImageCompressorMMAL::recommended_compressed_buffer_size
virtual size_t recommended_compressed_buffer_size()
Definition: jpeg_compressor_mmal.cpp:396
firevision::JpegImageCompressorMMAL::set_destination_buffer
virtual void set_destination_buffer(unsigned char *buf, unsigned int buf_size)
Definition: jpeg_compressor_mmal.cpp:383
firevision::JpegImageCompressorMMAL::supports_vflip
virtual bool supports_vflip()
Definition: jpeg_compressor_mmal.cpp:208
firevision::JpegImageCompressorMMAL::set_filename
virtual void set_filename(const char *filename)
Definition: jpeg_compressor_mmal.cpp:402
firevision::JpegImageCompressorMMAL::~JpegImageCompressorMMAL
virtual ~JpegImageCompressorMMAL()
Destructor.
Definition: jpeg_compressor_mmal.cpp:201
firevision::JpegImageCompressorMMAL::compressed_size
virtual size_t compressed_size()
Definition: jpeg_compressor_mmal.cpp:390
firevision::JpegImageCompressorMMAL::set_image_buffer
virtual void set_image_buffer(colorspace_t cspace, unsigned char *buffer)
Definition: jpeg_compressor_mmal.cpp:360
firevision::JpegImageCompressorMMAL::supports_compression_destination
virtual bool supports_compression_destination(ImageCompressor::CompressionDestination cd)
Definition: jpeg_compressor_mmal.cpp:376
firevision::JpegImageCompressorMMAL::set_compression_destination
virtual void set_compression_destination(ImageCompressor::CompressionDestination cd)
Definition: jpeg_compressor_mmal.cpp:370
firevision::ImageCompressor::CompressionDestination
CompressionDestination
Where to put the compressed image.
Definition: imagecompressor.h:45
firevision::JpegImageCompressorMMAL::compress
virtual void compress()
Definition: jpeg_compressor_mmal.cpp:220
firevision::JpegImageCompressorMMAL::set_image_dimensions
virtual void set_image_dimensions(unsigned int width, unsigned int height)
Definition: jpeg_compressor_mmal.cpp:349