Skip to content

Commit

Permalink
make submodule optional
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Dec 4, 2014
1 parent e218628 commit 57b4831
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
2 changes: 1 addition & 1 deletion contrib/capi
Submodule capi updated 2 files
+10 −0 capi.cpp
+1 −0 capi.pri
19 changes: 13 additions & 6 deletions src/libQtAV.pro
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ exists($$PROJECTROOT/contrib/libchardet/libchardet.pri) {
include($$PROJECTROOT/contrib/libchardet/libchardet.pri)
DEFINES += QTAV_HAVE_CHARDET=1 BUILD_CHARDET_STATIC
} else {
error("contrib/libchardet is missing. run 'git submodule update --init' first")
warning("contrib/libchardet is missing. run 'git submodule update --init' first")
}
exists($$PROJECTROOT/contrib/capi/capi.pri) {
include($$PROJECTROOT/contrib/capi/capi.pri)
CONFIG *= capi
DEFINES += QTAV_HAVE_CAPI=1 BUILD_CAPI_STATIC
} else {
error("contrib/capi is missing. run 'git submodule update --init' first")
warning("contrib/capi is missing. run 'git submodule update --init' first")
}
config_avfilter {
DEFINES += QTAV_HAVE_AVFILTER=1
Expand Down Expand Up @@ -222,7 +223,11 @@ config_vaapi* {
config_libcedarv {
DEFINES *= QTAV_HAVE_CEDARV=1
QMAKE_CXXFLAGS *= -march=armv7-a
neon: QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_NEON
neon {
QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_NEON
} else {
DEFINES *= NO_NEON_OPT
}
SOURCES += codec/video/VideoDecoderCedarv.cpp
CONFIG += simd #addSimdCompiler xxx_ASM
CONFIG += no_clang_integrated_as #see qtbase/src/gui/painting/painting.pri. add -fno-integrated-as from simd.prf
Expand Down Expand Up @@ -276,11 +281,13 @@ config_openglwindow {
}
config_libass {
#link against libass instead of dynamic load
#LIBS += -lass
#DEFINES += CAPI_LINK_ASS
SOURCES *= subtitle/SubtitleProcessorLibASS.cpp
!capi {
LIBS += -lass
DEFINES += CAPI_LINK_ASS
}
HEADERS *= subtitle/ass_api.h
SOURCES *= subtitle/ass_api.cpp
SOURCES *= subtitle/SubtitleProcessorLibASS.cpp
}

SOURCES += \
Expand Down
6 changes: 0 additions & 6 deletions src/subtitle/SubtitleProcessorLibASS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@

#include <stdarg.h>
#include <string>
#ifdef CAPI_LINK_ASS
extern "C" {
#include <ass/ass.h>
}
#else
#include "ass_api.h"
#endif
#include "QtAV/private/SubtitleProcessor.h"
#include "QtAV/private/prepost.h"
#include "QtAV/Packet.h"
Expand Down
31 changes: 11 additions & 20 deletions src/subtitle/ass_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,30 @@
#define DEBUG_LOAD

#include "ass_api.h"
#ifndef CAPI_LINK_ASS
#include "capi.h"
#endif //CAPI_LINK_ASS

namespace ass {
#ifdef CAPI_LINK_ASS
class api_dll {public: bool isLoaded() const {return true;}};
#else
static const char* names[] = {
"ass",
NULL
};

#define CAPI_ASS_VERSION
#ifdef CAPI_ASS_VERSION
# ifdef CAPI_ASS_VERSION
static const int versions[] = {
capi::NoVersion,
5,
4,
capi::EndVersion
};
CAPI_BEGIN_DLL_VER(names, versions)
#else
# else
CAPI_BEGIN_DLL(names)
#endif
#ifndef CAPI_LINK_ASS
# endif //CAPI_ASS_VERSION
// CAPI_DEFINE_RESOLVER(argc, return_type, name, argv_no_name)
// mkapi code generation BEGIN
CAPI_DEFINE_RESOLVER(0, int, ass_library_version)
Expand Down Expand Up @@ -90,22 +93,7 @@ CAPI_DEFINE_RESOLVER(4, void, ass_add_font, ASS_Library *, char *, char *, int)
CAPI_DEFINE_RESOLVER(1, void, ass_clear_fonts, ASS_Library *)
CAPI_DEFINE_RESOLVER(3, long long, ass_step_sub, ASS_Track *, long long, int)
// mkapi code generation END
#endif //CAPI_LINK_ASS
CAPI_END_DLL()

api::api() : dll(new api_dll()) {
qDebug("capi::version: %s build %s", capi::version::name, capi::version::build());
}
api::~api() { delete dll;}
bool api::loaded() const {
#ifdef CAPI_LINK_ASS
return true;
#else
return dll->isLoaded();
#endif //CAPI_LINK_ASS
}

#ifndef CAPI_LINK_ASS
// CAPI_DEFINE(argc, return_type, name, argv_no_name)
typedef void (*msg_cb)
(int level, const char *fmt, va_list args, void *data);
Expand Down Expand Up @@ -155,4 +143,7 @@ CAPI_DEFINE(1, void, ass_clear_fonts, ASS_Library *)
CAPI_DEFINE(3, long long, ass_step_sub, ASS_Track *, long long, int)
// mkapi code generation END
#endif //CAPI_LINK_ASS
api::api() : dll(new api_dll()) {}
api::~api() { delete dll;}
bool api::loaded() const { return dll->isLoaded(); }
} //namespace ass

0 comments on commit 57b4831

Please sign in to comment.