mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 10:39:45 -06:00
Merge pull request #10530 from shuffle2/win-ffmpeg
windows: move ffmpeg bins to submodule
This commit is contained in:
@ -1193,6 +1193,7 @@
|
||||
<ClCompile Include="VideoCommon\FPSCounter.cpp" />
|
||||
<ClCompile Include="VideoCommon\FramebufferManager.cpp" />
|
||||
<ClCompile Include="VideoCommon\FramebufferShaderGen.cpp" />
|
||||
<ClCompile Include="VideoCommon\FrameDump.cpp" />
|
||||
<ClCompile Include="VideoCommon\FreeLookCamera.cpp" />
|
||||
<ClCompile Include="VideoCommon\GeometryShaderGen.cpp" />
|
||||
<ClCompile Include="VideoCommon\GeometryShaderManager.cpp" />
|
||||
|
@ -47,7 +47,6 @@
|
||||
<ClCompile Include="Core\PowerPC\Jit64Common\FarCodeCache.cpp" />
|
||||
<ClCompile Include="Core\PowerPC\Jit64Common\Jit64AsmCommon.cpp" />
|
||||
<ClCompile Include="Core\PowerPC\Jit64Common\TrampolineCache.cpp" />
|
||||
<ClCompile Include="VideoCommon\FrameDump.cpp" />
|
||||
<ClCompile Include="VideoCommon\TextureDecoder_x64.cpp" />
|
||||
<ClCompile Include="VideoCommon\VertexLoaderX64.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -17,9 +17,6 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies>avrt.lib;iphlpapi.lib;winmm.lib;setupapi.lib;rpcrt4.lib;comctl32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Platform)'=='x64'">opengl32.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">$(ExternalsDir)ffmpeg\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
@ -34,11 +34,6 @@
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)TAS;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)VideoInterface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>avrt.lib;iphlpapi.lib;winmm.lib;setupapi.lib;rpcrt4.lib;comctl32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Platform)'=='x64'">opengl32.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">$(ExternalsDir)ffmpeg\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DolphinQt.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
|
@ -15,14 +15,6 @@
|
||||
<Import Project="$(VSPropsDir)PCHUse.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies>avrt.lib;iphlpapi.lib;winmm.lib;setupapi.lib;rpcrt4.lib;comctl32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Platform)'=='x64'">opengl32.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories Condition="'$(Platform)'=='x64'">$(ExternalsDir)ffmpeg\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(CoreDir)DolphinLib.vcxproj">
|
||||
<Project>{D79392F7-06D6-4B4B-A39F-4D587C215D3A}</Project>
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define __STDC_CONSTANT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@ -16,7 +17,10 @@
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/error.h>
|
||||
#include <libavutil/log.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
@ -69,11 +73,33 @@ void InitAVCodec()
|
||||
static bool first_run = true;
|
||||
if (first_run)
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
|
||||
av_register_all();
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
av_log_set_callback([](void* ptr, int level, const char* fmt, va_list vl) {
|
||||
if (level < 0)
|
||||
level = AV_LOG_DEBUG;
|
||||
if (level >= 0)
|
||||
level &= 0xff;
|
||||
|
||||
if (level > av_log_get_level())
|
||||
return;
|
||||
|
||||
auto log_level = Common::Log::LogLevel::LNOTICE;
|
||||
if (level >= AV_LOG_ERROR && level < AV_LOG_WARNING)
|
||||
log_level = Common::Log::LogLevel::LERROR;
|
||||
else if (level >= AV_LOG_WARNING && level < AV_LOG_INFO)
|
||||
log_level = Common::Log::LogLevel::LWARNING;
|
||||
else if (level >= AV_LOG_INFO && level < AV_LOG_DEBUG)
|
||||
log_level = Common::Log::LogLevel::LINFO;
|
||||
else if (level >= AV_LOG_DEBUG)
|
||||
// keep libav debug messages visible in release build of dolphin
|
||||
log_level = Common::Log::LogLevel::LINFO;
|
||||
|
||||
GENERIC_LOG(Common::Log::LogType::FRAMEDUMP, log_level, fmt, vl);
|
||||
});
|
||||
|
||||
// TODO: We never call avformat_network_deinit.
|
||||
avformat_network_init();
|
||||
|
||||
first_run = false;
|
||||
}
|
||||
}
|
||||
@ -109,6 +135,13 @@ std::string GetDumpPath(const std::string& extension, std::time_t time, u32 inde
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string AVErrorString(int error)
|
||||
{
|
||||
std::array<char, AV_ERROR_MAX_STRING_SIZE> msg;
|
||||
av_make_error_string(&msg[0], msg.size(), error);
|
||||
return fmt::format("{:8x} {}", (u32)error, &msg[0]);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool FrameDump::Start(int w, int h, u64 start_ticks)
|
||||
@ -215,7 +248,20 @@ bool FrameDump::CreateVideoFile()
|
||||
m_context->codec->time_base = time_base;
|
||||
m_context->codec->gop_size = 1;
|
||||
m_context->codec->level = 1;
|
||||
m_context->codec->pix_fmt = g_Config.bUseFFV1 ? AV_PIX_FMT_BGR0 : AV_PIX_FMT_YUV420P;
|
||||
|
||||
if (m_context->codec->codec_id == AV_CODEC_ID_FFV1)
|
||||
{
|
||||
m_context->codec->pix_fmt = AV_PIX_FMT_BGR0;
|
||||
}
|
||||
else if (m_context->codec->codec_id == AV_CODEC_ID_UTVIDEO)
|
||||
{
|
||||
m_context->codec->pix_fmt = AV_PIX_FMT_GBRP;
|
||||
av_opt_set_int(m_context->codec->priv_data, "pred", 3, 0); // median
|
||||
}
|
||||
else
|
||||
{
|
||||
m_context->codec->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
}
|
||||
|
||||
if (output_format->flags & AVFMT_GLOBALHEADER)
|
||||
m_context->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
@ -325,7 +371,7 @@ void FrameDump::AddFrame(const FrameData& frame)
|
||||
|
||||
if (const int error = avcodec_send_frame(m_context->codec, m_context->scaled_frame))
|
||||
{
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error while encoding video: {}", error);
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error while encoding video: {}", AVErrorString(error));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -355,7 +401,7 @@ void FrameDump::ProcessPackets()
|
||||
|
||||
if (receive_error)
|
||||
{
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error receiving packet: {}", receive_error);
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error receiving packet: {}", AVErrorString(receive_error));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -364,7 +410,7 @@ void FrameDump::ProcessPackets()
|
||||
|
||||
if (const int write_error = av_interleaved_write_frame(m_context->format, pkt.get()))
|
||||
{
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error writing packet: {}", write_error);
|
||||
ERROR_LOG_FMT(FRAMEDUMP, "Error writing packet: {}", AVErrorString(write_error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -377,7 +423,7 @@ void FrameDump::Stop()
|
||||
|
||||
// Signal end of stream to encoder.
|
||||
if (const int flush_error = avcodec_send_frame(m_context->codec, nullptr))
|
||||
WARN_LOG_FMT(FRAMEDUMP, "Error sending flush packet: {}", flush_error);
|
||||
WARN_LOG_FMT(FRAMEDUMP, "Error sending flush packet: {}", AVErrorString(flush_error));
|
||||
|
||||
ProcessPackets();
|
||||
av_write_trailer(m_context->format);
|
||||
|
Reference in New Issue
Block a user