Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
FFmpeg Thumbnailer
Commits
4996f994
Commit
4996f994
authored
Nov 07, 2015
by
Kai Uwe Broulik
🍇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'frameworks'
CCMAIL: release-team@kde.org
parents
80ddfe73
57664887
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
26 deletions
+33
-26
CMakeLists.txt
CMakeLists.txt
+19
-10
ffmpegthumbnailer.cpp
ffmpegthumbnailer.cpp
+1
-2
ffmpegthumbnailer/imagewriter.cpp
ffmpegthumbnailer/imagewriter.cpp
+0
-1
ffmpegthumbnailer/moviedecoder.cpp
ffmpegthumbnailer/moviedecoder.cpp
+11
-11
tests/CMakeLists.txt
tests/CMakeLists.txt
+2
-2
No files found.
CMakeLists.txt
View file @
4996f994
find_package
(
KDE4 REQUIRED
)
include
(
KDE4Defaults
)
include
(
MacroLibrary
)
project
(
ffmpegthumbs
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
cmake_minimum_required
(
VERSION 2.8.12 FATAL_ERROR
)
set
(
QT_MIN_VERSION
"5.2.0"
)
find_package
(
ECM 1.0.0 REQUIRED NO_MODULE
)
set
(
CMAKE_MODULE_PATH
${
ECM_MODULE_PATH
}
${
ECM_KDE_MODULE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
include
(
FeatureSummary
)
include
(
WriteBasicConfigVersionFile
)
include
(
KDEInstallDirs
)
include
(
KDECMakeSettings
)
include
(
KDECompilerSettings
)
find_package
(
Qt5
${
QT_MIN_VERSION
}
CONFIG REQUIRED COMPONENTS Gui
)
find_package
(
KF5 REQUIRED COMPONENTS KIO
)
find_package
(
FFmpeg COMPONENTS AVCODEC AVFORMAT SWSCALE
)
include_directories
(
${
KDE4_INCLUDES
}
${
CMAKE_CURRENT_BINARY_DIR
}
${
PC_AVCODEC_INCLUDEDIR
}
${
PC_AVFORMAT_INCLUDEDIR
}
...
...
@@ -25,9 +34,9 @@ set( ffmpegthumbs_PART_SRCS
ffmpegthumbnailer/videothumbnailer.cpp
)
kde4_add_plugin
(
ffmpegthumbs
${
ffmpegthumbs_PART_SRCS
}
)
add_library
(
ffmpegthumbs
MODULE
${
ffmpegthumbs_PART_SRCS
}
)
target_link_libraries
(
ffmpegthumbs
${
KDE4_KIO_LIBS
}
${
AVUTIL_LIBRARIES
}
${
AVFORMAT_LIBRARIES
}
${
AVCODEC_LIBRARIES
}
${
SWSCALE_LIBRARIES
}
)
target_link_libraries
(
ffmpegthumbs
Qt5::Gui KF5::KIOWidgets
${
AVUTIL_LIBRARIES
}
${
AVFORMAT_LIBRARIES
}
${
AVCODEC_LIBRARIES
}
${
SWSCALE_LIBRARIES
}
)
install
(
TARGETS ffmpegthumbs DESTINATION
${
PLUGIN_INSTALL_DIR
}
)
...
...
@@ -35,6 +44,6 @@ install(TARGETS ffmpegthumbs DESTINATION ${PLUGIN_INSTALL_DIR})
install
(
FILES ffmpegthumbs.desktop DESTINATION
${
SERVICES_INSTALL_DIR
}
)
if
(
KDE4_
BUILD_TEST
S
)
add_subdirectory
(
tests
)
endif
(
KDE4_BUILD_TESTS
)
if
(
BUILD_TEST
ING
)
add_subdirectory
(
tests
)
endif
(
)
ffmpegthumbnailer.cpp
View file @
4996f994
...
...
@@ -15,12 +15,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "ffmpegthumbnailer.h"
#include <kdebug.h>
#include <QImage>
extern
"C"
{
KDE
_EXPORT
ThumbCreator
*
new_creator
()
Q_DECL
_EXPORT
ThumbCreator
*
new_creator
()
{
return
new
FFMpegThumbnailer
();
}
...
...
ffmpegthumbnailer/imagewriter.cpp
View file @
4996f994
...
...
@@ -15,7 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "imagewriter.h"
#include <kdebug.h>
#include <iostream>
...
...
ffmpegthumbnailer/moviedecoder.cpp
View file @
4996f994
...
...
@@ -16,7 +16,7 @@
#include "moviedecoder.h"
#include <
kd
ebug
.h
>
#include <
QD
ebug>
#include <QFileInfo>
extern
"C"
{
...
...
@@ -57,12 +57,12 @@ void MovieDecoder::initialize(const QString& filename)
QFileInfo
fileInfo
(
filename
);
if
((
!
m_FormatContextWasGiven
)
&&
avformat_open_input
(
&
m_pFormatContext
,
fileInfo
.
absoluteFilePath
().
toLocal8Bit
().
data
(),
NULL
,
NULL
)
!=
0
)
{
k
Debug
()
<<
"Could not open input file: "
<<
fileInfo
.
absoluteFilePath
();
q
Debug
()
<<
"Could not open input file: "
<<
fileInfo
.
absoluteFilePath
();
return
;
}
if
(
avformat_find_stream_info
(
m_pFormatContext
,
0
)
<
0
)
{
k
Debug
()
<<
"Could not find stream information"
;
q
Debug
()
<<
"Could not find stream information"
;
return
;
}
...
...
@@ -129,7 +129,7 @@ void MovieDecoder::initializeVideo()
}
if
(
m_VideoStream
==
-
1
)
{
k
Debug
()
<<
"Could not find video stream"
;
q
Debug
()
<<
"Could not find video stream"
;
return
;
}
...
...
@@ -139,14 +139,14 @@ void MovieDecoder::initializeVideo()
if
(
m_pVideoCodec
==
NULL
)
{
// set to NULL, otherwise avcodec_close(m_pVideoCodecContext) crashes
m_pVideoCodecContext
=
NULL
;
k
Debug
()
<<
"Video Codec not found"
;
q
Debug
()
<<
"Video Codec not found"
;
return
;
}
m_pVideoCodecContext
->
workaround_bugs
=
1
;
if
(
avcodec_open2
(
m_pVideoCodecContext
,
m_pVideoCodec
,
0
)
<
0
)
{
k
Debug
()
<<
"Could not open video codec"
;
q
Debug
()
<<
"Could not open video codec"
;
}
}
...
...
@@ -193,7 +193,7 @@ void MovieDecoder::seek(int timeInSeconds)
if
(
ret
>=
0
)
{
avcodec_flush_buffers
(
m_pFormatContext
->
streams
[
m_VideoStream
]
->
codec
);
}
else
{
k
Debug
()
<<
"Seeking in video failed"
;
q
Debug
()
<<
"Seeking in video failed"
;
return
;
}
...
...
@@ -214,7 +214,7 @@ void MovieDecoder::seek(int timeInSeconds)
}
while
((
!
gotFrame
||
!
m_pFrame
->
key_frame
)
&&
keyFrameAttempts
<
200
);
if
(
gotFrame
==
0
)
{
k
Debug
()
<<
"Seeking in video failed"
;
q
Debug
()
<<
"Seeking in video failed"
;
}
}
...
...
@@ -228,7 +228,7 @@ void MovieDecoder::decodeVideoFrame()
}
if
(
!
frameFinished
)
{
k
Debug
()
<<
"decodeVideoFrame() failed: frame not finished"
;
q
Debug
()
<<
"decodeVideoFrame() failed: frame not finished"
;
return
;
}
}
...
...
@@ -250,7 +250,7 @@ bool MovieDecoder::decodeVideoPacket()
#endif
if
(
bytesDecoded
<
0
)
{
k
Debug
()
<<
"Failed to decode video frame: bytesDecoded < 0"
;
q
Debug
()
<<
"Failed to decode video frame: bytesDecoded < 0"
;
}
return
(
frameFinished
>
0
);
...
...
@@ -310,7 +310,7 @@ void MovieDecoder::convertAndScaleFrame(PixelFormat format, int scaledSize, bool
format
,
SWS_BICUBIC
,
NULL
,
NULL
,
NULL
);
if
(
NULL
==
scaleContext
)
{
k
Debug
()
<<
"Failed to create resize context"
;
q
Debug
()
<<
"Failed to create resize context"
;
return
;
}
...
...
tests/CMakeLists.txt
View file @
4996f994
...
...
@@ -17,9 +17,9 @@ set(ffmpegthumbtest_SRCS ffmpegthumbtest.cpp
)
kde4_
add_executable
(
ffmpegthumbtest
${
ffmpegthumbtest_SRCS
}
)
add_executable
(
ffmpegthumbtest
${
ffmpegthumbtest_SRCS
}
)
target_link_libraries
(
ffmpegthumbtest
${
KDE4_KDECORE_LIBS
}
${
KDE4_KIO_LIBS
}
${
AVUTIL_LIBRARIES
}
${
AVFORMAT_LIBRARIES
}
${
AVCODEC_LIBRARIES
}
${
SWSCALE_LIBRARIES
}
)
target_link_libraries
(
ffmpegthumbtest
Qt5::Gui KF5::KIOWidgets
${
AVUTIL_LIBRARIES
}
${
AVFORMAT_LIBRARIES
}
${
AVCODEC_LIBRARIES
}
${
SWSCALE_LIBRARIES
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment