thumbnailers: use video_thumbnailer_set_size() if available

side note: ffmpegthumbnailer::VideoThumbnailer::setThumbnailSize(int) is
not marked as deprecated

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-18 17:05:04 +02:00
parent e59ba5664a
commit a15cc3aa4f
3 changed files with 26 additions and 0 deletions

View file

@ -1,9 +1,28 @@
project(ffmpegthumbs)
include(CheckSymbolExists)
include(CMakePushCheckState)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${FFMPEGTHUMBNAILER_INCLUDES}
)
cmake_reset_check_state()
set(CMAKE_REQUIRED_INCLUDES ${FFMPEGTHUMBNAILER_INCLUDES})
set(CMAKE_REQUIRED_LIBRARIES ${FFMPEGTHUMBNAILER_LIBRARIES})
check_symbol_exists(
video_thumbnailer_set_size
"libffmpegthumbnailer/videothumbnailerc.h"
HAVE_VIDEO_THUMBNAILER_SET_SIZE
)
cmake_reset_check_state()
configure_file (
config-ffmpegthumbnailer.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-ffmpegthumbnailer.h
)
set(ffmpegthumbs_PART_SRCS
ffmpegthumbnailer.cpp
)

View file

@ -0,0 +1,2 @@
/* Defines if you have video_thumbnailer_set_size() */
#cmakedefine HAVE_VIDEO_THUMBNAILER_SET_SIZE 1

View file

@ -16,6 +16,7 @@
Boston, MA 02110-1301, USA.
*/
#include "config-ffmpegthumbnailer.h"
#include "ffmpegthumbnailer.h"
#include <QFile>
@ -67,7 +68,11 @@ bool FFMpegThumbnailer::create(const QString &path, int width, int heigth, QImag
}
const QByteArray pathbytes = QFile::encodeName(path);
#if defined(HAVE_VIDEO_THUMBNAILER_SET_SIZE)
video_thumbnailer_set_size(ffmpegthumb, width, heigth);
#else
ffmpegthumb->thumbnail_size = qMax(width, heigth);
#endif
ffmpegthumb->seek_percentage = 20;
ffmpegthumb->overlay_film_strip = 1;
ffmpegthumb->thumbnail_image_type = ThumbnailerImageType::Png;