mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
ffmpegthumbs: cleanup and fix build with recenet versions of FFmpeg
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c4d7d641bf
commit
2e8a411109
3 changed files with 26 additions and 9 deletions
|
@ -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,7 +32,13 @@ 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})
|
||||
|
||||
|
@ -31,6 +46,6 @@ install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_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()
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue