QtAV: use cmake for build

* disable players
This commit is contained in:
Gerasim Troeglazov
2019-08-24 19:52:05 +10:00
parent 071cb32089
commit 2c9a7c9d92
2 changed files with 758 additions and 63 deletions

View File

@@ -0,0 +1,729 @@
From dd02092df2454cee17ff5293cb383082fdcce293 Mon Sep 17 00:00:00 2001
From: 0xFelix <evostar@gmx.de>
Date: Tue, 12 Dec 2017 13:24:34 +0100
Subject: Remove usage of deprecated avfiltergraph.h header
diff --git a/src/QtAV/private/AVCompat.h b/src/QtAV/private/AVCompat.h
index e387868..e6225e9 100644
--- a/src/QtAV/private/AVCompat.h
+++ b/src/QtAV/private/AVCompat.h
@@ -59,6 +59,7 @@ extern "C"
#include <libavutil/parseutils.h>
#include <libavutil/pixdesc.h>
#include <libavutil/avstring.h>
+#include <libavfilter/version.h>
#if !FFMPEG_MODULE_CHECK(LIBAVUTIL, 51, 73, 101)
#include <libavutil/channel_layout.h>
@@ -79,8 +80,11 @@ extern "C"
#endif //QTAV_HAVE(AVRESAMPLE)
#if QTAV_HAVE(AVFILTER)
+#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,8,0)
#include <libavfilter/avfiltergraph.h> /*code is here for old version*/
+#else
#include <libavfilter/avfilter.h>
+#endif
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#endif //QTAV_HAVE(AVFILTER)
--
2.21.0
From 68334c99231118758475e5218adc2e818b7a0f7b Mon Sep 17 00:00:00 2001
From: Felix Matouschek <felix@matouschek.org>
Date: Sat, 11 Nov 2017 10:13:06 +0100
Subject: Make QtAV build with newer versions of FFmpeg
diff --git a/src/AVMuxer.cpp b/src/AVMuxer.cpp
index 729d94a..10d85bb 100644
--- a/src/AVMuxer.cpp
+++ b/src/AVMuxer.cpp
@@ -122,7 +122,7 @@ AVStream *AVMuxer::Private::addStream(AVFormatContext* ctx, const QString &codec
c->time_base = s->time_base;
/* Some formats want stream headers to be separate. */
if (ctx->oformat->flags & AVFMT_GLOBALHEADER)
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
// expose avctx to encoder and set properties in encoder?
// list codecs for a given format in ui
return s;
diff --git a/src/QtAV/private/AVCompat.h b/src/QtAV/private/AVCompat.h
index e6225e9..944cfd7 100644
--- a/src/QtAV/private/AVCompat.h
+++ b/src/QtAV/private/AVCompat.h
@@ -460,3 +460,15 @@ const char *get_codec_long_name(AVCodecID id);
} } while(0)
#endif //QTAV_COMPAT_H
+
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,33,0)
+#define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
+#endif
+
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,56,100)
+#define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE
+#endif
+
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,56,100)
+#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
+#endif
diff --git a/src/codec/audio/AudioEncoderFFmpeg.cpp b/src/codec/audio/AudioEncoderFFmpeg.cpp
index 93a0506..f67fb27 100644
--- a/src/codec/audio/AudioEncoderFFmpeg.cpp
+++ b/src/codec/audio/AudioEncoderFFmpeg.cpp
@@ -153,8 +153,8 @@ bool AudioEncoderFFmpegPrivate::open()
} else {
buffer_size = frame_size*format_used.bytesPerSample()*format_used.channels()*2+200;
}
- if (buffer_size < FF_MIN_BUFFER_SIZE)
- buffer_size = FF_MIN_BUFFER_SIZE;
+ if (buffer_size < AV_INPUT_BUFFER_MIN_SIZE)
+ buffer_size = AV_INPUT_BUFFER_MIN_SIZE;
buffer.resize(buffer_size);
return true;
}
diff --git a/src/codec/video/VideoEncoderFFmpeg.cpp b/src/codec/video/VideoEncoderFFmpeg.cpp
index 7c5ed42..671efa7 100644
--- a/src/codec/video/VideoEncoderFFmpeg.cpp
+++ b/src/codec/video/VideoEncoderFFmpeg.cpp
@@ -245,7 +245,7 @@ bool VideoEncoderFFmpegPrivate::open()
applyOptionsForContext();
AV_ENSURE_OK(avcodec_open2(avctx, codec, &dict), false);
// from mpv ao_lavc
- const int buffer_size = qMax<int>(qMax<int>(width*height*6+200, FF_MIN_BUFFER_SIZE), sizeof(AVPicture));//??
+ const int buffer_size = qMax<int>(qMax<int>(width*height*6+200, AV_INPUT_BUFFER_MIN_SIZE), sizeof(AVPicture));//??
buffer.resize(buffer_size);
return true;
}
diff --git a/src/filter/LibAVFilter.cpp b/src/filter/LibAVFilter.cpp
index 1915120..8993a91 100644
--- a/src/filter/LibAVFilter.cpp
+++ b/src/filter/LibAVFilter.cpp
@@ -120,7 +120,10 @@ public:
// pixel_aspect==sar, pixel_aspect is more compatible
QString buffersrc_args = args;
qDebug("buffersrc_args=%s", buffersrc_args.toUtf8().constData());
- AVFilter *buffersrc = avfilter_get_by_name(video ? "buffer" : "abuffer");
+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
+ const
+#endif
+ AVFilter *buffersrc = avfilter_get_by_name(video ? "buffer" : "abuffer");
Q_ASSERT(buffersrc);
AV_ENSURE_OK(avfilter_graph_create_filter(&in_filter_ctx,
buffersrc,
@@ -128,6 +131,9 @@ public:
filter_graph)
, false);
/* buffer video sink: to terminate the filter chain. */
+#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(7,0,0)
+ const
+#endif
AVFilter *buffersink = avfilter_get_by_name(video ? "buffersink" : "abuffersink");
Q_ASSERT(buffersink);
AV_ENSURE_OK(avfilter_graph_create_filter(&out_filter_ctx, buffersink, "out",
diff --git a/src/subtitle/SubtitleProcessorFFmpeg.cpp b/src/subtitle/SubtitleProcessorFFmpeg.cpp
index 30ee936..1755c38 100644
--- a/src/subtitle/SubtitleProcessorFFmpeg.cpp
+++ b/src/subtitle/SubtitleProcessorFFmpeg.cpp
@@ -249,7 +249,7 @@ bool SubtitleProcessorFFmpeg::processHeader(const QByteArray &codec, const QByte
codec_ctx->time_base.den = 1000;
if (!data.isEmpty()) {
av_free(codec_ctx->extradata);
- codec_ctx->extradata = (uint8_t*)av_mallocz(data.size() + FF_INPUT_BUFFER_PADDING_SIZE);
+ codec_ctx->extradata = (uint8_t*)av_mallocz(data.size() + AV_INPUT_BUFFER_PADDING_SIZE);
if (!codec_ctx->extradata)
return false;
codec_ctx->extradata_size = data.size();
--
2.21.0
From 9336c7619b41418c97b6262aaaf433f4dc1ddd39 Mon Sep 17 00:00:00 2001
From: Johannes Huber <johu@gentoo.org>
Date: Wed, 6 Sep 2017 23:30:42 +0200
Subject: Fix multilib install
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef7ade0..11f8603 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # for .moc
set(CMAKE_AUTOMOC ON)
if(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(QTAV_INSTALL_HEADERS ${CMAKE_INSTALL_PREFIX}/include)
- set(QTAV_INSTALL_LIBS ${CMAKE_INSTALL_PREFIX}/lib)
+ set(QTAV_INSTALL_LIBS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(QTAV_INSTALL_BINS ${CMAKE_INSTALL_PREFIX}/bin)
set(QTAV_INSTALL_QML ${CMAKE_INSTALL_PREFIX}/qml)
else()
--
2.21.0
From ec7adb96023306de5387f3a3130022fcdad7552f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 1 May 2019 21:12:05 +1000
Subject: Add missing header
diff --git a/contrib/capi/capi.h b/contrib/capi/capi.h
new file mode 100644
index 0000000..df7c8ee
--- /dev/null
+++ b/contrib/capi/capi.h
@@ -0,0 +1,518 @@
+/******************************************************************************
+ Use C API in C++ dynamically and no link. Header only.
+ Use it with a code generation tool: https://github.com/wang-bin/mkapi
+ Copyright (C) 2014-2017 Wang Bin <wbsecg1@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+******************************************************************************/
+// no class based implementation: https://github.com/wang-bin/dllapi . limitation: can not reload library
+#ifndef CAPI_H
+#define CAPI_H
+
+/*!
+ How To Use: (see test/zlib)
+ use the header and source from code gerenrated from: https://github.com/wang-bin/mkapi
+ */
+
+#include <cstddef> //ptrdiff_t
+#include <cstdio>
+#include <cassert>
+#include <string.h>
+
+#define CAPI_IS(X) (defined CAPI_IS_##X && CAPI_IS_##X)
+/*!
+ * you can define CAPI_IS_LAZY_RESOLVE 0 before including capi.h. then all symbols will be resolved in constructor.
+ * default resolving a symbol at it's first call
+ */
+#ifndef CAPI_IS_LAZY_RESOLVE
+#define CAPI_IS_LAZY_RESOLVE 1
+#endif
+namespace capi {
+namespace version {
+ enum {
+ Major = 0, Minor = 7, Patch = 1,
+ Value = ((Major&0xff)<<16) | ((Minor&0xff)<<8) | (Patch&0xff)
+ };
+ static const char name[] = { Major + '0', '.', Minor + '0', '.', Patch + '0', 0 };
+} //namespace version
+// set lib name with version
+enum {
+ NoVersion = -1, /// library name without major version, for example libz.so
+ EndVersion = -2
+};
+/********************************** The following code is only used in .cpp **************************************************/
+/*!
+ * -Library names:
+ static const char* zlib[] = {
+ #ifdef CAPI_TARGET_OS_WIN
+ "zlib",
+ #else
+ "z",
+ #endif
+ /usr/local/lib/libmyz.so, // absolute path is ok
+ NULL};
+ CAPI_BEGIN_DLL(zlib, ::capi::dso) // the 2nd parameter is a dynamic shared object loader class. \sa dll_helper class
+ ...
+ * -Multiple library versions
+ An example to open libz.so, libz.so.1, libz.so.0 on unix
+ static const int ver[] = { ::capi::NoVersion, 1, 0, ::capi::EndVersion };
+ CAPI_BEGIN_DLL_VER(zlib, ver, ::capi::dso)
+ ...
+ */
+class dso {
+ void *handle;
+ char full_name[512];
+ dso(const dso&);
+ dso& operator=(const dso&);
+public:
+ static inline char* path_from_handle(void* handle, char* path, int path_len);
+ dso(): handle(0) {}
+ virtual ~dso() { unload();}
+ inline void setFileName(const char* name);
+ inline void setFileNameAndVersion(const char* name, int ver);
+ inline bool load();
+ inline bool unload();
+ bool isLoaded() const { return !!handle;}
+ virtual void* resolve(const char* symbol) { return resolve(symbol, true);}
+ const char* path() const { return full_name;} // loaded path
+protected:
+ inline void* load(const char* name);
+ inline bool unload(void* lib);
+ inline void* resolve(const char* sym, bool try_);
+};
+} //namespace capi
+/// DLL_CLASS is a library loader and symbols resolver class. Must implement api like capi::dso (the same function name and return type, but string parameter type can be different):
+/// unload() must support ref count. i.e. do unload if no one is using the real library
+/// Currently you can use ::capi::dso and QLibrary for DLL_CLASS. You can also use your own library resolver
+#define CAPI_BEGIN_DLL(names, DLL_CLASS) \
+ class api_dll : public ::capi::internal::dll_helper<DLL_CLASS> { \
+ public: api_dll() : ::capi::internal::dll_helper<DLL_CLASS>(names) CAPI_DLL_BODY_DEFINE
+#define CAPI_BEGIN_DLL_VER(names, versions, DLL_CLASS) \
+ class api_dll : public ::capi::internal::dll_helper<DLL_CLASS> { \
+ public: api_dll() : ::capi::internal::dll_helper<DLL_CLASS>(names, versions) CAPI_DLL_BODY_DEFINE
+#if CAPI_IS(LAZY_RESOLVE)
+#define CAPI_END_DLL() } api_t; api_t api; };
+#else
+#define CAPI_END_DLL() };
+#endif
+#define CAPI_DEFINE_DLL api::api():dll(new api_dll()){} \
+ api::~api(){delete dll;} \
+ bool api::loaded() const { return dll->isLoaded();} \
+ namespace capi { \
+ static api_dll* dll = NULL; \
+ bool loaded() { \
+ if (!dll) dll = new api_dll(); \
+ return dll->isLoaded(); \
+ } \
+ }
+
+/*!
+ * N: number of arguments
+ * R: return type
+ * name: api name
+ * ...: api arguments with only types, wrapped by CAPI_ARGn, n=0,1,2,...13
+ * The symbol of the api is "name". Otherwise, use CAPI_DEFINE instead.
+ * example:
+ * 1. const char* zlibVersion()
+ * CAPI_DEFINE(const char* zlibVersion, CAPI_ARG0())
+ * 2. const char* zError(int) // get error string from zlib error code
+ * CAPI_DEFINE(const char*, zError, CAPI_ARG1(int))
+ */
+#if CAPI_IS(LAZY_RESOLVE)
+#define CAPI_DEFINE(R, name, ...) EXPAND(CAPI_DEFINE2_X(R, name, name, __VA_ARGS__)) /* not ##__VA_ARGS__ !*/
+#define CAPI_DEFINE_ENTRY(R, name, ...) EXPAND(CAPI_DEFINE_ENTRY_X(R, name, name, __VA_ARGS__))
+#define CAPI_DEFINE_M_ENTRY(R, M, name, ...) EXPAND(CAPI_DEFINE_M_ENTRY_X(R, M, name, name, __VA_ARGS__))
+#else
+#define CAPI_DEFINE(R, name, ...) EXPAND(CAPI_DEFINE_X(R, name, __VA_ARGS__)) /* not ##__VA_ARGS__ !*/
+#define CAPI_DEFINE_ENTRY(R, name, ...) EXPAND(CAPI_DEFINE_RESOLVER_X(R, name, name, __VA_ARGS__))
+#define CAPI_DEFINE_M_ENTRY(R, M, name, ...) EXPAND(CAPI_DEFINE_M_RESOLVER_X(R, M, name, name, __VA_ARGS__))
+#endif
+//EXPAND(CAPI_DEFINE##N(R, name, #name, __VA_ARGS__))
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/************The followings are used internally**********/
+#if CAPI_IS(LAZY_RESOLVE)
+#define CAPI_DLL_BODY_DEFINE { memset(&api, 0, sizeof(api));} typedef struct {
+#else
+#define CAPI_DLL_BODY_DEFINE { CAPI_DBG_RESOLVE("capi resolved dll symbols...");}
+#endif
+#define CAPI_DEFINE_T_V(R, name, ARG_T, ARG_T_V, ARG_V) \
+ R api::name ARG_T_V { \
+ CAPI_DBG_CALL(" "); \
+ assert(dll && dll->isLoaded() && "dll is not loaded"); \
+ return dll->name ARG_V; \
+ }
+#define CAPI_DEFINE2_T_V(R, name, sym, ARG_T, ARG_T_V, ARG_V) \
+ R api::name ARG_T_V { \
+ CAPI_DBG_CALL(" "); \
+ assert(dll && dll->isLoaded() && "dll is not loaded"); \
+ if (!dll->api.name) { \
+ dll->api.name = (api_dll::api_t::name##_t)dll->resolve(#sym); \
+ CAPI_DBG_RESOLVE("dll::api_t::" #name ": @%p", dll->api.name); \
+ } \
+ assert(dll->api.name && "failed to resolve " #R #sym #ARG_T_V); \
+ return dll->api.name ARG_V; \
+ }
+/*
+ * TODO: choose 1 of below
+ * - use CAPI_LINKAGE and remove CAPI_DEFINE_M_ENTRY_X & CAPI_DEFINE_M_RESOLVER_X
+ * - also pass a linkage parameter to CAPI_NS_DEFINE_T_V & CAPI_NS_DEFINE2_T_V
+ */
+#ifndef CAPI_LINKAGE
+#define CAPI_LINKAGE
+#endif //CAPI_LINKAGE
+#define CAPI_NS_DEFINE_T_V(R, name, ARG_T, ARG_T_V, ARG_V) \
+ namespace capi { \
+ using capi::dll; \
+ R CAPI_LINKAGE name ARG_T_V { \
+ CAPI_DBG_CALL(" "); \
+ if (!dll) dll = new api_dll(); \
+ assert(dll && dll->isLoaded() && "dll is not loaded"); \
+ return dll->name ARG_V; \
+ } }
+#define CAPI_NS_DEFINE2_T_V(R, name, sym, ARG_T, ARG_T_V, ARG_V) \
+ namespace capi { \
+ using capi::dll; \
+ R CAPI_LINKAGE name ARG_T_V { \
+ CAPI_DBG_CALL(" "); \
+ if (!dll) dll = new api_dll(); \
+ assert(dll && dll->isLoaded() && "dll is not loaded"); \
+ if (!dll->api.name) { \
+ dll->api.name = (api_dll::api_t::name##_t)dll->resolve(#sym); \
+ CAPI_DBG_RESOLVE("dll::api_t::" #name ": @%p", dll->api.name); \
+ } \
+ assert(dll->api.name && "failed to resolve " #R #sym #ARG_T_V); \
+ return dll->api.name ARG_V; \
+ } }
+
+// nested class can not call non-static members outside the class, so hack the address here
+// need -Wno-invalid-offsetof
+#define CAPI_DEFINE_M_RESOLVER_T_V(R, M, name, sym, ARG_T, ARG_T_V, ARG_V) \
+ public: \
+ typedef R (M *name##_t) ARG_T; \
+ name##_t name; \
+ private: \
+ struct name##_resolver_t { \
+ name##_resolver_t() { \
+ const ptrdiff_t diff = ptrdiff_t(&((api_dll*)0)->name##_resolver) - ptrdiff_t(&((api_dll*)0)->name); \
+ name##_t *p = (name##_t*)((char*)this - diff); \
+ api_dll* dll = (api_dll*)((char*)this - ((ptrdiff_t)(&((api_dll*)0)->name##_resolver))); \
+ if (!dll->isLoaded()) { \
+ CAPI_WARN_LOAD("dll not loaded"); \
+ *p = NULL; \
+ return; \
+ } \
+ *p = (name##_t)dll->resolve(#sym); \
+ if (*p) { CAPI_DBG_RESOLVE("dll::" #name ": @%p", *p); } \
+ else { CAPI_WARN_RESOLVE("capi resolve error '" #name "'"); } \
+ } \
+ } name##_resolver;
+
+#if defined(__GNUC__)
+# define CAPI_FUNC_INFO __PRETTY_FUNCTION__
+#elif defined(_MSC_VER)
+# define CAPI_FUNC_INFO __FUNCSIG__
+#else
+# define CAPI_FUNC_INFO __FUNCTION__
+#endif
+#ifdef DEBUG
+#define DEBUG_LOAD
+#define DEBUG_RESOLVE
+#define DEBUG_CALL
+#endif //DEBUG
+#if defined(DEBUG) || defined(DEBUG_LOAD) || defined(DEBUG_RESOLVE) || defined(DEBUG_CALL)
+#define CAPI_LOG(STDWHERE, fmt, ...) do {fprintf(STDWHERE, "[%s] %s@%d: " fmt "\n", __FILE__, CAPI_FUNC_INFO, __LINE__, ##__VA_ARGS__); fflush(STDWHERE);} while(0);
+#else
+#define CAPI_LOG(...)
+#endif //DEBUG
+#ifdef DEBUG_LOAD
+#define CAPI_DBG_LOAD(...) EXPAND(CAPI_LOG(stdout, ##__VA_ARGS__))
+#define CAPI_WARN_LOAD(...) EXPAND(CAPI_LOG(stderr, ##__VA_ARGS__))
+#else
+#define CAPI_DBG_LOAD(...)
+#define CAPI_WARN_LOAD(...)
+#endif //DEBUG_LOAD
+#ifdef DEBUG_RESOLVE
+#define CAPI_DBG_RESOLVE(...) EXPAND(CAPI_LOG(stdout, ##__VA_ARGS__))
+#define CAPI_WARN_RESOLVE(...) EXPAND(CAPI_LOG(stderr, ##__VA_ARGS__))
+#else
+#define CAPI_DBG_RESOLVE(...)
+#define CAPI_WARN_RESOLVE(...)
+#endif //DEBUG_RESOLVE
+#ifdef DEBUG_CALL
+#define CAPI_DBG_CALL(...) EXPAND(CAPI_LOG(stdout, ##__VA_ARGS__))
+#define CAPI_WARN_CALL(...) EXPAND(CAPI_LOG(stderr, ##__VA_ARGS__))
+#else
+#define CAPI_DBG_CALL(...)
+#define CAPI_WARN_CALL(...)
+#endif //DEBUG_CALL
+//fully expand. used by VC. VC will not expand __VA_ARGS__ but treats it as 1 parameter
+#define EXPAND(expr) expr //TODO: rename CAPI_EXPAND
+#if defined(_WIN32) // http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
+#define CAPI_TARGET_OS_WIN 1
+#include <windows.h>
+#ifdef WINAPI_FAMILY
+#include <winapifamily.h>
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define CAPI_TARGET_OS_WINRT 1
+#endif
+#endif //WINAPI_FAMILY
+#endif
+#if defined(__APPLE__)
+#define CAPI_TARGET_OS_MAC 1
+#include <mach-o/dyld.h>
+#endif
+#ifndef CAPI_TARGET_OS_WIN
+#if !defined(__APPLE__) && !defined(__HAIKU__)
+#include <link.h> // for link_map. qnx: sys/link.h
+#endif
+#include <dlfcn.h>
+#endif
+namespace capi {
+namespace internal {
+// the following code is for the case DLL=QLibrary + QT_NO_CAST_FROM_ASCII
+// you can add a new qstr_wrap like class and a specialization of dso_trait to support a new string type before/after include "capi.h"
+struct qstr_wrap {
+ static const char* fromLatin1(const char* s) {return s;}
+};
+template<class T> struct dso_trait {
+ typedef const char* str_t;
+ typedef qstr_wrap qstr_t;
+};
+//can not explicit specialization of 'trait' in class scope
+#if defined(QLIBRARY_H) && defined(QT_CORE_LIB)
+template<> struct dso_trait<QLibrary> {
+ typedef QString str_t;
+ typedef QString qstr_t;
+};
+#endif
+// base ctor dll_helper("name")=>derived members in decl order(resolvers)=>derived ctor
+static const int kDefaultVersions[] = {::capi::NoVersion, ::capi::EndVersion};
+template <class DLL> class dll_helper { //no CAPI_EXPORT required
+ DLL m_lib;
+ typename dso_trait<DLL>::str_t strType(const char* s) {
+ return dso_trait<DLL>::qstr_t::fromLatin1(s);
+ }
+public:
+ dll_helper(const char* names[], const int versions[] = kDefaultVersions) {
+ static bool is_1st = true;
+ if (is_1st) {
+ is_1st = false;
+ fprintf(stderr, "capi::version: %s\n", ::capi::version::name);
+ }
+ for (int i = 0; names[i]; ++i) {
+ for (int j = 0; versions[j] != ::capi::EndVersion; ++j) {
+ if (versions[j] == ::capi::NoVersion)
+ m_lib.setFileName(strType(names[i]));
+ else
+ m_lib.setFileNameAndVersion(strType(names[i]), versions[j]);
+ if (m_lib.load()) {
+ CAPI_DBG_LOAD("capi loaded {library name: %s, version: %d}: %s", names[i], versions[j], m_lib.path());
+ return;
+ }
+ CAPI_WARN_LOAD("capi can not load {library name: %s, version %d}", names[i], versions[j]);
+ }
+ }
+ }
+ virtual ~dll_helper() { m_lib.unload();}
+ bool isLoaded() const { return m_lib.isLoaded(); }
+ void* resolve(const char *symbol) { return (void*)m_lib.resolve(symbol);}
+};
+#ifdef CAPI_TARGET_OS_WIN
+ static const char kPre[] = "";
+ static const char kExt[] = ".dll";
+#else
+ static const char kPre[] = "lib";
+#ifdef CAPI_TARGET_OS_MAC
+ static const char kExt[] = ".dylib";
+#else
+ static const char kExt[] = ".so";
+#endif
+#endif
+} //namespace internal
+#ifdef CAPI_TARGET_OS_WIN
+#define CAPI_SNPRINTF _snprintf
+#define CAPI_SNWPRINTF _snwprintf
+#else
+#define CAPI_SNPRINTF snprintf
+#define CAPI_SNWPRINTF snwprintf
+#endif
+void dso::setFileName(const char* name) {
+ CAPI_DBG_LOAD("dso.setFileName(\"%s\")", name);
+ if (name[0] == '/')
+ CAPI_SNPRINTF(full_name, sizeof(full_name), "%s", name);
+ else
+ CAPI_SNPRINTF(full_name, sizeof(full_name), "%s%s%s", internal::kPre, name, internal::kExt);
+}
+void dso::setFileNameAndVersion(const char* name, int ver) {
+ CAPI_DBG_LOAD("dso.setFileNameAndVersion(\"%s\", %d)", name, ver);
+ if (ver >= 0) {
+#if defined(CAPI_TARGET_OS_WIN) // ignore version on win. xxx-V.dll?
+ CAPI_SNPRINTF(full_name, sizeof(full_name), "%s%s%s", internal::kPre, name, internal::kExt);
+#elif defined(CAPI_TARGET_OS_MAC)
+ CAPI_SNPRINTF(full_name, sizeof(full_name), "%s%s.%d%s", internal::kPre, name, ver, internal::kExt);
+#else
+ CAPI_SNPRINTF(full_name, sizeof(full_name), "%s%s%s.%d", internal::kPre, name, internal::kExt, ver);
+#endif
+ } else {
+ setFileName(name);
+ }
+}
+bool dso::load() {
+ handle = load(full_name);
+ path_from_handle(handle, full_name, sizeof(full_name));
+ return !!handle;
+}
+bool dso::unload() {
+ if (!isLoaded())
+ return true;
+ if (!unload(handle))
+ return false;
+ handle = NULL; //TODO: check ref?
+ return true;
+}
+void* dso::load(const char* name) {
+ CAPI_DBG_LOAD("dso.load: %s", name);
+#ifdef CAPI_TARGET_OS_WIN
+#ifdef CAPI_TARGET_OS_WINRT
+ wchar_t wname[strlen(name)+1];
+ CAPI_SNWPRINTF(wname, sizeof(wname), L"%s", name);
+ return (void*)::LoadPackagedLibrary(wname, 0);
+#else
+ return (void*)::LoadLibraryExA(name, NULL, 0); //DONT_RESOLVE_DLL_REFERENCES
+#endif
+#else
+ return ::dlopen(name, RTLD_LAZY|RTLD_LOCAL); // try no prefix name if error? TODO: ios |RTLD_GLOBAL?
+#endif
+}
+bool dso::unload(void* h) {
+#ifdef CAPI_TARGET_OS_WIN
+ if (!::FreeLibrary(static_cast<HMODULE>(h))) //return 0 if error. ref counted
+ return false;
+#else
+ if (::dlclose(handle) != 0) //ref counted
+ return false;
+#endif
+ return true;
+}
+void* dso::resolve(const char* sym, bool try_) {
+ const char* s = sym;
+ char _s[512]; // old a.out systems add an underscore in front of symbols
+ if (!try_) {//previous has no '_', now has '_'
+ CAPI_SNPRINTF(_s, sizeof(_s), "_%s", sym);
+ s = _s;
+ }
+ CAPI_DBG_RESOLVE("dso.resolve(\"%s\", %d)", s, try_);
+#ifdef CAPI_TARGET_OS_WIN
+ void *ptr = (void*)::GetProcAddress((HMODULE)handle, s);
+#else
+ void *ptr = ::dlsym(handle, s);
+#endif
+ if (!ptr && try_)
+ return resolve(sym, false);
+ return ptr;
+}
+
+char* dso::path_from_handle(void* handle, char* path, int path_len)
+{
+ if (!handle)
+ return nullptr;;
+#if (CAPI_TARGET_OS_WIN+0)
+ GetModuleFileNameA(HMODULE(handle), path, path_len);
+#elif defined(__APPLE__)
+ for (size_t i = _dyld_image_count(); i > 0; --i) {
+ const char* name = _dyld_get_image_name(i);
+ void* h = dlopen(name, RTLD_LAZY);
+ dlclose(h);
+ if ((ptrdiff_t(handle) - ptrdiff_t(h))>>2 == 0) {
+ CAPI_SNPRINTF(path, path_len, "%s", name);
+ break;
+ }
+ }
+#elif (__ANDROID__+0)
+ // from boost.dll
+ typedef struct soinfo {
+ // if defined(__work_around_b_24465209__), then an array of char[128] goes here.
+ // Unfortunately, __work_around_b_24465209__ is visible only during compilation of Android's linker
+ const void* phdr;
+ size_t phnum;
+ void* entry;
+ void* base;
+ // ... // Ignoring remaning parts of the structure
+ } soinfo;
+ static const size_t work_around_b_24465209__offset = 128;
+ Dl_info info;
+ const soinfo* si = reinterpret_cast<soinfo*>(intptr_t(handle)+work_around_b_24465209__offset);
+ if (dladdr(si->base, &info))
+ CAPI_SNPRINTF(path, path_len, "%s", info.dli_fname);
+#elif defined(RTLD_DEFAULT) && !defined(__HAIKU__) // check (0+__USE_GNU+__ELF__)? weak dlinfo? // mac, mingw, cygwin has no dlinfo
+ const link_map* m = static_cast<const link_map*>(handle);
+# if defined(__FreeBSD__)
+ if (dlinfo(handle, RTLD_DI_LINKMAP, &m) < 0)
+ m = NULL;
+# endif
+ if (m->l_name && m->l_name[0])
+ CAPI_SNPRINTF(path, path_len, "%s", m->l_name);
+#endif
+ return path;
+}
+} //namespace capi
+
+#if defined(_MSC_VER)
+#pragma warning(disable:4098) //vc return void
+#endif //_MSC_VER
+#ifdef __GNUC__
+//gcc: ((T*)0)->member
+//no #pragma GCC diagnostic push/pop around because code is defined as a macro
+#pragma GCC diagnostic ignored "-Winvalid-offsetof"
+#endif
+/*!
+ * used by .cpp to define the api
+ * e.g. CAPI_DEFINE(cl_int, clGetPlatformIDs, "clGetPlatformIDs", CAPI_ARG3(cl_uint, cl_platform_id*, cl_uint*))
+ * sym: symbol of the api in library.
+ * Defines both namespace style and class style. User can choose which one to use at runtime by adding a macro before including the header or not: #define SOMELIB_CAPI_NS
+ * See test/zlib/zlib_api.h
+ */
+#define CAPI_DEFINE_X(R, name, ARG_T, ARG_T_V, ARG_V) \
+ CAPI_DEFINE_T_V(R, name, ARG_T, ARG_T_V, ARG_V) \
+ CAPI_NS_DEFINE_T_V(R, name, ARG_T, ARG_T_V, ARG_V)
+/* declare and define the symbol resolvers*/
+#define EMPTY_LINKAGE
+#define CAPI_DEFINE_RESOLVER_X(R, name, sym, ARG_T, ARG_T_V, ARG_V) CAPI_DEFINE_M_RESOLVER_T_V(R, EMPTY_LINKAGE, name, sym, ARG_T, ARG_T_V, ARG_V)
+// api with linkage modifier
+#define CAPI_DEFINE_M_RESOLVER_X(R, M, name, sym, ARG_T, ARG_T_V, ARG_V) CAPI_DEFINE_M_RESOLVER_T_V(R, M, name, sym, ARG_T, ARG_T_V, ARG_V)
+
+#define CAPI_DEFINE2_X(R, name, sym, ARG_T, ARG_T_V, ARG_V) \
+ CAPI_DEFINE2_T_V(R, name, sym, ARG_T, ARG_T_V, ARG_V) \
+ CAPI_NS_DEFINE2_T_V(R, name, sym, ARG_T, ARG_T_V, ARG_V)
+#define CAPI_DEFINE_ENTRY_X(R, name, sym, ARG_T, ARG_T_V, ARG_V) CAPI_DEFINE_M_ENTRY_X(R, EMPTY_LINKAGE, name, sym, ARG_T, ARG_T_V, ARG_V)
+#define CAPI_DEFINE_M_ENTRY_X(R, M, sym, name, ARG_T, ARG_T_V, ARG_V) typedef R (M *name##_t) ARG_T; name##_t name;
+
+#define CAPI_ARG0() (), (), ()
+#define CAPI_ARG1(P1) (P1), (P1 p1), (p1)
+#define CAPI_ARG2(P1, P2) (P1, P2), (P1 p1, P2 p2), (p1, p2)
+#define CAPI_ARG3(P1, P2, P3) (P1, P2, P3), (P1 p1, P2 p2, P3 p3), (p1, p2, p3)
+#define CAPI_ARG4(P1, P2, P3, P4) (P1, P2, P3, P4), (P1 p1, P2 p2, P3 p3, P4 p4), (p1, p2, p3, p4)
+#define CAPI_ARG5(P1, P2, P3, P4, P5) (P1, P2, P3, P4, P5), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5), (p1, p2, p3, p4, p5)
+#define CAPI_ARG6(P1, P2, P3, P4, P5, P6) (P1, P2, P3, P4, P5, P6), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6), (p1, p2, p3, p4, p5, p6)
+#define CAPI_ARG7(P1, P2, P3, P4, P5, P6, P7) (P1, P2, P3, P4, P5, P6, P7), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7), (p1, p2, p3, p4, p5, p6, p7)
+#define CAPI_ARG8(P1, P2, P3, P4, P5, P6, P7, P8) (P1, P2, P3, P4, P5, P6, P7, P8), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8), (p1, p2, p3, p4, p5, p6, p7, p8)
+#define CAPI_ARG9(P1, P2, P3, P4, P5, P6, P7, P8, P9) (P1, P2, P3, P4, P5, P6, P7, P8, P9), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9), (p1, p2, p3, p4, p5, p6, p7, p8, p9)
+#define CAPI_ARG10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
+#define CAPI_ARG11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
+#define CAPI_ARG12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)
+#define CAPI_ARG13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13), (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12, P13 p13), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
+
+#endif // CAPI_H
--
2.21.0
From 288576ecf68eae240ce3348e17072ef297837db2 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 1 May 2019 21:45:39 +1000
Subject: Install path for Haiku
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11f8603..77826ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,6 +77,14 @@ else()
set(QTAV_INSTALL_QML ${QT_INSTALL_QML})
endif()
+if(HAIKU)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "default install path" FORCE)
+ set(QTAV_INSTALL_HEADERS ${CMAKE_INSTALL_HEADERS})
+ set(QTAV_INSTALL_LIBS ${CMAKE_INSTALL_LIBS})
+ set(QTAV_INSTALL_BINS ${CMAKE_INSTALL_BINS})
+ set(QTAV_INSTALL_QML ${CMAKE_INSTALL_QML})
+endif()
+
message(STATUS "Qt version: ${Qt5Core_VERSION_STRING}")
message(STATUS "Qt prefix: ${QT_INSTALL_PREFIX}")
message(STATUS "QtAV headers prefix: ${QTAV_INSTALL_HEADERS}")
--
2.21.0

View File

@@ -29,47 +29,24 @@ Extensible Framework
Some components in QtAV are designed to be extensible. For example, \
you can write your decoder, audio output for particular platform."
HOMEPAGE="http://www.qtav.org/"
COPYRIGHT="2013-2017 Wang Bin"
COPYRIGHT="2013-2019 Wang Bin"
LICENSE="GNU LGPL v2.1"
REVISION="4"
REVISION="5"
SOURCE_URI="https://github.com/wang-bin/QtAV/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="65ab859985d73521c2d17e72117baae0f3f6242b69f59994acada76fa5364193"
SOURCE_DIR="QtAV-$portVersion"
PATCHES="qtav-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
qtav$secondaryArchSuffix = $portVersion
cmd:ao$secondaryArchSuffix = $portVersion
cmd:audiopipeline$secondaryArchSuffix = $portVersion
cmd:decoder$secondaryArchSuffix = $portVersion
cmd:extract$secondaryArchSuffix = $portVersion
cmd:filters$secondaryArchSuffix = $portVersion
cmd:framereader$secondaryArchSuffix = $portVersion
cmd:glslfilter$secondaryArchSuffix = $portVersion
cmd:player$secondaryArchSuffix = $portVersion
cmd:playerthread$secondaryArchSuffix = $portVersion
cmd:qiodevice$secondaryArchSuffix = $portVersion
cmd:qmlplayer$secondaryArchSuffix = $portVersion
cmd:qrc$secondaryArchSuffix = $portVersion
cmd:shader$secondaryArchSuffix = $portVersion
cmd:sharedoutput$secondaryArchSuffix = $portVersion
cmd:simpleplayer$secondaryArchSuffix = $portVersion
cmd:simpletranscode$secondaryArchSuffix = $portVersion
cmd:subtitle$secondaryArchSuffix = $portVersion
cmd:transcode$secondaryArchSuffix = $portVersion
cmd:videocapture$secondaryArchSuffix = $portVersion
cmd:videographicsitem$secondaryArchSuffix = $portVersion
cmd:videogroup$secondaryArchSuffix = $portVersion
cmd:videowall$secondaryArchSuffix = $portVersion
cmd:window$secondaryArchSuffix = $portVersion
lib:libqtav$secondaryArchSuffix = 1.11.0 compat >= 1
lib:libqtavwidgets$secondaryArchSuffix = 1.11.0 compat >= 1
"
REQUIRES="
haiku$secondaryArchSuffix
qt5$secondaryArchSuffix
lib:libass$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavdevice$secondaryArchSuffix
@@ -79,36 +56,26 @@ REQUIRES="
lib:libgl$secondaryArchSuffix
lib:libopenal$secondaryArchSuffix
lib:libpostproc$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libswresample$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libuchardet$secondaryArchSuffix
"
PROVIDES_devel="
qtav$secondaryArchSuffix = $portVersion
qtav${secondaryArchSuffix}_devel = $portVersion
devel:libqtav$secondaryArchSuffix = 1.11.0 compat >= 1
devel:libqtavwidgets$secondaryArchSuffix = 1.11.0 compat >= 1
"
REQUIRES_devel="
haiku${secondaryArchSuffix}_devel
qt5${secondaryArchSuffix}_devel
devel:libass$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libavdevice$secondaryArchSuffix
devel:libavfilter$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libgl$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libpostproc$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libuchardet$secondaryArchSuffix
qtav$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
qt5${secondaryArchSuffix}_devel
devel:libass$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libavdevice$secondaryArchSuffix
@@ -118,16 +85,19 @@ BUILD_REQUIRES="
devel:libgl$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libpostproc$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libuchardet$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:find
cmd:g++$secondaryArchSuffix
cmd:lrelease$secondaryArchSuffix >= 5
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:qmake$secondaryArchSuffix >= 5.5
cmd:qmake$secondaryArchSuffix >= 5
cmd:xargs
"
@@ -135,27 +105,27 @@ BUILD()
{
mkdir -p build
cd build
qmake ..
cmake .. \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_INSTALL_HEADERS=$includeDir \
-DCMAKE_INSTALL_LIBS=$libDir \
-DCMAKE_INSTALL_BINS=$binDir \
-DCMAKE_INSTALL_QML=$dataDir/Qt5/qml \
-DBUILD_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_PLAYERS=OFF \
-DBUILD_QT5OPENGL=ON \
-DHAVE_PORTAUDIO=OFF \
-DHAVE_PULSE=OFF \
-DHAVE_VAAPI=OFF
make $jobArgs
}
INSTALL()
{
cd build
mkdir -p $libDir
mkdir -p $includeDir
mkdir -p $dataDir/qml/QtAV/
mkdir -p $binDir
cp -f lib_unix*/*Qt*AV*.so* $libDir/
cp -R tools/install_sdk/mkspecs $dataDir/Qt5/
cp -f ../qml/plugins.qmltypes $dataDir/qml/QtAV/
cp -R ../src/QtAV/ $includeDir/
cp -R ../widgets/QtAVWidgets/ $includeDir/
cp -f -R bin/QtAV $dataDir/qml
rm -rf bin/QtAV
cp -f bin/* $binDir/
make install
prepareInstalledDevelLibs \
libQtAV \
@@ -163,10 +133,6 @@ INSTALL()
# devel package
packageEntries devel \
$developDir
}
TEST()
{
make check
$developDir \
$libDir/cmake
}