diff options
Diffstat (limited to 'src/img_encoder.cc')
-rw-r--r-- | src/img_encoder.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/img_encoder.cc b/src/img_encoder.cc index 1516fc0..9282dc0 100644 --- a/src/img_encoder.cc +++ b/src/img_encoder.cc @@ -37,6 +37,10 @@ #include "debug.h" +extern "C" { +#include <jpeglib.h> +} + #include "jpeg_mem_dest.h" // Use libdv @@ -103,12 +107,14 @@ void ImgEncoder::encode(Frame *dvframe, int quality) unsigned char rgb[720*576*4]; getRGB(dvframe, rgb); - writeJPEGFile(quality, (JSAMPLE*)rgb, 720, 576); + writeJPEGFile(quality, rgb, 720, 576); } -void ImgEncoder::writeJPEGFile(int quality, JSAMPLE * image_buffer, int image_width, int image_height) +void ImgEncoder::writeJPEGFile(int quality, unsigned char *rgb, int image_width, int image_height) { + JSAMPLE *image_buffer = (JSAMPLE*)rgb; + size_t buffersize = (image_width * image_height * 3) + JPEG_HEADER_PAD; char *jpeg_output_buffer = new char [buffersize]; struct jpeg_compress_struct cinfo; |