diff --git a/autotests/ffmpegextractortest.h b/autotests/ffmpegextractortest.h --- a/autotests/ffmpegextractortest.h +++ b/autotests/ffmpegextractortest.h @@ -21,6 +21,7 @@ #define FFMPEGEXTRACTORTEST_H #include +#include class ffmpegExtractorTest : public QObject { @@ -31,6 +32,9 @@ void testVideoProperties_data(); void testMetaData(); void testMetaData_data(); + +private: + QMimeDatabase mimeDb; }; #endif // FFMPEGEXTRACTORTEST_H diff --git a/autotests/ffmpegextractortest.cpp b/autotests/ffmpegextractortest.cpp --- a/autotests/ffmpegextractortest.cpp +++ b/autotests/ffmpegextractortest.cpp @@ -21,8 +21,10 @@ #include "simpleextractionresult.h" #include "indexerextractortestsconfig.h" #include "extractors/ffmpegextractor.h" +#include "mimeutils.h" #include +//#include using namespace KFileMetaData; @@ -39,34 +41,33 @@ void ffmpegExtractorTest::testVideoProperties_data() { QTest::addColumn("fileType"); - QTest::addColumn("mimeType"); QTest::addRow("WebM") - << QStringLiteral("webm") - << QStringLiteral("video/webm"); + << QStringLiteral("webm"); QTest::addRow("Matroska Video") - << QStringLiteral("mkv") - << QStringLiteral("video/x-matroska"); + << QStringLiteral("mkv"); QTest::addRow("Vorbis Video") - << QStringLiteral("ogv") - << QStringLiteral("video/ogg"); + << QStringLiteral("ogv"); QTest::addRow("MPEG Transport") - << QStringLiteral("ts") - << QStringLiteral("video/mp2t"); + << QStringLiteral("ts"); } // only for testing of intrinsic video properties void ffmpegExtractorTest::testVideoProperties() { QFETCH(QString, fileType); - QFETCH(QString, mimeType); + + QString fileName = testFilePath(QStringLiteral("test"), fileType); + QString mimeType = MimeUtils::strictMimeType(fileName, mimeDb).name(); FFmpegExtractor plugin{this}; - SimpleExtractionResult result(testFilePath(QLatin1String("test"), fileType), mimeType); + QVERIFY(plugin.mimetypes().contains(mimeType)); + + SimpleExtractionResult result(fileName, mimeType); plugin.extract(&result); QCOMPARE(result.types().size(), 1); @@ -81,29 +82,27 @@ void ffmpegExtractorTest::testMetaData_data() { QTest::addColumn("fileType"); - QTest::addColumn("mimeType"); QTest::addRow("WebM") - << QStringLiteral("webm") - << QStringLiteral("video/webm"); + << QStringLiteral("webm"); QTest::addRow("Matroska Video") - << QStringLiteral("mkv") - << QStringLiteral("video/x-matroska"); + << QStringLiteral("mkv"); QTest::addRow("Vorbis Video") - << QStringLiteral("ogv") - << QStringLiteral("video/ogg"); + << QStringLiteral("ogv"); } void ffmpegExtractorTest::testMetaData() { QFETCH(QString, fileType); - QFETCH(QString, mimeType); + + QString fileName = testFilePath(QStringLiteral("test"), fileType); + QString mimeType = MimeUtils::strictMimeType(fileName, mimeDb).name(); FFmpegExtractor plugin{this}; - SimpleExtractionResult result(testFilePath(QLatin1String("test"), fileType), mimeType); + SimpleExtractionResult result(fileName, mimeType); plugin.extract(&result); QEXPECT_FAIL("Vorbis Video", "Not yet supported", Abort); diff --git a/src/extractors/ffmpegextractor.cpp b/src/extractors/ffmpegextractor.cpp --- a/src/extractors/ffmpegextractor.cpp +++ b/src/extractors/ffmpegextractor.cpp @@ -61,6 +61,7 @@ QStringLiteral("video/x-ms-wmv"), QStringLiteral("video/x-ms-asf"), QStringLiteral("video/x-msvideo"), + QStringLiteral("video/x-theora+ogg"), }; QStringList FFmpegExtractor::mimetypes() const diff --git a/src/extractors/ffmpegextractor.json b/src/extractors/ffmpegextractor.json --- a/src/extractors/ffmpegextractor.json +++ b/src/extractors/ffmpegextractor.json @@ -2,17 +2,18 @@ "Name" : "FFMpegExtractor", "Id" : "org.kde.ffmpegextractor", "MimeTypes" : { - "video/mp4" : { "Version" : "0.0" }, - "video/mpeg" : { "Version" : "0.0" }, - "video/mp2t" : { "Version" : "0.0" }, - "video/ogg" : { "Version" : "0.0" }, - "video/quicktime" : { "Version" : "0.0" }, - "video/webm" : { "Version" : "0.0" }, - "video/x-flv" : { "Version" : "0.0" }, - "video/x-matroska" : { "Version" : "0.0" }, - "video/x-ms-wmv" : { "Version" : "0.0" }, - "video/x-ms-asf" : { "Version" : "0.0" }, - "video/x-msvideo" : { "Version" : "0.0" } + "video/mp4" : { "Version" : "0.0" }, + "video/mpeg" : { "Version" : "0.0" }, + "video/mp2t" : { "Version" : "0.0" }, + "video/ogg" : { "Version" : "0.0" }, + "video/quicktime" : { "Version" : "0.0" }, + "video/webm" : { "Version" : "0.0" }, + "video/x-flv" : { "Version" : "0.0" }, + "video/x-matroska" : { "Version" : "0.0" }, + "video/x-ms-wmv" : { "Version" : "0.0" }, + "video/x-ms-asf" : { "Version" : "0.0" }, + "video/x-msvideo" : { "Version" : "0.0" }, + "video/x-theora+ogg" : { "Version" : "0.0" } } }