Commit 80359c86 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Preparing optional JPEG requirement

parent e3aafc3c
......@@ -98,11 +98,14 @@ target_link_libraries(${PROJECT_NAME} ${SQLITE3_LIBRARIES})
if (${WITH_VLC})
find_package(LIBVLC REQUIRED)
# Since VLC include a thumbnailer, we need libjpeg to encode the result
find_package(JPEG REQUIRED)
find_package(JPEG)
target_link_libraries( ${PROJECT_NAME} ${LIBVLC_LIBRARY} )
target_link_libraries( ${PROJECT_NAME} ${JPEG_LIBRARIES} )
include_directories(${LIBVLC_INCLUDE_DIR})
if (${JPEG_FOUND})
include_directories(${JPEG_INCLUDE_DIR})
target_link_libraries( ${PROJECT_NAME} ${JPEG_LIBRARIES} )
add_definitions(-DWITH_JPEG)
endif()
set(LIBVLCPP_DIR "" CACHE PATH "Path to libvlcpp's directory")
include_directories(${LIBVLCPP_DIR})
endif()
......
......@@ -182,14 +182,15 @@ bool VLCThumbnailer::takeSnapshot(FilePtr file, VLC::MediaPlayer &mp, void *data
bool VLCThumbnailer::compress(uint8_t* buff, FilePtr file, void *data)
{
jpeg_compress_struct compInfo;
jpeg_error_mgr jerr;
JSAMPROW row_pointer[1];
auto path = m_ml->snapshotPath();
path += "/";
path += std::to_string( file->id() ) + ".jpg";
#ifdef WITH_JPEG
jpeg_compress_struct compInfo;
jpeg_error_mgr jerr;
JSAMPROW row_pointer[1];
compInfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&compInfo);
......@@ -222,6 +223,9 @@ bool VLCThumbnailer::compress(uint8_t* buff, FilePtr file, void *data)
}
jpeg_finish_compress(&compInfo);
jpeg_destroy_compress(&compInfo);
#else
#error FIXME
#endif
m_cb->done( file, StatusSuccess, data );
file->setSnapshot( path );
......
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