diff --git a/ffmpegthumbs/CMakeLists.txt b/ffmpegthumbs/CMakeLists.txt index 1ef629ac..4dee4925 100644 --- a/ffmpegthumbs/CMakeLists.txt +++ b/ffmpegthumbs/CMakeLists.txt @@ -1,5 +1,14 @@ project(ffmpegthumbs) +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + find_package(KDE4 4.14.3 REQUIRED) + include(KDE4Defaults) + include_directories(${KDE4_INCLUDES}) + + add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) + add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) +endif() + find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT SWSCALE) include_directories( @@ -23,14 +32,20 @@ set(ffmpegthumbs_PART_SRCS kde4_add_plugin(ffmpegthumbs ${ffmpegthumbs_PART_SRCS}) -target_link_libraries(ffmpegthumbs ${KDE4_KIO_LIBS} ${AVUTIL_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${SWSCALE_LIBRARIES} ) +target_link_libraries(ffmpegthumbs + ${KDE4_KIO_LIBS} + ${AVUTIL_LIBRARIES} + ${AVFORMAT_LIBRARIES} + ${AVCODEC_LIBRARIES} + ${SWSCALE_LIBRARIES} +) install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### -install(FILES ffmpegthumbs.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install(FILES ffmpegthumbs.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -if (KDE4_BUILD_TESTS) +if(ENABLE_TESTING) add_subdirectory(tests) -endif (KDE4_BUILD_TESTS) +endif() diff --git a/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp b/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp index 7c64b76c..b1a27aec 100644 --- a/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp +++ b/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.cpp @@ -285,13 +285,15 @@ bool MovieDecoder::getVideoPacket() void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, VideoFrame& videoFrame) { +#ifdef FF_API_DEINTERLACE if (m_pFrame->interlaced_frame) { avpicture_deinterlace((AVPicture*) m_pFrame, (AVPicture*) m_pFrame, m_pVideoCodecContext->pix_fmt, m_pVideoCodecContext->width, m_pVideoCodecContext->height); } +#endif int scaledWidth, scaledHeight; - convertAndScaleFrame(PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight); + convertAndScaleFrame(AV_PIX_FMT_RGB24, scaledSize, maintainAspectRatio, scaledWidth, scaledHeight); videoFrame.width = scaledWidth; videoFrame.height = scaledHeight; @@ -302,7 +304,7 @@ void MovieDecoder::getScaledVideoFrame(int scaledSize, bool maintainAspectRatio, memcpy((&(videoFrame.frameData.front())), m_pFrame->data[0], videoFrame.lineSize * videoFrame.height); } -void MovieDecoder::convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight) +void MovieDecoder::convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight) { calculateDimensions(scaledSize, maintainAspectRatio, scaledWidth, scaledHeight); SwsContext* scaleContext = sws_getContext(m_pVideoCodecContext->width, m_pVideoCodecContext->height, @@ -355,7 +357,7 @@ void MovieDecoder::calculateDimensions(int squareSize, bool maintainAspectRatio, } } -void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format) +void MovieDecoder::createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format) { *avFrame = av_frame_alloc(); diff --git a/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h b/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h index 28889268..cb496705 100644 --- a/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h +++ b/ffmpegthumbs/ffmpegthumbnailer/moviedecoder.h @@ -52,8 +52,8 @@ private: bool decodeVideoPacket(); bool getVideoPacket(); - void convertAndScaleFrame(PixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight); - void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, PixelFormat format); + void convertAndScaleFrame(AVPixelFormat format, int scaledSize, bool maintainAspectRatio, int& scaledWidth, int& scaledHeight); + void createAVFrame(AVFrame** avFrame, quint8** frameBuffer, int width, int height, AVPixelFormat format); void calculateDimensions(int squareSize, bool maintainAspectRatio, int& destWidth, int& destHeight); private: