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(
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()
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;
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,
}
}
-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();
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: