mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 14:50:06 +02:00
FFmpeg: Get non-monolithic libav* filenames from libavformat.
The non-monolithic libavformat is linked against libavcodec and libavutil. Instead of (falsely) guessing the filenames of libavcodec and libavutil, get the files that the libavformat library is linked against. This fixes wrong filename guesses and avoids run-time issues by using incompatible libavcodec/libavutil version with libavformat.
This commit is contained in:
parent
caf557a614
commit
cb39b48274
@ -771,6 +771,8 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
|
||||
// Initially we don't know where are the avcodec and avutl libs
|
||||
wxDynamicLibrary *codec = NULL;
|
||||
wxDynamicLibrary *util = NULL;
|
||||
wxFileName avcodec_filename;
|
||||
wxFileName avutil_filename;
|
||||
wxFileName name(libpath_format);
|
||||
bool gotError = false;
|
||||
|
||||
@ -781,12 +783,10 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
|
||||
|
||||
// Verify it really is monolithic
|
||||
if (!gotError) {
|
||||
wxFileName actual;
|
||||
|
||||
actual = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avutil_version")));
|
||||
if (actual.GetFullPath().IsSameAs(name.GetFullPath())) {
|
||||
actual = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avcodec_version")));
|
||||
if (actual.GetFullPath().IsSameAs(name.GetFullPath())) {
|
||||
avutil_filename = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avutil_version")));
|
||||
avcodec_filename = FileNames::PathFromAddr(avformat->GetSymbol(wxT("avcodec_version")));
|
||||
if (avutil_filename.GetFullPath().IsSameAs(name.GetFullPath())) {
|
||||
if (avcodec_filename.GetFullPath().IsSameAs(name.GetFullPath())) {
|
||||
util = avformat;
|
||||
codec = avformat;
|
||||
}
|
||||
@ -804,17 +804,15 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool WXUNUSED(showerr))
|
||||
}
|
||||
|
||||
if (!util) {
|
||||
name.SetFullName(GetLibAVUtilName());
|
||||
avutil = util = new wxDynamicLibrary();
|
||||
wxLogMessage(wxT("Loading avutil from '%s'."), name.GetFullPath().c_str());
|
||||
util->Load(name.GetFullPath(), wxDL_LAZY);
|
||||
wxLogMessage(wxT("Loading avutil from '%s'."), avutil_filename.GetFullPath().c_str());
|
||||
util->Load(avutil_filename.GetFullPath(), wxDL_LAZY);
|
||||
}
|
||||
|
||||
if (!codec) {
|
||||
name.SetFullName(GetLibAVCodecName());
|
||||
avcodec = codec = new wxDynamicLibrary();
|
||||
wxLogMessage(wxT("Loading avcodec from '%s'."), name.GetFullPath().c_str());
|
||||
codec->Load(name.GetFullPath(), wxDL_LAZY);
|
||||
wxLogMessage(wxT("Loading avcodec from '%s'."), avcodec_filename.GetFullPath().c_str());
|
||||
codec->Load(avcodec_filename.GetFullPath(), wxDL_LAZY);
|
||||
}
|
||||
|
||||
if (!avformat->IsLoaded()) {
|
||||
|
30
src/FFmpeg.h
30
src/FFmpeg.h
@ -292,16 +292,6 @@ public:
|
||||
{
|
||||
return (wxT("avformat-") wxT(AV_STRINGIFY(LIBAVFORMAT_VERSION_MAJOR)) wxT(".dll"));
|
||||
}
|
||||
|
||||
wxString GetLibAVCodecName()
|
||||
{
|
||||
return (wxT("avcodec-") wxT(AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)) wxT(".dll"));
|
||||
}
|
||||
|
||||
wxString GetLibAVUtilName()
|
||||
{
|
||||
return (wxT("avutil-") wxT(AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR)) wxT(".dll"));
|
||||
}
|
||||
#elif defined(__WXMAC__)
|
||||
/* Library names and file filters for Mac OS only */
|
||||
wxString GetLibraryTypeString()
|
||||
@ -318,16 +308,6 @@ public:
|
||||
{
|
||||
return (wxT("libavformat.") wxT(AV_STRINGIFY(LIBAVFORMAT_VERSION_MAJOR)) wxT(".dylib"));
|
||||
}
|
||||
|
||||
wxString GetLibAVCodecName()
|
||||
{
|
||||
return (wxT("libavcodec.") wxT(AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)) wxT(".dylib"));
|
||||
}
|
||||
|
||||
wxString GetLibAVUtilName()
|
||||
{
|
||||
return (wxT("libavutil.") wxT(AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR)) wxT(".dylib"));
|
||||
}
|
||||
#else
|
||||
/* Library names and file filters for other platforms, basically Linux and
|
||||
* other *nix platforms */
|
||||
@ -345,16 +325,6 @@ public:
|
||||
{
|
||||
return (wxT("libavformat.so.") wxT(AV_STRINGIFY(LIBAVFORMAT_VERSION_MAJOR)));
|
||||
}
|
||||
|
||||
wxString GetLibAVCodecName()
|
||||
{
|
||||
return (wxT("libavcodec.so.") wxT(AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)));
|
||||
}
|
||||
|
||||
wxString GetLibAVUtilName()
|
||||
{
|
||||
return (wxT("libavutil.so.") wxT(AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR)));
|
||||
}
|
||||
#endif // (__WXMAC__) || (__WXMSW__)
|
||||
|
||||
/// Ugly reference counting. I thought of using wxStuff for that,
|
||||
|
Loading…
x
Reference in New Issue
Block a user