From cd5df622a982966d55798cb3bc120a25ae1077a1 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Thu, 12 Feb 2026 01:36:21 +0900 Subject: [PATCH] [3PP] Switch FFmpeg to latest release with port of xmaframes codec And pull out all the xenia specific build junk into third_party/ffmpeg-xenia rather than keeping it checked in the submodule --- .gitmodules | 3 +- premake5.lua | 2 +- src/xenia/apu/audio_media_player.cc | 5 +- src/xenia/apu/premake5.lua | 1 + src/xenia/apu/xma_context.cc | 2 +- src/xenia/apu/xma_context.h | 2 +- src/xenia/apu/xma_context_master.cc | 19 +- src/xenia/apu/xma_context_new.cc | 23 +- src/xenia/apu/xma_context_old.cc | 22 +- third_party/FFmpeg | 2 +- third_party/ffmpeg-xenia/config.h | 421 ++++++++++++++++++ third_party/ffmpeg-xenia/config_components.h | 12 + .../ffmpeg-xenia/libavcodec/bsf_list.c | 3 + .../ffmpeg-xenia/libavcodec/codec_list.c | 7 + .../ffmpeg-xenia/libavcodec/parser_list.c | 3 + .../ffmpeg-xenia/libavcodec/premake5.lua | 156 +++++++ .../ffmpeg-xenia/libavformat/demuxer_list.c | 4 + .../ffmpeg-xenia/libavformat/muxer_list.c | 2 + .../ffmpeg-xenia/libavformat/premake5.lua | 61 +++ .../ffmpeg-xenia/libavformat/protocol_list.c | 3 + third_party/ffmpeg-xenia/libavutil/avconfig.h | 6 + .../ffmpeg-xenia/libavutil/ffversion.h | 4 + .../ffmpeg-xenia/libavutil/premake5.lua | 225 ++++++++++ third_party/ffmpeg-xenia/premake5.lua | 42 ++ xenia-build.py | 9 +- 25 files changed, 998 insertions(+), 41 deletions(-) create mode 100644 third_party/ffmpeg-xenia/config.h create mode 100644 third_party/ffmpeg-xenia/config_components.h create mode 100644 third_party/ffmpeg-xenia/libavcodec/bsf_list.c create mode 100644 third_party/ffmpeg-xenia/libavcodec/codec_list.c create mode 100644 third_party/ffmpeg-xenia/libavcodec/parser_list.c create mode 100644 third_party/ffmpeg-xenia/libavcodec/premake5.lua create mode 100644 third_party/ffmpeg-xenia/libavformat/demuxer_list.c create mode 100644 third_party/ffmpeg-xenia/libavformat/muxer_list.c create mode 100644 third_party/ffmpeg-xenia/libavformat/premake5.lua create mode 100644 third_party/ffmpeg-xenia/libavformat/protocol_list.c create mode 100644 third_party/ffmpeg-xenia/libavutil/avconfig.h create mode 100644 third_party/ffmpeg-xenia/libavutil/ffversion.h create mode 100644 third_party/ffmpeg-xenia/libavutil/premake5.lua create mode 100644 third_party/ffmpeg-xenia/premake5.lua diff --git a/.gitmodules b/.gitmodules index 6fd607f14..f2de9aba9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,7 +61,8 @@ url = https://github.com/Cyan4973/xxHash.git [submodule "third_party/FFmpeg"] path = third_party/FFmpeg - url = https://github.com/xenia-canary/FFmpeg_radixsplit.git + url = https://github.com/has207/FFmpeg.git + branch = xmaframes [submodule "third_party/premake-androidndk"] path = third_party/premake-androidndk url = https://github.com/Triang3l/premake-androidndk.git diff --git a/premake5.lua b/premake5.lua index 8e38d0bee..0062425fb 100644 --- a/premake5.lua +++ b/premake5.lua @@ -308,7 +308,7 @@ workspace("xenia") include("third_party/discord-rpc.lua") include("third_party/cxxopts.lua") include("third_party/tomlplusplus.lua") - include("third_party/FFmpeg/premake5.lua") + include("third_party/ffmpeg-xenia/premake5.lua") include("third_party/fmt.lua") include("third_party/glslang-spirv.lua") include("third_party/imgui.lua") diff --git a/src/xenia/apu/audio_media_player.cc b/src/xenia/apu/audio_media_player.cc index fdbd2e14a..0a7f75b0a 100644 --- a/src/xenia/apu/audio_media_player.cc +++ b/src/xenia/apu/audio_media_player.cc @@ -130,7 +130,7 @@ ProcessAudioResult ProcessAudioLoop(AudioMediaPlayer* player, break; } - ConvertAudioFrame(frame, avctx->channels, &frameBuffer); + ConvertAudioFrame(frame, avctx->ch_layout.nb_channels, &frameBuffer); player->ProcessAudioBuffer(&frameBuffer); } } @@ -230,7 +230,8 @@ void AudioMediaPlayer::Play() { AVCodecContext* codecContext = nullptr; InitializeAndOpenAvCodec(song_buffer, formatContext, codecContext); - if (!SetupDriver(codecContext->sample_rate, codecContext->channels)) { + if (!SetupDriver(codecContext->sample_rate, + codecContext->ch_layout.nb_channels)) { XELOGE("Driver initialization failed!"); avcodec_free_context(&codecContext); av_freep(&formatContext->pb->buffer); diff --git a/src/xenia/apu/premake5.lua b/src/xenia/apu/premake5.lua index c18e1a44e..0768b19be 100644 --- a/src/xenia/apu/premake5.lua +++ b/src/xenia/apu/premake5.lua @@ -14,5 +14,6 @@ project("xenia-apu") }) includedirs({ project_root.."/third_party/FFmpeg", + project_root.."/third_party/ffmpeg-xenia", }) local_platform_files() diff --git a/src/xenia/apu/xma_context.cc b/src/xenia/apu/xma_context.cc index e0cf74bb9..51160581b 100644 --- a/src/xenia/apu/xma_context.cc +++ b/src/xenia/apu/xma_context.cc @@ -49,7 +49,7 @@ void XmaContext::DumpRaw(AVFrame* frame, int id) { } size_t data_size = sizeof(float); for (int i = 0; i < frame->nb_samples; i++) { - for (int ch = 0; ch < frame->channels; ch++) { + for (int ch = 0; ch < frame->ch_layout.nb_channels; ch++) { fwrite(frame->data[ch] + data_size * i, 1, data_size, outfile); } } diff --git a/src/xenia/apu/xma_context.h b/src/xenia/apu/xma_context.h index 6cc1563c1..558f63633 100644 --- a/src/xenia/apu/xma_context.h +++ b/src/xenia/apu/xma_context.h @@ -252,7 +252,7 @@ class XmaContext { // ffmpeg structures AVPacket* av_packet_ = nullptr; - AVCodec* av_codec_ = nullptr; + const AVCodec* av_codec_ = nullptr; AVCodecContext* av_context_ = nullptr; AVFrame* av_frame_ = nullptr; }; diff --git a/src/xenia/apu/xma_context_master.cc b/src/xenia/apu/xma_context_master.cc index f6e179100..9ad0d8b5d 100644 --- a/src/xenia/apu/xma_context_master.cc +++ b/src/xenia/apu/xma_context_master.cc @@ -25,6 +25,7 @@ extern "C" { #pragma warning(disable : 4101 4244 5033) #endif #include "third_party/FFmpeg/libavcodec/avcodec.h" +#include "third_party/FFmpeg/libavutil/channel_layout.h" #if XE_COMPILER_MSVC #pragma warning(pop) #endif @@ -40,10 +41,7 @@ XmaContextMaster::XmaContextMaster() = default; XmaContextMaster::~XmaContextMaster() { if (av_context_) { - if (avcodec_is_open(av_context_)) { - avcodec_close(av_context_); - } - av_free(av_context_); + avcodec_free_context(&av_context_); } if (av_frame_) { av_frame_free(&av_frame_); @@ -78,7 +76,7 @@ int XmaContextMaster::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) { } // Initialize these to 0. They'll actually be set later. - av_context_->channels = 0; + av_context_->ch_layout = AVChannelLayout{}; av_context_->sample_rate = 0; av_frame_ = av_frame_alloc(); @@ -825,13 +823,14 @@ int XmaContextMaster::PrepareDecoder(uint8_t* packet, int sample_rate, // Re-initialize the context with new sample rate and channels. uint32_t channels = is_two_channel ? 2 : 1; if (av_context_->sample_rate != sample_rate || - av_context_->channels != channels) { - // We have to reopen the codec so it'll realloc whatever data it needs. - // TODO(DrChat): Find a better way. - avcodec_close(av_context_); + av_context_->ch_layout.nb_channels != (int)channels) { + // We have to recreate the codec context so it'll realloc whatever data it + // needs. + avcodec_free_context(&av_context_); + av_context_ = avcodec_alloc_context3(av_codec_); av_context_->sample_rate = sample_rate; - av_context_->channels = channels; + av_channel_layout_default(&av_context_->ch_layout, channels); if (avcodec_open2(av_context_, av_codec_, NULL) < 0) { XELOGE("XmaContext: Failed to reopen FFmpeg context"); diff --git a/src/xenia/apu/xma_context_new.cc b/src/xenia/apu/xma_context_new.cc index 3fe5a52d0..31b328ae5 100644 --- a/src/xenia/apu/xma_context_new.cc +++ b/src/xenia/apu/xma_context_new.cc @@ -20,6 +20,7 @@ extern "C" { #pragma warning(disable : 4101 4244 5033) #endif #include "third_party/FFmpeg/libavcodec/avcodec.h" +#include "third_party/FFmpeg/libavutil/channel_layout.h" #if XE_COMPILER_MSVC #pragma warning(pop) #endif @@ -35,10 +36,7 @@ XmaContextNew::XmaContextNew() = default; XmaContextNew::~XmaContextNew() { if (av_context_) { - if (avcodec_is_open(av_context_)) { - avcodec_close(av_context_); - } - av_free(av_context_); + avcodec_free_context(&av_context_); } if (av_frame_) { av_frame_free(&av_frame_); @@ -69,7 +67,7 @@ int XmaContextNew::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) { } // Initialize these to 0. They'll actually be set later. - av_context_->channels = 0; + av_context_->ch_layout = AVChannelLayout{}; av_context_->sample_rate = 0; av_frame_ = av_frame_alloc(); @@ -818,16 +816,17 @@ int XmaContextNew::PrepareDecoder(int sample_rate, bool is_two_channel) { // Re-initialize the context with new sample rate and channels. uint32_t channels = is_two_channel ? 2 : 1; if (av_context_->sample_rate != sample_rate || - av_context_->channels != channels) { + av_context_->ch_layout.nb_channels != (int)channels) { XELOGAPU("XmaContext {}: Codec reinit: rate {} -> {}, channels {} -> {}", - id(), av_context_->sample_rate, sample_rate, av_context_->channels, - channels); - // We have to reopen the codec so it'll realloc whatever data it needs. - // TODO(DrChat): Find a better way. - avcodec_close(av_context_); + id(), av_context_->sample_rate, sample_rate, + av_context_->ch_layout.nb_channels, channels); + // We have to recreate the codec context so it'll realloc whatever data it + // needs. + avcodec_free_context(&av_context_); + av_context_ = avcodec_alloc_context3(av_codec_); av_context_->sample_rate = sample_rate; - av_context_->channels = channels; + av_channel_layout_default(&av_context_->ch_layout, channels); if (avcodec_open2(av_context_, av_codec_, NULL) < 0) { XELOGE("XmaContext: Failed to reopen FFmpeg context"); diff --git a/src/xenia/apu/xma_context_old.cc b/src/xenia/apu/xma_context_old.cc index ed6b3c4f1..b0196f116 100644 --- a/src/xenia/apu/xma_context_old.cc +++ b/src/xenia/apu/xma_context_old.cc @@ -25,6 +25,7 @@ extern "C" { #pragma warning(disable : 4101 4244 5033) #endif #include "third_party/FFmpeg/libavcodec/avcodec.h" +#include "third_party/FFmpeg/libavutil/channel_layout.h" #if XE_COMPILER_MSVC #pragma warning(pop) #endif @@ -40,10 +41,7 @@ XmaContextOld::XmaContextOld() = default; XmaContextOld::~XmaContextOld() { if (av_context_) { - if (avcodec_is_open(av_context_)) { - avcodec_close(av_context_); - } - av_free(av_context_); + avcodec_free_context(&av_context_); } if (av_frame_) { av_frame_free(&av_frame_); @@ -78,7 +76,7 @@ int XmaContextOld::Setup(uint32_t id, Memory* memory, uint32_t guest_ptr) { } // Initialize these to 0. They'll actually be set later. - av_context_->channels = 0; + av_context_->ch_layout = AVChannelLayout{}; av_context_->sample_rate = 0; av_frame_ = av_frame_alloc(); @@ -664,7 +662,8 @@ void XmaContextOld::Decode(XMA_CONTEXT_DATA* data) { // dump_raw(av_frame_, id()); ConvertFrame(reinterpret_cast(&av_frame_->data), - bool(av_frame_->channels > 1), raw_frame_.data()); + bool(av_frame_->ch_layout.nb_channels > 1), + raw_frame_.data()); // decoded_consumed_samples_ += kSamplesPerFrame; auto byte_count = kBytesPerFrameChannel << data->is_stereo; @@ -928,13 +927,14 @@ int XmaContextOld::PrepareDecoder(uint8_t* packet, int sample_rate, // Re-initialize the context with new sample rate and channels. uint32_t channels = is_two_channel ? 2 : 1; if (av_context_->sample_rate != sample_rate || - av_context_->channels != channels) { - // We have to reopen the codec so it'll realloc whatever data it needs. - // TODO(DrChat): Find a better way. - avcodec_close(av_context_); + av_context_->ch_layout.nb_channels != (int)channels) { + // We have to recreate the codec context so it'll realloc whatever data it + // needs. + avcodec_free_context(&av_context_); + av_context_ = avcodec_alloc_context3(av_codec_); av_context_->sample_rate = sample_rate; - av_context_->channels = channels; + av_channel_layout_default(&av_context_->ch_layout, channels); if (avcodec_open2(av_context_, av_codec_, NULL) < 0) { XELOGE("XmaContext: Failed to reopen FFmpeg context"); diff --git a/third_party/FFmpeg b/third_party/FFmpeg index 85e39939c..d1963569c 160000 --- a/third_party/FFmpeg +++ b/third_party/FFmpeg @@ -1 +1 @@ -Subproject commit 85e39939c90f3b34efe45fee29a2b653d06b55e5 +Subproject commit d1963569c9ed55ca826f353071cfe1c7dfc9234f diff --git a/third_party/ffmpeg-xenia/config.h b/third_party/ffmpeg-xenia/config.h new file mode 100644 index 000000000..f31ca55bd --- /dev/null +++ b/third_party/ffmpeg-xenia/config.h @@ -0,0 +1,421 @@ +/* + * FFmpeg build configuration for xenia. + * Replaces 4 per-platform generated config headers with a single file + * using preprocessor platform detection. + * Undefined macros evaluate to 0 in #if checks. + */ +#ifndef FFMPEG_CONFIG_H +#define FFMPEG_CONFIG_H + +#define FFMPEG_CONFIGURATION "xenia-custom" +#define FFMPEG_LICENSE "LGPL version 2.1 or later" +#define CONFIG_THIS_YEAR 2021 +#define av_restrict restrict +#define EXTERN_PREFIX "" +#define EXTERN_ASM +#define BUILDSUF "" +#define HAVE_MMX2 HAVE_MMXEXT +#define SWS_MAX_FILTER_SIZE 256 + +/* ------------------------------------------------------------------ */ +/* Architecture + CPU features */ +/* Some of these are used in C if() expressions, not just #if, so */ +/* every ARCH_* / HAVE_*_EXTERNAL must be explicitly defined. */ +/* ------------------------------------------------------------------ */ + +/* Zero-default all architecture flags (used in C if() expressions) */ +#define ARCH_AARCH64 0 +#define ARCH_ALPHA 0 +#define ARCH_ARM 0 +#define ARCH_MIPS 0 +#define ARCH_PPC 0 +#define ARCH_X86 0 +#define ARCH_X86_64 0 + +#if defined(__aarch64__) + /* ARM64 (Android) */ + #define SLIBSUF ".so" + #undef ARCH_AARCH64 + #define ARCH_AARCH64 1 + #define HAVE_ARMV8 1 + #define HAVE_NEON 1 + #define HAVE_VFP 1 + #define HAVE_ARMV8_EXTERNAL 1 + #define HAVE_NEON_EXTERNAL 1 + #define HAVE_VFP_EXTERNAL 1 + #define HAVE_ARMV8_INLINE 1 + #define HAVE_NEON_INLINE 1 + #define HAVE_VFP_INLINE 1 + #define HAVE_INTRINSICS_NEON 1 + #define HAVE_ALIGNED_STACK 1 + #define HAVE_FAST_64BIT 1 + #define HAVE_FAST_CLZ 1 + #define HAVE_SIMD_ALIGN_16 1 +#elif defined(__x86_64__) || defined(_M_X64) + /* x86_64 (Windows, Linux, Android x86_64) */ + #if defined(_WIN32) + #define SLIBSUF ".dll" + #else + #define SLIBSUF ".so" + #endif + #undef ARCH_X86 + #define ARCH_X86 1 + #undef ARCH_X86_64 + #define ARCH_X86_64 1 + #define HAVE_AESNI 1 + #define HAVE_AMD3DNOW 1 + #define HAVE_AMD3DNOWEXT 1 + #define HAVE_AVX 1 + #define HAVE_AVX2 1 + #define HAVE_AVX512 1 + #define HAVE_FMA3 1 + #define HAVE_FMA4 1 + #define HAVE_MMX 1 + #define HAVE_MMXEXT 1 + #define HAVE_SSE 1 + #define HAVE_SSE2 1 + #define HAVE_SSE3 1 + #define HAVE_SSE4 1 + #define HAVE_SSE42 1 + #define HAVE_SSSE3 1 + #define HAVE_XOP 1 + #define HAVE_CPUNOP 1 + #define HAVE_I686 1 + #define HAVE_ALIGNED_STACK 1 + #define HAVE_FAST_64BIT 1 + #define HAVE_FAST_CLZ 1 + #define HAVE_FAST_CMOV 1 + #define HAVE_LOCAL_ALIGNED 1 + #define HAVE_SIMD_ALIGN_16 1 + #define HAVE_SIMD_ALIGN_32 1 + #define HAVE_SIMD_ALIGN_64 1 + /* GCC/Clang x86 inline asm variants */ + #if !defined(_MSC_VER) + #define HAVE_AESNI_INLINE 1 + #define HAVE_AMD3DNOW_INLINE 1 + #define HAVE_AMD3DNOWEXT_INLINE 1 + #define HAVE_AVX_INLINE 1 + #define HAVE_AVX2_INLINE 1 + #define HAVE_AVX512_INLINE 1 + #define HAVE_FMA3_INLINE 1 + #define HAVE_FMA4_INLINE 1 + #define HAVE_MMX_INLINE 1 + #define HAVE_MMXEXT_INLINE 1 + #define HAVE_SSE_INLINE 1 + #define HAVE_SSE2_INLINE 1 + #define HAVE_SSE3_INLINE 1 + #define HAVE_SSE4_INLINE 1 + #define HAVE_SSE42_INLINE 1 + #define HAVE_SSSE3_INLINE 1 + #define HAVE_XOP_INLINE 1 + #define HAVE_MM_EMPTY 1 + #define HAVE_EBP_AVAILABLE 1 + #define HAVE_EBX_AVAILABLE 1 + #define HAVE_XMM_CLOBBERS 1 + #define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 + #endif +#else + #error "Unsupported architecture for FFmpeg build" +#endif + +/* Endianness (used in C expressions, not just #if) */ +#define HAVE_BIGENDIAN 0 + +/* Zero-default all INLINE flags (only set to 1 on GCC/Clang above) */ +#ifndef HAVE_AESNI_INLINE +#define HAVE_AESNI_INLINE 0 +#endif +#ifndef HAVE_AMD3DNOW_INLINE +#define HAVE_AMD3DNOW_INLINE 0 +#endif +#ifndef HAVE_AMD3DNOWEXT_INLINE +#define HAVE_AMD3DNOWEXT_INLINE 0 +#endif +#ifndef HAVE_AVX_INLINE +#define HAVE_AVX_INLINE 0 +#endif +#ifndef HAVE_AVX2_INLINE +#define HAVE_AVX2_INLINE 0 +#endif +#ifndef HAVE_AVX512_INLINE +#define HAVE_AVX512_INLINE 0 +#endif +#ifndef HAVE_FMA3_INLINE +#define HAVE_FMA3_INLINE 0 +#endif +#ifndef HAVE_FMA4_INLINE +#define HAVE_FMA4_INLINE 0 +#endif +#ifndef HAVE_MMX_INLINE +#define HAVE_MMX_INLINE 0 +#endif +#ifndef HAVE_MMXEXT_INLINE +#define HAVE_MMXEXT_INLINE 0 +#endif +#ifndef HAVE_SSE_INLINE +#define HAVE_SSE_INLINE 0 +#endif +#ifndef HAVE_SSE2_INLINE +#define HAVE_SSE2_INLINE 0 +#endif +#ifndef HAVE_SSE3_INLINE +#define HAVE_SSE3_INLINE 0 +#endif +#ifndef HAVE_SSE4_INLINE +#define HAVE_SSE4_INLINE 0 +#endif +#ifndef HAVE_SSE42_INLINE +#define HAVE_SSE42_INLINE 0 +#endif +#ifndef HAVE_SSSE3_INLINE +#define HAVE_SSSE3_INLINE 0 +#endif +#ifndef HAVE_XOP_INLINE +#define HAVE_XOP_INLINE 0 +#endif + +/* x86asm (nasm/yasm) is not used; all EXTERNAL flags are 0 */ +#define HAVE_X86ASM 0 +#define HAVE_AESNI_EXTERNAL 0 +#define HAVE_AMD3DNOW_EXTERNAL 0 +#define HAVE_AMD3DNOWEXT_EXTERNAL 0 +#define HAVE_AVX_EXTERNAL 0 +#define HAVE_AVX2_EXTERNAL 0 +#define HAVE_AVX512_EXTERNAL 0 +#define HAVE_FMA3_EXTERNAL 0 +#define HAVE_FMA4_EXTERNAL 0 +#define HAVE_MMX_EXTERNAL 0 +#define HAVE_MMXEXT_EXTERNAL 0 +#define HAVE_SSE_EXTERNAL 0 +#define HAVE_SSE2_EXTERNAL 0 +#define HAVE_SSE3_EXTERNAL 0 +#define HAVE_SSE4_EXTERNAL 0 +#define HAVE_SSE42_EXTERNAL 0 +#define HAVE_SSSE3_EXTERNAL 0 +#define HAVE_XOP_EXTERNAL 0 +#define HAVE_CPUNOP_EXTERNAL 0 +#define HAVE_I686_EXTERNAL 0 + +/* MIPS CPU features (used in C if() expressions) */ +#define HAVE_MIPSFPU 0 +#define HAVE_MIPSDSP 0 + +/* CPU features used in C expressions cross-platform (e.g. mem.c ALIGN) */ +#ifndef HAVE_AVX +#define HAVE_AVX 0 +#endif +#ifndef HAVE_AVX512 +#define HAVE_AVX512 0 +#endif + +/* Disabled features (used in C if() expressions, not just #if) */ +#define CONFIG_FRAME_THREAD_ENCODER 0 +#define CONFIG_GRAY 0 +#define CONFIG_MEMORY_POISONING 0 +#define CONFIG_MPEG4_DECODER 0 +#define CONFIG_SMALL 0 +#define CONFIG_ZLIB 0 + +/* ------------------------------------------------------------------ */ +/* OS-specific defines */ +/* ------------------------------------------------------------------ */ + +#if defined(_WIN32) + /* Windows (MSVC) */ + #define HAVE_W32THREADS 1 + #define HAVE_WINDOWS_H 1 + #define HAVE_IO_H 1 + #define HAVE_DIRECT_H 1 + #define HAVE_DXGIDEBUG_H 1 + #define HAVE_DXVA_H 1 + #define HAVE_ALIGNED_MALLOC 1 + #define HAVE_BCRYPT 1 + #define HAVE_DOS_PATHS 1 + #define HAVE_LIBC_MSVCRT 1 + #define HAVE_MEMORYBARRIER 1 + #define HAVE_RDTSC 1 + #define HAVE_COMMANDLINETOARGVW 1 + #define HAVE_GETMODULEHANDLE 1 + #define HAVE_GETPROCESSAFFINITYMASK 1 + #define HAVE_GETPROCESSMEMORYINFO 1 + #define HAVE_GETPROCESSTIMES 1 + #define HAVE_GETSTDHANDLE 1 + #define HAVE_GETSYSTEMTIMEASFILETIME 1 + #define HAVE_KBHIT 1 + #define HAVE_MAPVIEWOFFILE 1 + #define HAVE_PEEKNAMEDPIPE 1 + #define HAVE_SETCONSOLETEXTATTRIBUTE 1 + #define HAVE_SETCONSOLECTRLHANDLER 1 + #define HAVE_SETDLLDIRECTORY 1 + #define HAVE_SETMODE 1 + #define HAVE_SLEEP 1 + #define HAVE_VIRTUALALLOC 1 +#else + /* POSIX (Linux, Android) */ + #define HAVE_DOS_PATHS 0 + #define HAVE_PTHREADS 1 + #define HAVE_INLINE_ASM 1 + #define HAVE_UNISTD_H 1 + #define HAVE_ARPA_INET_H 1 + #define HAVE_ASM_TYPES_H 1 + #define HAVE_DIRENT_H 1 + #define HAVE_LINUX_PERF_EVENT_H 1 + #define HAVE_POLL_H 1 + #define HAVE_SYS_PARAM_H 1 + #define HAVE_SYS_RESOURCE_H 1 + #define HAVE_SYS_SELECT_H 1 + #define HAVE_SYS_TIME_H 1 + #define HAVE_SYS_UN_H 1 + #define HAVE_TERMIOS_H 1 + #define HAVE_SEM_TIMEDWAIT 1 + #define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 + #define HAVE_SECTION_DATA_REL_RO 1 + #define HAVE_CLOCK_GETTIME 1 + #define HAVE_FCNTL 1 + #define HAVE_GETADDRINFO 1 + #define HAVE_GETOPT 1 + #define HAVE_GETRUSAGE 1 + #define HAVE_GETTIMEOFDAY 1 + #define HAVE_GMTIME_R 1 + #define HAVE_INET_ATON 1 + #define HAVE_LOCALTIME_R 1 + #define HAVE_LSTAT 1 + #define HAVE_MEMALIGN 1 + #define HAVE_MKSTEMP 1 + #define HAVE_MMAP 1 + #define HAVE_MPROTECT 1 + #define HAVE_NANOSLEEP 1 + #define HAVE_POSIX_MEMALIGN 1 + #define HAVE_SCHED_GETAFFINITY 1 + #define HAVE_SETRLIMIT 1 + #define HAVE_STRERROR_R 1 + #define HAVE_SYSCONF 1 + #define HAVE_USLEEP 1 + #define HAVE_INLINE_ASM_LABELS 1 + #define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 + #define HAVE_SYMVER_ASM_LABEL 1 + #define HAVE_SYMVER_GNU_ASM 1 + #define HAVE_SOCKLEN_T 1 + #define HAVE_STRUCT_ADDRINFO 1 + #define HAVE_STRUCT_GROUP_SOURCE_REQ 1 + #define HAVE_STRUCT_IP_MREQ_SOURCE 1 + #define HAVE_STRUCT_IPV6_MREQ 1 + #define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1 + #define HAVE_STRUCT_POLLFD 1 + #define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 + #define HAVE_STRUCT_SOCKADDR_IN6 1 + #define HAVE_STRUCT_SOCKADDR_STORAGE 1 + #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 + #define CONFIG_PIC 1 + #if defined(__ANDROID__) + #define HAVE_ARC4RANDOM 1 + #define HAVE_RSYNC_CONTIMEOUT 1 + #else + /* Linux desktop */ + #define HAVE_PTHREAD_CANCEL 1 + #define HAVE_SYMVER 1 + #define HAVE_SYS_SOUNDCARD_H 1 + #define HAVE_GLOB 1 + #define CONFIG_ICONV 1 + #endif +#endif + +/* ------------------------------------------------------------------ */ +/* Common to all platforms */ +/* ------------------------------------------------------------------ */ + +#define HAVE_FAST_UNALIGNED 1 +#define HAVE_THREADS 1 +#define HAVE_ACCESS 1 +#define HAVE_ISATTY 1 +#define HAVE_MALLOC_H 1 +#define HAVE_PRAGMA_DEPRECATED 1 + +/* Math functions */ +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_CBRT 1 +#define HAVE_CBRTF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COSF 1 +#define HAVE_ERF 1 +#define HAVE_EXP2 1 +#define HAVE_EXP2F 1 +#define HAVE_EXPF 1 +#define HAVE_HYPOT 1 +#define HAVE_ISFINITE 1 +#define HAVE_ISINF 1 +#define HAVE_ISNAN 1 +#define HAVE_LDEXPF 1 +#define HAVE_LLRINT 1 +#define HAVE_LLRINTF 1 +#define HAVE_LOG2 1 +#define HAVE_LOG2F 1 +#define HAVE_LOG10F 1 +#define HAVE_LRINT 1 +#define HAVE_LRINTF 1 +#define HAVE_POWF 1 +#define HAVE_RINT 1 +#define HAVE_ROUND 1 +#define HAVE_ROUNDF 1 +#define HAVE_SINF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 + +/* Enabled library components */ +#define CONFIG_AVCODEC 1 +#define CONFIG_AVFORMAT 1 +#define CONFIG_AVUTIL 1 +#define CONFIG_RUNTIME_CPUDETECT 1 +#define CONFIG_SAFE_BITSTREAM_READER 1 +#define CONFIG_STATIC 1 +#define CONFIG_SWSCALE_ALPHA 1 + +/* DSP / transform support */ +#define CONFIG_DCT 1 +#define CONFIG_FAAN 1 +#define CONFIG_FAANDCT 1 +#define CONFIG_FAANIDCT 1 +#define CONFIG_FAST_UNALIGNED 1 +#define CONFIG_FDCTDSP 1 +#define CONFIG_FFT 1 +#define CONFIG_IDCTDSP 1 +#define CONFIG_MDCT 1 +#define CONFIG_RDFT 1 +#define CONFIG_SINEWIN 1 + +/* Audio codec support */ +#define CONFIG_MPEGAUDIO 1 +#define CONFIG_MPEGAUDIODSP 1 +#define CONFIG_MPEGAUDIOHEADER 1 +#define CONFIG_WMA_FREQS 1 +#define CONFIG_RIFFDEC 1 + +/* Category enables */ +#define CONFIG_BSFS 1 +#define CONFIG_DECODERS 1 +#define CONFIG_DEMUXERS 1 +#define CONFIG_PARSERS 1 +#define CONFIG_PROTOCOLS 1 + +/* Enabled codecs */ +#define CONFIG_MP3_DECODER 1 +#define CONFIG_MP3FLOAT_DECODER 1 +#define CONFIG_WMAPRO_DECODER 1 +#define CONFIG_WMAV2_DECODER 1 +#define CONFIG_XMAFRAMES_DECODER 1 + +/* Enabled parsers */ +#define CONFIG_MPEGAUDIO_PARSER 1 + +/* Enabled demuxers */ +#define CONFIG_ASF_DEMUXER 1 +#define CONFIG_MP3_DEMUXER 1 + +/* Enabled protocols */ +#define CONFIG_FILE_PROTOCOL 1 + +/* Enabled bitstream filters */ +#define CONFIG_NULL_BSF 1 + +#endif /* FFMPEG_CONFIG_H */ diff --git a/third_party/ffmpeg-xenia/config_components.h b/third_party/ffmpeg-xenia/config_components.h new file mode 100644 index 000000000..7ced6c7b0 --- /dev/null +++ b/third_party/ffmpeg-xenia/config_components.h @@ -0,0 +1,12 @@ +/* + * FFmpeg component configuration for xenia. + * In upstream FFmpeg this is generated by configure separately from config.h. + * For xenia all CONFIG_* component defines live in config.h, so we just + * include that. + */ +#ifndef FFMPEG_CONFIG_COMPONENTS_H +#define FFMPEG_CONFIG_COMPONENTS_H + +#include "config.h" + +#endif /* FFMPEG_CONFIG_COMPONENTS_H */ diff --git a/third_party/ffmpeg-xenia/libavcodec/bsf_list.c b/third_party/ffmpeg-xenia/libavcodec/bsf_list.c new file mode 100644 index 000000000..d31ece942 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavcodec/bsf_list.c @@ -0,0 +1,3 @@ +static const AVBitStreamFilter * const bitstream_filters[] = { + &ff_null_bsf, + NULL }; diff --git a/third_party/ffmpeg-xenia/libavcodec/codec_list.c b/third_party/ffmpeg-xenia/libavcodec/codec_list.c new file mode 100644 index 000000000..c77643c83 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavcodec/codec_list.c @@ -0,0 +1,7 @@ +static const AVCodec * const codec_list[] = { + &ff_mp3float_decoder, + &ff_mp3_decoder, + &ff_wmapro_decoder, + &ff_wmav2_decoder, + &ff_xmaframes_decoder, + NULL }; diff --git a/third_party/ffmpeg-xenia/libavcodec/parser_list.c b/third_party/ffmpeg-xenia/libavcodec/parser_list.c new file mode 100644 index 000000000..f0dc7f295 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavcodec/parser_list.c @@ -0,0 +1,3 @@ +static const AVCodecParser * const parser_list[] = { + &ff_mpegaudio_parser, + NULL }; diff --git a/third_party/ffmpeg-xenia/libavcodec/premake5.lua b/third_party/ffmpeg-xenia/libavcodec/premake5.lua new file mode 100644 index 000000000..8c922d4d8 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavcodec/premake5.lua @@ -0,0 +1,156 @@ +project("libavcodec") + uuid("9DB2830C-D326-48ED-B4CC-08EA6A1B7272") + kind("StaticLib") + language("C") + ffmpeg_common() + + filter("files:not ../../FFmpeg/libavcodec/wmaprodec.c") + warnings "Off" + filter({}) + + links({ + "libavutil", + }) + + -- Needed for files in subdirectories (e.g. bsf/null.c) that include + -- headers relative to libavcodec/. + includedirs({ + "../../FFmpeg/libavcodec", + }) + + -- libavcodec/Makefile: + -- HEADERS: + files({ + "../../FFmpeg/libavcodec/ac3_parser.h", + "../../FFmpeg/libavcodec/adts_parser.h", + "../../FFmpeg/libavcodec/avcodec.h", + "../../FFmpeg/libavcodec/avdct.h", + "../../FFmpeg/libavcodec/bsf.h", + "../../FFmpeg/libavcodec/codec.h", + "../../FFmpeg/libavcodec/codec_desc.h", + "../../FFmpeg/libavcodec/codec_id.h", + "../../FFmpeg/libavcodec/codec_par.h", + "../../FFmpeg/libavcodec/d3d11va.h", + "../../FFmpeg/libavcodec/dirac.h", + "../../FFmpeg/libavcodec/dv_profile.h", + "../../FFmpeg/libavcodec/dxva2.h", + "../../FFmpeg/libavcodec/jni.h", + "../../FFmpeg/libavcodec/mediacodec.h", + "../../FFmpeg/libavcodec/packet.h", + "../../FFmpeg/libavcodec/qsv.h", + "../../FFmpeg/libavcodec/vdpau.h", + "../../FFmpeg/libavcodec/version.h", + "../../FFmpeg/libavcodec/videotoolbox.h", + "../../FFmpeg/libavcodec/vorbis_parser.h", + }) + -- OBJS: + files({ + "../../FFmpeg/libavcodec/ac3_parser.c", + "../../FFmpeg/libavcodec/adts_parser.c", + "../../FFmpeg/libavcodec/allcodecs.c", + "../../FFmpeg/libavcodec/avcodec.c", + "../../FFmpeg/libavcodec/avdct.c", + "../../FFmpeg/libavcodec/packet.c", + "../../FFmpeg/libavcodec/bitstream.c", + "../../FFmpeg/libavcodec/bitstream_filters.c", + "../../FFmpeg/libavcodec/bsf.c", + "../../FFmpeg/libavcodec/codec_desc.c", + "../../FFmpeg/libavcodec/codec_par.c", + "../../FFmpeg/libavcodec/d3d11va.c", + "../../FFmpeg/libavcodec/decode.c", + "../../FFmpeg/libavcodec/dirac.c", + "../../FFmpeg/libavcodec/dv_profile.c", + "../../FFmpeg/libavcodec/encode.c", + "../../FFmpeg/libavcodec/imgconvert.c", + "../../FFmpeg/libavcodec/jni.c", + "../../FFmpeg/libavcodec/mathtables.c", + "../../FFmpeg/libavcodec/mediacodec.c", + "../../FFmpeg/libavcodec/mpeg12framerate.c", + "../../FFmpeg/libavcodec/options.c", + "../../FFmpeg/libavcodec/parser.c", + "../../FFmpeg/libavcodec/parsers.c", + "../../FFmpeg/libavcodec/profiles.c", + "../../FFmpeg/libavcodec/qsv_api.c", + "../../FFmpeg/libavcodec/raw.c", + "../../FFmpeg/libavcodec/utils.c", + "../../FFmpeg/libavcodec/vorbis_parser.c", + "../../FFmpeg/libavcodec/xiph.c", + "../../FFmpeg/libavcodec/dct32_fixed.c", + "../../FFmpeg/libavcodec/dct32_float.c", + "../../FFmpeg/libavcodec/faandct.c", + "../../FFmpeg/libavcodec/faanidct.c", + "../../FFmpeg/libavcodec/fdctdsp.c", + "../../FFmpeg/libavcodec/jfdctfst.c", + "../../FFmpeg/libavcodec/jfdctint.c", + "../../FFmpeg/libavcodec/idctdsp.c", + "../../FFmpeg/libavcodec/simple_idct.c", + "../../FFmpeg/libavcodec/jrevdct.c", + "../../FFmpeg/libavcodec/mpegaudio.c", + "../../FFmpeg/libavcodec/mpegaudiodec_common.c", + "../../FFmpeg/libavcodec/mpegaudiodsp.c", + "../../FFmpeg/libavcodec/mpegaudiodsp_data.c", + "../../FFmpeg/libavcodec/mpegaudiodsp_fixed.c", + "../../FFmpeg/libavcodec/mpegaudiodsp_float.c", + "../../FFmpeg/libavcodec/mpegaudiodecheader.c", + "../../FFmpeg/libavcodec/mpegaudiodata.c", + "../../FFmpeg/libavcodec/sinewin.c", + "../../FFmpeg/libavcodec/wma_freqs.c", + "../../FFmpeg/libavcodec/mpegaudiodec_fixed.c", + "../../FFmpeg/libavcodec/mpegaudiodec_float.c", + "../../FFmpeg/libavcodec/wmaprodec.c", + "../../FFmpeg/libavcodec/wma.c", + "../../FFmpeg/libavcodec/wma_common.c", + "../../FFmpeg/libavcodec/wmadec.c", + "../../FFmpeg/libavcodec/aactab.c", + "../../FFmpeg/libavcodec/mpegaudio_parser.c", + "../../FFmpeg/libavcodec/pthread.c", + "../../FFmpeg/libavcodec/pthread_slice.c", + "../../FFmpeg/libavcodec/pthread_frame.c", + "../../FFmpeg/libavcodec/get_buffer.c", + "../../FFmpeg/libavcodec/vlc.c", + "../../FFmpeg/libavcodec/threadprogress.c", + "../../FFmpeg/libavcodec/bsf/null.c", + "../../FFmpeg/libavcodec/exif.c", + "../../FFmpeg/libavcodec/mpegaudiotabs.c", + "../../FFmpeg/libavcodec/tiff_common.c", + }) + filter({"platforms:Windows"}) + files({ + "../../FFmpeg/libavcodec/file_open.c", + }) + filter({}) + + -- libavcodec/aarch64/Makefile: + -- OBJS: + filter({"platforms:Android-ARM64"}) + files({ + "../../FFmpeg/libavcodec/aarch64/idctdsp_init_aarch64.c", + "../../FFmpeg/libavcodec/aarch64/mpegaudiodsp_init.c", + }) + filter({}) + -- NEON-OBJS: + filter({"platforms:Android-ARM64"}) + files({ + "../../FFmpeg/libavcodec/aarch64/fft_neon.S", + "../../FFmpeg/libavcodec/aarch64/simple_idct_neon.S", + "../../FFmpeg/libavcodec/aarch64/mdct_neon.S", + "../../FFmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S", + }) + filter({}) + + -- libavcodec/x86/Makefile: + -- OBJS: + filter({"platforms:Android-x86_64 or platforms:Linux or platforms:Windows"}) + files({ + "../../FFmpeg/libavcodec/x86/constants.c", + "../../FFmpeg/libavcodec/x86/fdctdsp_init.c", + "../../FFmpeg/libavcodec/x86/idctdsp_init.c", + "../../FFmpeg/libavcodec/x86/mpegaudiodsp.c", + }) + filter({}) + -- MMX-OBJS: + filter({"platforms:Android-x86_64 or platforms:Linux or platforms:Windows"}) + files({ + "../../FFmpeg/libavcodec/x86/fdct.c", + }) + filter({}) diff --git a/third_party/ffmpeg-xenia/libavformat/demuxer_list.c b/third_party/ffmpeg-xenia/libavformat/demuxer_list.c new file mode 100644 index 000000000..26b4f2049 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavformat/demuxer_list.c @@ -0,0 +1,4 @@ +static const AVInputFormat * const demuxer_list[] = { + &ff_asf_demuxer, + &ff_mp3_demuxer, + NULL }; diff --git a/third_party/ffmpeg-xenia/libavformat/muxer_list.c b/third_party/ffmpeg-xenia/libavformat/muxer_list.c new file mode 100644 index 000000000..f36d9499c --- /dev/null +++ b/third_party/ffmpeg-xenia/libavformat/muxer_list.c @@ -0,0 +1,2 @@ +static const AVOutputFormat * const muxer_list[] = { + NULL }; diff --git a/third_party/ffmpeg-xenia/libavformat/premake5.lua b/third_party/ffmpeg-xenia/libavformat/premake5.lua new file mode 100644 index 000000000..489034d34 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavformat/premake5.lua @@ -0,0 +1,61 @@ +project("libavformat") + uuid("CEF2E128-AA08-4A36-8045-0AA68A556364") + kind("StaticLib") + language("C") + ffmpeg_common() + + filter("files:not wmaprodec.c") + warnings "Off" + filter({}) + + links({ + "libavutil", + "libavcodec", + }) + + -- libavformat/Makefile: + -- HEADERS: + files({ + "../../FFmpeg/libavformat/avformat.h", + "../../FFmpeg/libavformat/avio.h", + "../../FFmpeg/libavformat/version.h", + }) + -- OBJS: + files({ + "../../FFmpeg/libavformat/allformats.c", + "../../FFmpeg/libavformat/avio.c", + "../../FFmpeg/libavformat/aviobuf.c", + "../../FFmpeg/libavformat/dump.c", + "../../FFmpeg/libavformat/format.c", + "../../FFmpeg/libavformat/id3v1.c", + "../../FFmpeg/libavformat/id3v2.c", + "../../FFmpeg/libavformat/metadata.c", + "../../FFmpeg/libavformat/mux.c", + "../../FFmpeg/libavformat/options.c", + "../../FFmpeg/libavformat/os_support.c", + "../../FFmpeg/libavformat/protocols.c", + "../../FFmpeg/libavformat/riff.c", + "../../FFmpeg/libavformat/sdp.c", + "../../FFmpeg/libavformat/url.c", + "../../FFmpeg/libavformat/utils.c", + "../../FFmpeg/libavformat/riffdec.c", + "../../FFmpeg/libavformat/asfdec_f.c", + "../../FFmpeg/libavformat/asf.c", + "../../FFmpeg/libavformat/asfcrypt.c", + "../../FFmpeg/libavformat/avlanguage.c", + "../../FFmpeg/libavformat/mp3dec.c", + "../../FFmpeg/libavformat/replaygain.c", + "../../FFmpeg/libavformat/file.c", + "../../FFmpeg/libavformat/demux.c", + "../../FFmpeg/libavformat/avformat.c", + "../../FFmpeg/libavformat/seek.c", + "../../FFmpeg/libavformat/demux_utils.c", + "../../FFmpeg/libavformat/urldecode.c", + "../../FFmpeg/libavformat/asf_tags.c", + "../../FFmpeg/libavformat/to_upper4.c", + }) + filter({"platforms:Windows"}) + files({ + "../../FFmpeg/libavformat/file_open.c", + }) + filter({}) diff --git a/third_party/ffmpeg-xenia/libavformat/protocol_list.c b/third_party/ffmpeg-xenia/libavformat/protocol_list.c new file mode 100644 index 000000000..2f36e9687 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavformat/protocol_list.c @@ -0,0 +1,3 @@ +static const URLProtocol * const url_protocols[] = { + &ff_file_protocol, + NULL }; diff --git a/third_party/ffmpeg-xenia/libavutil/avconfig.h b/third_party/ffmpeg-xenia/libavutil/avconfig.h new file mode 100644 index 000000000..c289fbb55 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffmpeg configure */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/third_party/ffmpeg-xenia/libavutil/ffversion.h b/third_party/ffmpeg-xenia/libavutil/ffversion.h new file mode 100644 index 000000000..4c38fb3ba --- /dev/null +++ b/third_party/ffmpeg-xenia/libavutil/ffversion.h @@ -0,0 +1,4 @@ +#ifndef AVUTIL_FFVERSION_H +#define AVUTIL_FFVERSION_H +#define FFMPEG_VERSION "xenia" +#endif /* AVUTIL_FFVERSION_H */ diff --git a/third_party/ffmpeg-xenia/libavutil/premake5.lua b/third_party/ffmpeg-xenia/libavutil/premake5.lua new file mode 100644 index 000000000..009797019 --- /dev/null +++ b/third_party/ffmpeg-xenia/libavutil/premake5.lua @@ -0,0 +1,225 @@ +project("libavutil") + uuid("19216035-F781-4F15-B009-213B7E3A18AC") + kind("StaticLib") + language("C") + ffmpeg_common() + + filter("files:not wmaprodec.c") + warnings "Off" + filter({}) + + -- libavutil/Makefile: + -- HEADERS: + files({ + "../../FFmpeg/libavutil/adler32.h", + "../../FFmpeg/libavutil/aes.h", + "../../FFmpeg/libavutil/aes_ctr.h", + "../../FFmpeg/libavutil/attributes.h", + "../../FFmpeg/libavutil/audio_fifo.h", + "../../FFmpeg/libavutil/avassert.h", + "../../FFmpeg/libavutil/avstring.h", + "../../FFmpeg/libavutil/avutil.h", + "../../FFmpeg/libavutil/base64.h", + "../../FFmpeg/libavutil/blowfish.h", + "../../FFmpeg/libavutil/bprint.h", + "../../FFmpeg/libavutil/bswap.h", + "../../FFmpeg/libavutil/buffer.h", + "../../FFmpeg/libavutil/cast5.h", + "../../FFmpeg/libavutil/camellia.h", + "../../FFmpeg/libavutil/channel_layout.h", + "../../FFmpeg/libavutil/common.h", + "../../FFmpeg/libavutil/cpu.h", + "../../FFmpeg/libavutil/crc.h", + "../../FFmpeg/libavutil/des.h", + "../../FFmpeg/libavutil/dict.h", + "../../FFmpeg/libavutil/display.h", + "../../FFmpeg/libavutil/dovi_meta.h", + "../../FFmpeg/libavutil/downmix_info.h", + "../../FFmpeg/libavutil/encryption_info.h", + "../../FFmpeg/libavutil/error.h", + "../../FFmpeg/libavutil/eval.h", + "../../FFmpeg/libavutil/fifo.h", + "../../FFmpeg/libavutil/file.h", + "../../FFmpeg/libavutil/frame.h", + "../../FFmpeg/libavutil/hash.h", + "../../FFmpeg/libavutil/hdr_dynamic_metadata.h", + "../../FFmpeg/libavutil/hmac.h", + "../../FFmpeg/libavutil/hwcontext.h", + "../../FFmpeg/libavutil/hwcontext_cuda.h", + "../../FFmpeg/libavutil/hwcontext_d3d11va.h", + "../../FFmpeg/libavutil/hwcontext_drm.h", + "../../FFmpeg/libavutil/hwcontext_dxva2.h", + "../../FFmpeg/libavutil/hwcontext_qsv.h", + "../../FFmpeg/libavutil/hwcontext_mediacodec.h", + "../../FFmpeg/libavutil/hwcontext_opencl.h", + "../../FFmpeg/libavutil/hwcontext_vaapi.h", + "../../FFmpeg/libavutil/hwcontext_videotoolbox.h", + "../../FFmpeg/libavutil/hwcontext_vdpau.h", + "../../FFmpeg/libavutil/hwcontext_vulkan.h", + "../../FFmpeg/libavutil/imgutils.h", + "../../FFmpeg/libavutil/intfloat.h", + "../../FFmpeg/libavutil/intreadwrite.h", + "../../FFmpeg/libavutil/lfg.h", + "../../FFmpeg/libavutil/log.h", + "../../FFmpeg/libavutil/macros.h", + "../../FFmpeg/libavutil/mathematics.h", + "../../FFmpeg/libavutil/mastering_display_metadata.h", + "../../FFmpeg/libavutil/md5.h", + "../../FFmpeg/libavutil/mem.h", + "../../FFmpeg/libavutil/motion_vector.h", + "../../FFmpeg/libavutil/murmur3.h", + "../../FFmpeg/libavutil/opt.h", + "../../FFmpeg/libavutil/parseutils.h", + "../../FFmpeg/libavutil/pixdesc.h", + "../../FFmpeg/libavutil/pixelutils.h", + "../../FFmpeg/libavutil/pixfmt.h", + "../../FFmpeg/libavutil/random_seed.h", + "../../FFmpeg/libavutil/rc4.h", + "../../FFmpeg/libavutil/rational.h", + "../../FFmpeg/libavutil/replaygain.h", + "../../FFmpeg/libavutil/ripemd.h", + "../../FFmpeg/libavutil/samplefmt.h", + "../../FFmpeg/libavutil/sha.h", + "../../FFmpeg/libavutil/sha512.h", + "../../FFmpeg/libavutil/spherical.h", + "../../FFmpeg/libavutil/stereo3d.h", + "../../FFmpeg/libavutil/threadmessage.h", + "../../FFmpeg/libavutil/time.h", + "../../FFmpeg/libavutil/timecode.h", + "../../FFmpeg/libavutil/timestamp.h", + "../../FFmpeg/libavutil/tree.h", + "../../FFmpeg/libavutil/twofish.h", + "../../FFmpeg/libavutil/version.h", + "../../FFmpeg/libavutil/video_enc_params.h", + "../../FFmpeg/libavutil/xtea.h", + "../../FFmpeg/libavutil/tea.h", + "../../FFmpeg/libavutil/tx.h", + "../../FFmpeg/libavutil/film_grain_params.h", + }) + -- ARCH_HEADERS: + files({ + "../../FFmpeg/libavutil/bswap.h", + "../../FFmpeg/libavutil/intmath.h", + "../../FFmpeg/libavutil/intreadwrite.h", + "../../FFmpeg/libavutil/timer.h", + }) + -- BUILT_HEADERS (local xenia-specific copies): + files({ + "avconfig.h", + "ffversion.h", + }) + -- OBJS: + files({ + "../../FFmpeg/libavutil/adler32.c", + "../../FFmpeg/libavutil/aes.c", + "../../FFmpeg/libavutil/aes_ctr.c", + "../../FFmpeg/libavutil/audio_fifo.c", + "../../FFmpeg/libavutil/avstring.c", + "../../FFmpeg/libavutil/avsscanf.c", + "../../FFmpeg/libavutil/base64.c", + "../../FFmpeg/libavutil/blowfish.c", + "../../FFmpeg/libavutil/bprint.c", + "../../FFmpeg/libavutil/buffer.c", + "../../FFmpeg/libavutil/cast5.c", + "../../FFmpeg/libavutil/camellia.c", + "../../FFmpeg/libavutil/channel_layout.c", + "../../FFmpeg/libavutil/csp.c", + "../../FFmpeg/libavutil/cpu.c", + "../../FFmpeg/libavutil/crc.c", + "../../FFmpeg/libavutil/des.c", + "../../FFmpeg/libavutil/dict.c", + "../../FFmpeg/libavutil/display.c", + "../../FFmpeg/libavutil/dovi_meta.c", + "../../FFmpeg/libavutil/downmix_info.c", + "../../FFmpeg/libavutil/encryption_info.c", + "../../FFmpeg/libavutil/error.c", + "../../FFmpeg/libavutil/eval.c", + "../../FFmpeg/libavutil/fifo.c", + "../../FFmpeg/libavutil/file.c", + "../../FFmpeg/libavutil/file_open.c", + "../../FFmpeg/libavutil/float_dsp.c", + "../../FFmpeg/libavutil/fixed_dsp.c", + "../../FFmpeg/libavutil/frame.c", + "../../FFmpeg/libavutil/hash.c", + "../../FFmpeg/libavutil/hdr_dynamic_metadata.c", + "../../FFmpeg/libavutil/hmac.c", + "../../FFmpeg/libavutil/hwcontext.c", + "../../FFmpeg/libavutil/imgutils.c", + "../../FFmpeg/libavutil/integer.c", + "../../FFmpeg/libavutil/intmath.c", + "../../FFmpeg/libavutil/lfg.c", + "../../FFmpeg/libavutil/lls.c", + "../../FFmpeg/libavutil/log.c", + "../../FFmpeg/libavutil/log2_tab.c", + "../../FFmpeg/libavutil/mathematics.c", + "../../FFmpeg/libavutil/mastering_display_metadata.c", + "../../FFmpeg/libavutil/md5.c", + "../../FFmpeg/libavutil/mem.c", + "../../FFmpeg/libavutil/murmur3.c", + "../../FFmpeg/libavutil/opt.c", + "../../FFmpeg/libavutil/parseutils.c", + "../../FFmpeg/libavutil/pixdesc.c", + "../../FFmpeg/libavutil/pixelutils.c", + "../../FFmpeg/libavutil/random_seed.c", + "../../FFmpeg/libavutil/rational.c", + "../../FFmpeg/libavutil/reverse.c", + "../../FFmpeg/libavutil/rc4.c", + "../../FFmpeg/libavutil/ripemd.c", + "../../FFmpeg/libavutil/samplefmt.c", + "../../FFmpeg/libavutil/sha.c", + "../../FFmpeg/libavutil/sha512.c", + "../../FFmpeg/libavutil/slicethread.c", + "../../FFmpeg/libavutil/spherical.c", + "../../FFmpeg/libavutil/stereo3d.c", + "../../FFmpeg/libavutil/threadmessage.c", + "../../FFmpeg/libavutil/time.c", + "../../FFmpeg/libavutil/timecode.c", + "../../FFmpeg/libavutil/tree.c", + "../../FFmpeg/libavutil/twofish.c", + "../../FFmpeg/libavutil/utils.c", + "../../FFmpeg/libavutil/xga_font_data.c", + "../../FFmpeg/libavutil/xtea.c", + "../../FFmpeg/libavutil/tea.c", + "../../FFmpeg/libavutil/tx.c", + "../../FFmpeg/libavutil/tx_float.c", + "../../FFmpeg/libavutil/tx_double.c", + "../../FFmpeg/libavutil/tx_int32.c", + "../../FFmpeg/libavutil/video_enc_params.c", + "../../FFmpeg/libavutil/film_grain_params.c", + "../../FFmpeg/libavutil/side_data.c", + "../../FFmpeg/libavutil/refstruct.c", + "../../FFmpeg/libavutil/container_fifo.c", + "../../FFmpeg/libavutil/float_scalarproduct.c", + "../../FFmpeg/libavutil/timecode_internal.c", + "../../FFmpeg/libavutil/iamf.c", + "../../FFmpeg/libavutil/timestamp.c", + }) + + -- libavutil/aarch64/Makefile: + -- OBJS: + filter({"platforms:Android-ARM64"}) + files({ + "../../FFmpeg/libavutil/aarch64/cpu.c", + "../../FFmpeg/libavutil/aarch64/float_dsp_init.c", + "../../FFmpeg/libavutil/aarch64/tx_float_init.c", + }) + filter({}) + -- NEON-OBJS: + filter({"platforms:Android-ARM64"}) + files({ + "../../FFmpeg/libavutil/aarch64/float_dsp_neon.S", + }) + filter({}) + + -- libavutil/x86/Makefile: + -- OBJS: + filter({"platforms:Android-x86_64 or platforms:Linux or platforms:Windows"}) + files({ + "../../FFmpeg/libavutil/x86/cpu.c", + "../../FFmpeg/libavutil/x86/fixed_dsp_init.c", + "../../FFmpeg/libavutil/x86/float_dsp_init.c", + "../../FFmpeg/libavutil/x86/imgutils_init.c", + "../../FFmpeg/libavutil/x86/lls_init.c", + "../../FFmpeg/libavutil/x86/tx_float_init.c", + }) + filter({}) diff --git a/third_party/ffmpeg-xenia/premake5.lua b/third_party/ffmpeg-xenia/premake5.lua new file mode 100644 index 000000000..dd5c773bb --- /dev/null +++ b/third_party/ffmpeg-xenia/premake5.lua @@ -0,0 +1,42 @@ +group("third_party") + +-- +-- Call this function in subproject scope to set the needed include +-- dirs and defines. +-- +function ffmpeg_common() + defines({ + "HAVE_AV_CONFIG_H", + "_USE_MATH_DEFINES", -- For M_PI/etc + }) + + -- Paths are relative to the calling script (sub-library premake files), + -- which are one level deeper (e.g. libavcodec/premake5.lua). + includedirs({ + "..", -- ffmpeg-xenia/ (config.h, avconfig.h, ffversion.h) + "../../FFmpeg", -- FFmpeg source headers + }) + filter({"platforms:Windows", "configurations:Debug or configurations:Checked"}) + optimize("Size") -- dead code elimination is mandatory + removebuildoptions({ + "/RTCsu", -- '/O1' and '/RTCs' command-line options are incompatible + }) + filter({"platforms:Windows", "configurations:Release"}) + linktimeoptimization("Off") + filter("platforms:Windows") + includedirs({ + "../../FFmpeg/compat/atomics/win32", + }) + links({ + "bcrypt", + }) + filter("platforms:Linux") + includedirs({ + "../../FFmpeg/compat/atomics/gcc", + }) + filter({}) +end + +include("libavcodec/premake5.lua") +include("libavformat/premake5.lua") +include("libavutil/premake5.lua") diff --git a/xenia-build.py b/xenia-build.py index 7a303391c..e3e23e4c6 100755 --- a/xenia-build.py +++ b/xenia-build.py @@ -545,8 +545,15 @@ def get_pr_number(): return github_ref.split('/')[2] def git_submodule_update(): - """Runs a git submodule init and update. + """Runs a git submodule sync, init, and update. """ + # Sync submodule URLs from .gitmodules to local config + shell_call([ + "git", + "submodule", + "sync", + ]) + # Then update all submodules to their recorded commits shell_call([ "git", "-c",