Commit 6ba9af8d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLCThumbnailer: Try to cope with different libjpeg & evas fourccs

parent b6da785f
......@@ -25,6 +25,13 @@
#include <cstring>
#ifdef WITH_JPEG
#include <jpeglib.h>
#if ( !defined(JPEG_LIB_VERSION_MAJOR) && !defined(JPEG_LIB_VERSION_MINOR) ) || \
( JPEG_LIB_VERSION_MAJOR <= 8 && JPEG_LIB_VERSION_MINOR < 4 )
//FIXME: I don't think we can expect this to work without VLC outputing BGR...
#define JPEG_COLORSPACE JCS_EXT_BGR
#else
#define JPEG_COLORSPACE JCS_RGB
#endif
#elif defined(WITH_EVAS)
#include <Evas_Engine_Buffer.h>
#endif
......@@ -182,7 +189,7 @@ void VLCThumbnailer::setupVout( VLC::MediaPlayer& mp )
mp.setVideoFormatCallbacks(
// Setup
[this, &mp](char* chroma, unsigned int* width, unsigned int *height, unsigned int *pitches, unsigned int *lines) {
strcpy( chroma, "RV32" );
strcpy( chroma, VLC_FOURCC );
const float inputAR = (float)*width / *height;
......@@ -316,12 +323,7 @@ bool VLCThumbnailer::compress( std::shared_ptr<Media> file, void *data )
compInfo.image_width = DesiredWidth;
compInfo.image_height = DesiredHeight;
compInfo.input_components = Bpp;
#if ( !defined(JPEG_LIB_VERSION_MAJOR) && !defined(JPEG_LIB_VERSION_MINOR) ) || \
( JPEG_LIB_VERSION_MAJOR <= 8 && JPEG_LIB_VERSION_MINOR < 4 )
compInfo.in_color_space = JCS_EXT_BGR;
#else
compInfo.in_color_space = JCS_RGB;
#endif
compInfo.in_color_space = JPEG_COLORSPACE;
jpeg_set_defaults( &compInfo );
jpeg_set_quality( &compInfo, 85, TRUE );
......
......@@ -32,6 +32,16 @@
#include "IMetadataService.h"
#ifdef WITH_JPEG
#define BPP 3
#define VLC_FOURCC "RV24"
#elif defined(WITH_EVAS)
#define BPP 4
#define VLC_FOURCC "RV32"
#else
#error No compression strategy
#endif
class VLCThumbnailer : public IMetadataService
{
public:
......@@ -52,7 +62,7 @@ private:
// Force a base width, let height be computed depending on A/R
static const uint32_t DesiredWidth = 320;
static const uint32_t DesiredHeight = 200; // Aim for a 16:10 thumbnail
static const uint8_t Bpp = 4;
static const uint8_t Bpp = BPP;
private:
VLC::Instance m_instance;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment