[mythtv] Dynamically loading libdvdcss on macOS

Scott Theisen scott.the.elm at gmail.com
Thu Jul 24 18:43:37 UTC 2025


On 2025/07/24 06:09, John Hoyt wrote:
>
>
> On Wed, Jul 23, 2025 at 9:53 PM Scott Theisen 
> <scott.the.elm at gmail.com> wrote:
>
>     On 2025/07/23 18:02, Nigel Pearson wrote:
>>
>>>     On 24 Jul 2025, at 3:34 am, Scott Theisen
>>>     <scott.the.elm at gmail.com> <mailto:scott.the.elm at gmail.com> asked:
>>>
>>>     MythTV's copy of libdvdread has customizations for finding
>>>     libdvdcss on macOS. I think this is related to packaging?  Does
>>>     anyone know if this customization is still necessary?
>>
>>
>>     Necessary?
>>
>>     1) I doubt anyone still has a DVD drive capable Mac :-)
>>
>
>     They could have disk images without CSS stripped and there are
>     external (USB) DVD drives.
>
>>     2) Most users probably use something like MacPorts,
>>     which does its own dependency install locations?
>>
>>
>>
>>     However, a quick look at a standalone binary:
>>
>>     https://sourceforge.net/projects/mythtvformacosx/files/v36/macOS%2013%20Ventura/MythFrontend-x86_64-macOS13-v36-with-plugins.dmg/download
>>
>>     shows DVD & related libraries:
>>
>>     % ls mythfrontend.app/Contents/Frameworks/
>>     <http://mythfrontend.app/Contents/Frameworks/> | grep -E
>>     'dvd|css|blu|udf'
>>
>>     libbluray.2.dylib
>>
>>     libmythdvdnav.36-36.dylib
>>
>>     libudfread.1.dylib
>>
>>
>>
>>
>>     so unless we are removing that feature,
>>     something similar to my old ugliness has to stay?
>>
>
>     That bundle doesn't have libdvdcss.2.dylib, so there is no reason
>     to search extra locations when it won't be found there.
>
>     It looks like only the deprecated packaging scripts for macOS in
>     https://github.com/MythTV/packaging/ do anything with libdvdcss.
>
>     So the question is really: do we want to support bundling
>     libdvdcss on macOS or will libdvdcss only be found if it is in the
>     normal search path for dlopen()?
>
>
> Surprisingly, I actually do have a USB blu-ray drive on one of my 
> macs.  It's been a long while since I've used it...
>
> Both homebrew and macports have libdvdcss available.  I'm not sure why 
> I don't bundle it currently, probably because I rarely use my mac for 
> dvds or blu rays.  Alternatively I may have hit a snag a while back 
> and never revisited it.
>
>     https://formulae.brew.sh/formula/libdvdcss#default
>     https://ports.macports.org/port/libdvdcss/
>
>
> Homebrew stores the lib in the cellar which is annoying but workable 
> while macports puts it in the usual place
>  % brew list libdvdcss
>
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/include/dvdcss/ (2 files)
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/lib/libdvdcss.2.dylib
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/lib/pkgconfig/libdvdcss.pc
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/lib/ (2 other files)
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/sbom.spdx.json
>     /opt/homebrew/Cellar/libdvdcss/1.4.3/share/doc/ (5 files)
>
>
> % port contents libdvdcss
>
>     Port libdvdcss @1.4.3_0 contains:
>
>     /opt/local/include/dvdcss/dvdcss.h
>     /opt/local/include/dvdcss/version.h
>     /opt/local/lib/libdvdcss.2.dylib
>     /opt/local/lib/libdvdcss.a
>     /opt/local/lib/libdvdcss.dylib
>     /opt/local/lib/pkgconfig/libdvdcss.pc
>     /opt/local/share/doc/libdvdcss/AUTHORS
>     /opt/local/share/doc/libdvdcss/COPYING
>     /opt/local/share/doc/libdvdcss/ChangeLog
>     /opt/local/share/doc/libdvdcss/NEWS
>     /opt/local/share/doc/libdvdcss/README
>
>
> My vote would be to remove the workaround and add whatever search path 
> is necessary to locate libdvdcss at build and run time.  This would 
> require an update of ansible playbooks and updates to cmake to help it 
> find libdvdcss on homebrew.  The latest build script bundles (and 
> signs) the app via cmake, so it should automatically pick up any 
> libdvdcss.dylib files linked during build while bundling.

You can link to libdvdcss at build time if you have the header files for 
CMake builds.  qmake builds do not check for the header files, so 
currently you can only dynamically load libdvdcss.

To dynamically load libdvdcss at run time, I think you would have to 
modify one of the LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, or 
DYLD_FALLBACK_LIBRARY_PATH environment variables? 
(https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlopen.3.html)

Should CMake have an option to force dynamically loading libdvdcss at 
run time even if the headers are found?  Would packagers want this option?

Regards,

Scott Theisen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20250724/12d346ab/attachment.htm>


More information about the mythtv-dev mailing list