Try removing the version, check for e.g. libavformat.so

If it just passes them to dlopen then that should be good enough, if
it does something else (like check for existence rather than just trying
to open it directly) then it may need more work

On 2022/02/26 17:59, Caspar Schutijser wrote:
> Hi,
> 
> Audacity is compiled with support for ffmpeg but it does not work.
> 
> This becomes apparent when e.g. opening a video file in audacity, it'll
> then say that the file is not recognized and we need to install ffmpeg.
> 
> Audacity seems to attempt to load the ffmpeg libraries at run time.
> Looking at Help > Diagnostics > Show log reveals why the library can
> not be loaded:
>     Trying to load FFmpeg libraries...
>     Trying to load FFmpeg libraries from system paths. File name is 
> 'libavformat.so.58'.
>     Checking for monolithic avformat from 'libavformat.so.58'.
>     Error: File not found
> 
> libavformat from graphics/ffmpeg is called libavformat.so.22.0 on
> OpenBSD at this moment so looking for libavformat.so.58 isn't going to
> work. Audacity assumes that the .so file is named as follows:
> src/FFmpeg.h:
>    334           wxString GetLibAVFormatName()
>    335           {
>    336              return (wxT("libavformat.so.") 
> wxT(AV_STRINGIFY(LIBAVFORMAT_VERSION_MAJOR)));
>    337           }
> 
> where LIBAVFORMAT_VERSION_MAJOR comes from ffmpeg's
> include/libavformat/version.h.
> 
> Below I have an un-serious patch (which is why there's no revision bump)
> to show that fixing this check allows ffmpeg to be loaded (and then I'm
> able to open a video file in Audacity).
> 
> My question is: what approach would you suggest to fix this? I can only
> think of some ugly methods, such as patching the code to check for
> the latest libavformat.so file at run time. I think it would be best to
> have this fixed at compile time, however, but I don't see a
> straightforward way to do that. So any help/statement of preference
> is appreciated.
> 
> Caspar
> 
> 
> Index: patches/patch-src_FFmpeg_h
> ===================================================================
> RCS file: /cvs/ports/audio/audacity/patches/patch-src_FFmpeg_h,v
> retrieving revision 1.4
> diff -u -p -r1.4 patch-src_FFmpeg_h
> --- patches/patch-src_FFmpeg_h        14 Feb 2021 08:36:20 -0000      1.4
> +++ patches/patch-src_FFmpeg_h        26 Feb 2022 16:53:55 -0000
> @@ -3,6 +3,27 @@ $OpenBSD: patch-src_FFmpeg_h,v 1.4 2021/
>  Index: src/FFmpeg.h
>  --- src/FFmpeg.h.orig
>  +++ src/FFmpeg.h
> +@@ -333,17 +333,17 @@ class FFmpegLibs (public)
> + 
> +    wxString GetLibAVFormatName()
> +    {
> +-      return (wxT("libavformat.so.") 
> wxT(AV_STRINGIFY(LIBAVFORMAT_VERSION_MAJOR)));
> ++      return (wxT("libavformat.so.22.0"));
> +    }
> + 
> +    wxString GetLibAVCodecName()
> +    {
> +-      return (wxT("libavcodec.so.") 
> wxT(AV_STRINGIFY(LIBAVCODEC_VERSION_MAJOR)));
> ++      return (wxT("libavcodec.so.25.0"));
> +    }
> + 
> +    wxString GetLibAVUtilName()
> +    {
> +-      return (wxT("libavutil.so.") 
> wxT(AV_STRINGIFY(LIBAVUTIL_VERSION_MAJOR)));
> ++      return (wxT("libavutil.so.15.0"));
> +    }
> + #endif // (__WXMAC__) || (__WXMSW__)
> + 
>  @@ -685,7 +685,7 @@ extern "C" {
>      FFMPEG_FUNCTION_WITH_RETURN(
>         AVOutputFormat*,
> 

Reply via email to