Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions framework/media/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ target_sources(muse_media PRIVATE
internal/ffmpegutils.cpp
internal/ffmpegutils.h

internal/ffmpeg/v9/ffmpeglibhandler.cpp
internal/ffmpeg/v9/ffmpeglibhandler.h
internal/ffmpeg/v9/videoencoder.cpp
internal/ffmpeg/v9/videoencoder.h

internal/ffmpeg/v8/ffmpeglibhandler.cpp
internal/ffmpeg/v8/ffmpeglibhandler.h
internal/ffmpeg/v8/videoencoder.cpp
Expand All @@ -63,6 +68,12 @@ target_sources(muse_media PRIVATE
internal/ffmpeg/v4/videoencoder.h
)

set_source_files_properties(
internal/ffmpeg/v9/ffmpeglibhandler.cpp
internal/ffmpeg/v9/videoencoder.cpp
PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ffmpeg/v9"
)

set_source_files_properties(
internal/ffmpeg/v8/ffmpeglibhandler.cpp
internal/ffmpeg/v8/videoencoder.cpp
Expand Down Expand Up @@ -92,3 +103,7 @@ set_source_files_properties(
internal/ffmpeg/v4/videoencoder.cpp
PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ffmpeg/v4"
)

if (MUSE_MODULE_MEDIA_TESTS)
add_subdirectory(tests)
endif()
20 changes: 8 additions & 12 deletions framework/media/internal/ffmpeg/v4/ffmpeglibhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "ffmpeglibhandler.h"

#if !defined(Q_OS_WIN)
#include <dlfcn.h>
#endif

#include "io/fileinfo.h"
#include "global/dlib.h"

Expand All @@ -34,21 +30,20 @@
namespace muse::media::ffmpeg::v4 {
#define RESOLVE_FROM(lib, name) do { \
name = reinterpret_cast<decltype(name)>(getSymbol(lib, #name)); \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; return false; } \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; clearFunctions(); return false; } \
} while (0)

FFmpegLibHandler::~FFmpegLibHandler()
{
unload();
}

void* FFmpegLibHandler::getSymbol(void* lib, const char* name) const
{
if (!lib) {
return nullptr;
}
void* sym = muse::getLibFunc(lib, name);
if (!sym) {
#if !defined(Q_OS_WIN)
sym = dlsym(RTLD_DEFAULT, name);
#endif
}
return sym;
return muse::getLibFunc(lib, name);
}

bool FFmpegLibHandler::loadApi()
Expand Down Expand Up @@ -122,6 +117,7 @@ bool FFmpegLibHandler::loadLib(const io::path_t& avUtilPath, const io::path_t& a
|| !tryLoadPath(m_swsScaleLibrary, swScalePath)
|| !tryLoadPath(m_avCodecLibrary, avCodecPath)
|| !tryLoadPath(m_avFormatLibrary, avFormatPath)) {
unload();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions framework/media/internal/ffmpeg/v4/ffmpeglibhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class FFmpegLibHandler
{
public:
FFmpegLibHandler() = default;
~FFmpegLibHandler();
FFmpegLibHandler(const FFmpegLibHandler&) = delete;
FFmpegLibHandler& operator=(const FFmpegLibHandler&) = delete;

bool loadLib(const io::path_t& avUtilPath, const io::path_t& avCodecPath, const io::path_t& avFormatPath, const io::path_t& swScalePath,
const io::path_t& swResamplePath);
Expand Down
20 changes: 8 additions & 12 deletions framework/media/internal/ffmpeg/v5/ffmpeglibhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "ffmpeglibhandler.h"

#if !defined(Q_OS_WIN)
#include <dlfcn.h>
#endif

#include "io/fileinfo.h"
#include "global/dlib.h"

Expand All @@ -34,21 +30,20 @@
namespace muse::media::ffmpeg::v5 {
#define RESOLVE_FROM(lib, name) do { \
name = reinterpret_cast<decltype(name)>(getSymbol(lib, #name)); \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; return false; } \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; clearFunctions(); return false; } \
} while (0)

FFmpegLibHandler::~FFmpegLibHandler()
{
unload();
}

void* FFmpegLibHandler::getSymbol(void* lib, const char* name) const
{
if (!lib) {
return nullptr;
}
void* sym = muse::getLibFunc(lib, name);
if (!sym) {
#if !defined(Q_OS_WIN)
sym = dlsym(RTLD_DEFAULT, name);
#endif
}
return sym;
return muse::getLibFunc(lib, name);
}

bool FFmpegLibHandler::loadApi()
Expand Down Expand Up @@ -122,6 +117,7 @@ bool FFmpegLibHandler::loadLib(const io::path_t& avUtilPath, const io::path_t& a
|| !tryLoadPath(m_swsScaleLibrary, swScalePath)
|| !tryLoadPath(m_avCodecLibrary, avCodecPath)
|| !tryLoadPath(m_avFormatLibrary, avFormatPath)) {
unload();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions framework/media/internal/ffmpeg/v5/ffmpeglibhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class FFmpegLibHandler
{
public:
FFmpegLibHandler() = default;
~FFmpegLibHandler();
FFmpegLibHandler(const FFmpegLibHandler&) = delete;
FFmpegLibHandler& operator=(const FFmpegLibHandler&) = delete;

bool loadLib(const io::path_t& avUtilPath, const io::path_t& avCodecPath, const io::path_t& avFormatPath, const io::path_t& swScalePath,
const io::path_t& swResamplePath);
Expand Down
20 changes: 8 additions & 12 deletions framework/media/internal/ffmpeg/v6/ffmpeglibhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "ffmpeglibhandler.h"

#if !defined(Q_OS_WIN)
#include <dlfcn.h>
#endif

#include "io/fileinfo.h"
#include "global/dlib.h"

Expand All @@ -34,21 +30,20 @@
namespace muse::media::ffmpeg::v6 {
#define RESOLVE_FROM(lib, name) do { \
name = reinterpret_cast<decltype(name)>(getSymbol(lib, #name)); \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; return false; } \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; clearFunctions(); return false; } \
} while (0)

FFmpegLibHandler::~FFmpegLibHandler()
{
unload();
}

void* FFmpegLibHandler::getSymbol(void* lib, const char* name) const
{
if (!lib) {
return nullptr;
}
void* sym = muse::getLibFunc(lib, name);
if (!sym) {
#if !defined(Q_OS_WIN)
sym = dlsym(RTLD_DEFAULT, name);
#endif
}
return sym;
return muse::getLibFunc(lib, name);
}

bool FFmpegLibHandler::loadApi()
Expand Down Expand Up @@ -122,6 +117,7 @@ bool FFmpegLibHandler::loadLib(const io::path_t& avUtilPath, const io::path_t& a
|| !tryLoadPath(m_swsScaleLibrary, swScalePath)
|| !tryLoadPath(m_avCodecLibrary, avCodecPath)
|| !tryLoadPath(m_avFormatLibrary, avFormatPath)) {
unload();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions framework/media/internal/ffmpeg/v6/ffmpeglibhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class FFmpegLibHandler
{
public:
FFmpegLibHandler() = default;
~FFmpegLibHandler();
FFmpegLibHandler(const FFmpegLibHandler&) = delete;
FFmpegLibHandler& operator=(const FFmpegLibHandler&) = delete;

bool loadLib(const io::path_t& avUtilPath, const io::path_t& avCodecPath, const io::path_t& avFormatPath, const io::path_t& swScalePath,
const io::path_t& swResamplePath);
Expand Down
20 changes: 8 additions & 12 deletions framework/media/internal/ffmpeg/v7/ffmpeglibhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "ffmpeglibhandler.h"

#if !defined(Q_OS_WIN)
#include <dlfcn.h>
#endif

#include "io/fileinfo.h"
#include "global/dlib.h"

Expand All @@ -34,21 +30,20 @@
namespace muse::media::ffmpeg::v7 {
#define RESOLVE_FROM(lib, name) do { \
name = reinterpret_cast<decltype(name)>(getSymbol(lib, #name)); \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; return false; } \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; clearFunctions(); return false; } \
} while (0)

FFmpegLibHandler::~FFmpegLibHandler()
{
unload();
}

void* FFmpegLibHandler::getSymbol(void* lib, const char* name) const
{
if (!lib) {
return nullptr;
}
void* sym = muse::getLibFunc(lib, name);
if (!sym) {
#if !defined(Q_OS_WIN)
sym = dlsym(RTLD_DEFAULT, name);
#endif
}
return sym;
return muse::getLibFunc(lib, name);
}

bool FFmpegLibHandler::loadApi()
Expand Down Expand Up @@ -122,6 +117,7 @@ bool FFmpegLibHandler::loadLib(const io::path_t& avUtilPath, const io::path_t& a
|| !tryLoadPath(m_swsScaleLibrary, swScalePath)
|| !tryLoadPath(m_avCodecLibrary, avCodecPath)
|| !tryLoadPath(m_avFormatLibrary, avFormatPath)) {
unload();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions framework/media/internal/ffmpeg/v7/ffmpeglibhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class FFmpegLibHandler
{
public:
FFmpegLibHandler() = default;
~FFmpegLibHandler();
FFmpegLibHandler(const FFmpegLibHandler&) = delete;
FFmpegLibHandler& operator=(const FFmpegLibHandler&) = delete;

bool loadLib(const io::path_t& avUtilPath, const io::path_t& avCodecPath, const io::path_t& avFormatPath, const io::path_t& swScalePath,
const io::path_t& swResamplePath);
Expand Down
20 changes: 8 additions & 12 deletions framework/media/internal/ffmpeg/v8/ffmpeglibhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@

#include "ffmpeglibhandler.h"

#if !defined(Q_OS_WIN)
#include <dlfcn.h>
#endif

#include "io/fileinfo.h"
#include "global/dlib.h"

Expand All @@ -34,21 +30,20 @@
namespace muse::media::ffmpeg::v8 {
#define RESOLVE_FROM(lib, name) do { \
name = reinterpret_cast<decltype(name)>(getSymbol(lib, #name)); \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; return false; } \
if (!name) { LOGW() << "FFmpeg: missing symbol " #name; clearFunctions(); return false; } \
} while (0)

FFmpegLibHandler::~FFmpegLibHandler()
{
unload();
}

void* FFmpegLibHandler::getSymbol(void* lib, const char* name) const
{
if (!lib) {
return nullptr;
}
void* sym = muse::getLibFunc(lib, name);
if (!sym) {
#if !defined(Q_OS_WIN)
sym = dlsym(RTLD_DEFAULT, name);
#endif
}
return sym;
return muse::getLibFunc(lib, name);
}

bool FFmpegLibHandler::loadApi()
Expand Down Expand Up @@ -122,6 +117,7 @@ bool FFmpegLibHandler::loadLib(const io::path_t& avUtilPath, const io::path_t& a
|| !tryLoadPath(m_swsScaleLibrary, swScalePath)
|| !tryLoadPath(m_avCodecLibrary, avCodecPath)
|| !tryLoadPath(m_avFormatLibrary, avFormatPath)) {
unload();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions framework/media/internal/ffmpeg/v8/ffmpeglibhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class FFmpegLibHandler
{
public:
FFmpegLibHandler() = default;
~FFmpegLibHandler();
FFmpegLibHandler(const FFmpegLibHandler&) = delete;
FFmpegLibHandler& operator=(const FFmpegLibHandler&) = delete;

bool loadLib(const io::path_t& avUtilPath, const io::path_t& avCodecPath, const io::path_t& avFormatPath, const io::path_t& swScalePath,
const io::path_t& swResamplePath);
Expand Down
Loading