1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Benjamin Drung's disable-dynamic-ffmpeg-v3.patch for bug 233

This commit is contained in:
v.audacity 2012-08-29 21:31:11 +00:00
parent e749dc7db9
commit f0112b57df
6 changed files with 39 additions and 2 deletions

View File

@ -180,6 +180,12 @@ AC_ARG_ENABLE(sse, [AC_HELP_STRING([--enable-sse],[enable SSE optimizations])],
AC_ARG_ENABLE(universal_binary,[ --enable-universal_binary enable universal binary build: (default: disable)],[enable_universal_binary=$enableval],[enable_universal_binary=no]) AC_ARG_ENABLE(universal_binary,[ --enable-universal_binary enable universal binary build: (default: disable)],[enable_universal_binary=$enableval],[enable_universal_binary=no])
AC_ARG_ENABLE(dynamic-loading,
[AS_HELP_STRING([--enable-dynamic-loading],
[enable dynamic loading of lame and FFmpeg [default=yes]])],
[dynamic_loading="$enableval"],
[dynamic_loading="yes"])
dnl AC_ARG_WITH(wx-version, dnl AC_ARG_WITH(wx-version,
dnl [AS_HELP_STRING([--with-wx-version], dnl [AS_HELP_STRING([--with-wx-version],
dnl [select wxWidgets version (if both installed) [2.8,]])], dnl [select wxWidgets version (if both installed) [2.8,]])],

View File

@ -35,6 +35,10 @@ AC_DEFUN([AUDACITY_CHECKLIB_FFMPEG], [
FFMPEG_SYSTEM_AVAILABLE="yes" FFMPEG_SYSTEM_AVAILABLE="yes"
FFMPEG_SYSTEM_CXXFLAGS="$AVCODEC_CFLAGS $AVFORMAT_CFLAGS $AVUTIL_CFLAGS" FFMPEG_SYSTEM_CXXFLAGS="$AVCODEC_CFLAGS $AVFORMAT_CFLAGS $AVUTIL_CFLAGS"
FFMPEG_SYSTEM_CPPSYMBOLS="USE_FFMPEG" FFMPEG_SYSTEM_CPPSYMBOLS="USE_FFMPEG"
if test "x$dynamic_loading" = "xno"; then
FFMPEG_SYSTEM_LIBS="$AVCODEC_LIBS $AVFORMAT_LIBS $AVUTIL_LIBS"
AC_DEFINE(DISABLE_DYNAMIC_LOADING_FFMPEG, 1, [Use system FFmpeg library and disable dynamic loading of it.])
fi
dnl build the extra object files needed to use FFmpeg. Paths inside dnl build the extra object files needed to use FFmpeg. Paths inside
dnl the audacity src/ dir, as this is subsitiuted into src/Makefile.in dnl the audacity src/ dir, as this is subsitiuted into src/Makefile.in
FFMPEG_SYSTEM_OPTOBJS="import/ImportFFmpeg.o export/ExportFFmpeg.o \ FFMPEG_SYSTEM_OPTOBJS="import/ImportFFmpeg.o export/ExportFFmpeg.o \

View File

@ -754,6 +754,10 @@ bool FFmpegLibs::FindLibs(wxWindow *parent)
bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr) bool FFmpegLibs::LoadLibs(wxWindow *parent, bool showerr)
{ {
#if defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
mLibsLoaded = InitLibs(wxEmptyString, showerr);
return mLibsLoaded;
#endif
wxLogMessage(wxT("Trying to load FFmpeg libraries...")); wxLogMessage(wxT("Trying to load FFmpeg libraries..."));
if (ValidLibsLoaded()) { if (ValidLibsLoaded()) {
@ -837,6 +841,7 @@ bool FFmpegLibs::ValidLibsLoaded()
bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr) bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
{ {
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
FreeLibs(); FreeLibs();
#if defined(__WXMSW__) #if defined(__WXMSW__)
@ -1050,8 +1055,10 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
FFMPEG_INITDYN(avutil, av_rescale_q); FFMPEG_INITDYN(avutil, av_rescale_q);
FFMPEG_INITDYN(avutil, avutil_version); FFMPEG_INITDYN(avutil, avutil_version);
//FFmpeg initialization
wxLogMessage(wxT("All symbols loaded successfully. Initializing the library.")); wxLogMessage(wxT("All symbols loaded successfully. Initializing the library."));
#endif
//FFmpeg initialization
avcodec_init(); avcodec_init();
avcodec_register_all(); avcodec_register_all();
av_register_all(); av_register_all();
@ -1090,7 +1097,11 @@ bool FFmpegLibs::InitLibs(wxString libpath_format, bool showerr)
return false; return false;
} }
#if defined(DISABLE_DYNAMIC_LOADING_FFMPEG) && (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 69, 0))
av_register_protocol(&ufile_protocol);
#else
av_register_protocol2(&ufile_protocol, sizeof(ufile_protocol)); av_register_protocol2(&ufile_protocol, sizeof(ufile_protocol));
#endif
return true; return true;
} }

View File

@ -368,6 +368,18 @@ streamContext *import_ffmpeg_read_next_frame(AVFormatContext* formatContext,
int import_ffmpeg_decode_frame(streamContext *sc, bool flushing); int import_ffmpeg_decode_frame(streamContext *sc, bool flushing);
#if defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
// Use the preprocessor to rename old function names instead of checking the
// function names with FFMPEG_INITALT when loading the library.
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 60, 0)
#define av_match_ext match_ext
#endif
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 64, 0)
#define av_guess_format guess_format
#endif
#else
extern "C" { extern "C" {
// A little explanation of what's going on here. // A little explanation of what's going on here.
// //
@ -900,6 +912,7 @@ extern "C" {
(protocol, size) (protocol, size)
); );
}; };
#endif
#endif // USE_FFMPEG #endif // USE_FFMPEG
#endif // __AUDACITY_FFMPEG__ #endif // __AUDACITY_FFMPEG__

View File

@ -87,6 +87,9 @@
/* Use system LAME library and disable dynamic loading of it. */ /* Use system LAME library and disable dynamic loading of it. */
#undef DISABLE_DYNAMIC_LOADING_LAME #undef DISABLE_DYNAMIC_LOADING_LAME
/* Use system FFmpeg library and disable dynamic loading of it. */
#undef DISABLE_DYNAMIC_LOADING_FFMPEG
/* Define if LADSPA plug-ins are enabled */ /* Define if LADSPA plug-ins are enabled */
#undef USE_LADSPA #undef USE_LADSPA

View File

@ -133,7 +133,7 @@ void LibraryPrefs::PopulateOrExchange(ShuttleGui & S)
S.Id(ID_FFMPEG_DOWN_BUTTON); S.Id(ID_FFMPEG_DOWN_BUTTON);
wxButton *bdwn = S.AddButton(_("Dow&nload"), wxButton *bdwn = S.AddButton(_("Dow&nload"),
wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
#if !defined(USE_FFMPEG) #if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
bdwn->Enable(FALSE); bdwn->Enable(FALSE);
bfnd->Enable(FALSE); bfnd->Enable(FALSE);
#endif #endif