Make ffmpeg optional.
This commit is contained in:
@@ -18,8 +18,12 @@ HEADERS += \
|
|||||||
singlecoreapplication.h \
|
singlecoreapplication.h \
|
||||||
headlessmanager.h
|
headlessmanager.h
|
||||||
|
|
||||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
DISABLE_FFMPEG {
|
||||||
|
PKGCONFIG = libvitamtp
|
||||||
|
} else {
|
||||||
|
# find packages using pkg-config
|
||||||
|
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||||
|
}
|
||||||
# Linux-only config
|
# Linux-only config
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
man_cli.files = qcma_cli.1
|
man_cli.files = qcma_cli.1
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "cmaclient.h"
|
#include "cmaclient.h"
|
||||||
#include "capability.h"
|
#include "capability.h"
|
||||||
#include "avdecoder.h"
|
|
||||||
#include "cmaevent.h"
|
#include "cmaevent.h"
|
||||||
#include "cmautils.h"
|
#include "cmautils.h"
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "cmaobject.h"
|
#include "cmaobject.h"
|
||||||
#include "sforeader.h"
|
#include "sforeader.h"
|
||||||
#include "avdecoder.h"
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "cmautils.h"
|
#include "cmautils.h"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cmautils.h"
|
#include "cmautils.h"
|
||||||
|
|
||||||
|
#ifdef FFMPEG_ENABLED
|
||||||
#include "avdecoder.h"
|
#include "avdecoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -100,6 +103,11 @@ bool removeRecursively(const QString &path)
|
|||||||
static QByteArray findFolderAlbumArt(const QString path, metadata_t *metadata)
|
static QByteArray findFolderAlbumArt(const QString path, metadata_t *metadata)
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
Q_UNUSED(path);
|
||||||
|
Q_UNUSED(metadata);
|
||||||
|
#else
|
||||||
QDir folder(path);
|
QDir folder(path);
|
||||||
|
|
||||||
QStringList files = folder.entryList(QDir::Files | QDir::Readable);
|
QStringList files = folder.entryList(QDir::Files | QDir::Readable);
|
||||||
@@ -124,6 +132,7 @@ static QByteArray findFolderAlbumArt(const QString path, metadata_t *metadata)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +146,11 @@ QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata
|
|||||||
if(file.open(QIODevice::ReadOnly)) {
|
if(file.open(QIODevice::ReadOnly)) {
|
||||||
data = file.readAll();
|
data = file.readAll();
|
||||||
}
|
}
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_UNUSED(metadata);
|
||||||
|
#else
|
||||||
} else if(MASK_SET(type, Photo)) {
|
} else if(MASK_SET(type, Photo)) {
|
||||||
AVDecoder decoder;
|
AVDecoder decoder;
|
||||||
|
|
||||||
@@ -173,6 +187,7 @@ QByteArray getThumbnail(const QString &path, DataType type, metadata_t *metadata
|
|||||||
metadata->data.thumbnail.height = height;
|
metadata->data.thumbnail.height = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ SOURCES += \
|
|||||||
sforeader.cpp \
|
sforeader.cpp \
|
||||||
cmaclient.cpp \
|
cmaclient.cpp \
|
||||||
cmabroadcast.cpp \
|
cmabroadcast.cpp \
|
||||||
avdecoder.cpp \
|
|
||||||
cmaevent.cpp \
|
cmaevent.cpp \
|
||||||
dds.cpp \
|
dds.cpp \
|
||||||
sqlitedb.cpp \
|
sqlitedb.cpp \
|
||||||
@@ -37,9 +36,15 @@ HEADERS += \
|
|||||||
qlistdb.h \
|
qlistdb.h \
|
||||||
database.h
|
database.h
|
||||||
|
|
||||||
|
DISABLE_FFMPEG {
|
||||||
|
PKGCONFIG = libvitamtp
|
||||||
|
} else {
|
||||||
|
DEFINES += FFMPEG_ENABLED
|
||||||
|
SOURCES += avdecoder.cpp
|
||||||
|
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||||
|
}
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
resources/xml/psp2-updatelist.xml
|
resources/xml/psp2-updatelist.xml
|
||||||
|
|
||||||
RESOURCES += commonrc.qrc translations.qrc
|
RESOURCES += commonrc.qrc translations.qrc
|
||||||
|
|
||||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
|
||||||
|
|||||||
@@ -18,13 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
|
#ifdef FFMPEG_ENABLED
|
||||||
#include "avdecoder.h"
|
#include "avdecoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
const file_type audio_list[] = {
|
const file_type audio_list[] = {
|
||||||
{"mp3", FILE_FORMAT_MP3, CODEC_TYPE_MP3},
|
{"mp3", FILE_FORMAT_MP3, CODEC_TYPE_MP3},
|
||||||
{"mp4", FILE_FORMAT_MP4, CODEC_TYPE_AAC},
|
{"mp4", FILE_FORMAT_MP4, CODEC_TYPE_AAC},
|
||||||
@@ -110,12 +115,17 @@ int Database::checkFileType(const QString path, int ohfi_root)
|
|||||||
|
|
||||||
void Database::loadMusicMetadata(const QString &path, metadata_t &metadata)
|
void Database::loadMusicMetadata(const QString &path, metadata_t &metadata)
|
||||||
{
|
{
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
Q_UNUSED(path);
|
||||||
|
{
|
||||||
|
#else
|
||||||
AVDecoder decoder;
|
AVDecoder decoder;
|
||||||
bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
|
bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
|
||||||
|
|
||||||
if(!skipMetadata && decoder.open(path)) {
|
if(!skipMetadata && decoder.open(path)) {
|
||||||
decoder.getAudioMetadata(metadata);
|
decoder.getAudioMetadata(metadata);
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
metadata.data.music.album = strdup("");
|
metadata.data.music.album = strdup("");
|
||||||
metadata.data.music.artist = strdup("");
|
metadata.data.music.artist = strdup("");
|
||||||
metadata.data.music.title = strdup(metadata.name);
|
metadata.data.music.title = strdup(metadata.name);
|
||||||
@@ -124,12 +134,17 @@ void Database::loadMusicMetadata(const QString &path, metadata_t &metadata)
|
|||||||
|
|
||||||
void Database::loadVideoMetadata(const QString &path, metadata_t &metadata)
|
void Database::loadVideoMetadata(const QString &path, metadata_t &metadata)
|
||||||
{
|
{
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
Q_UNUSED(path);
|
||||||
|
{
|
||||||
|
#else
|
||||||
AVDecoder decoder;
|
AVDecoder decoder;
|
||||||
bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
|
bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
|
||||||
|
|
||||||
if(!skipMetadata && decoder.open(path)) {
|
if(!skipMetadata && decoder.open(path)) {
|
||||||
decoder.getVideoMetadata(metadata);
|
decoder.getVideoMetadata(metadata);
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
metadata.data.video.title = strdup(metadata.name);
|
metadata.data.video.title = strdup(metadata.name);
|
||||||
metadata.data.video.explanation = strdup("");
|
metadata.data.video.explanation = strdup("");
|
||||||
metadata.data.video.copyright = strdup("");
|
metadata.data.video.copyright = strdup("");
|
||||||
|
|||||||
@@ -20,7 +20,10 @@
|
|||||||
#include "cmautils.h"
|
#include "cmautils.h"
|
||||||
#include "sqlitedb.h"
|
#include "sqlitedb.h"
|
||||||
#include "sforeader.h"
|
#include "sforeader.h"
|
||||||
|
|
||||||
|
#ifdef FFMPEG_ENABLED
|
||||||
#include "avdecoder.h"
|
#include "avdecoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -551,6 +554,14 @@ bool SQLiteDB::insertSourceEntry(uint object_id, const QString &path, const QStr
|
|||||||
|
|
||||||
uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id_parent, int type)
|
uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id_parent, int type)
|
||||||
{
|
{
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
Q_UNUSED(path);
|
||||||
|
Q_UNUSED(name);
|
||||||
|
Q_UNUSED(id_parent);
|
||||||
|
Q_UNUSED(type);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
bool ok;
|
bool ok;
|
||||||
int ohfi;
|
int ohfi;
|
||||||
AVDecoder decoder;
|
AVDecoder decoder;
|
||||||
@@ -664,10 +675,19 @@ uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ohfi;
|
return ohfi;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int id_parent, int type)
|
uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int id_parent, int type)
|
||||||
{
|
{
|
||||||
|
#ifndef FFMPEG_ENABLED
|
||||||
|
Q_UNUSED(path);
|
||||||
|
Q_UNUSED(name);
|
||||||
|
Q_UNUSED(id_parent);
|
||||||
|
Q_UNUSED(type);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
int ohfi;
|
int ohfi;
|
||||||
AVDecoder decoder;
|
AVDecoder decoder;
|
||||||
quint64 duration;
|
quint64 duration;
|
||||||
@@ -735,6 +755,7 @@ uint SQLiteDB::insertVideoEntry(const QString &path, const QString &name, int id
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ohfi;
|
return ohfi;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id_parent, int type)
|
uint SQLiteDB::insertPhotoEntry(const QString &path, const QString &name, int id_parent, int type)
|
||||||
|
|||||||
@@ -53,8 +53,12 @@ OTHER_FILES += \
|
|||||||
|
|
||||||
RESOURCES += gui.qrc
|
RESOURCES += gui.qrc
|
||||||
|
|
||||||
# find packages using pkg-config
|
DISABLE_FFMPEG {
|
||||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
PKGCONFIG = libvitamtp
|
||||||
|
} else {
|
||||||
|
# find packages using pkg-config
|
||||||
|
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||||
|
}
|
||||||
|
|
||||||
#Linux-only config
|
#Linux-only config
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
|
|||||||
Reference in New Issue
Block a user