• Max Kellermann's avatar
    input/uring: new input plugin using io_uring · dae8da70
    Max Kellermann authored
    This is the final piece of the series to establish io_uring support on
    Linux.
    
    MPD doesn't need io_uring for its efficient bulk I/O support, but to
    allow file I/O to be cancelled.  This is a big problem on CIFS/NFS
    mounts where processes sleep uninterruptable if the file server
    disappears, deadlocking MPD.
    
    With io_uring, a flaky NFS connection allows MPD to continue to work
    (even though there are still deadlocks inside MPD which need to be
    addressed).
    
    This plugin does not yet use cancellable `open()` using
    `IORING_OP_OPENAT`.  This will be implemented later.
    
    Lots of other optimization opportunities for io_uring are still
    missing as well - for example the database update could benefit a lot,
    but unfortunately, io_uring doesn't have `readdir()` support just yet.
    dae8da70
meson.build 2.55 KB
input_plugins_sources = [
  'FileInputPlugin.cxx',
]

if uring_dep.found()
  input_plugins_sources += 'UringInputPlugin.cxx'
endif

if alsa_dep.found()
  input_plugins_sources += 'AlsaInputPlugin.cxx'
endif

libcdio_paranoia_dep = dependency('libcdio_paranoia', version: '>= 10.2+0.93+1', required: get_option('cdio_paranoia'))
input_features.set('ENABLE_CDIO_PARANOIA', libcdio_paranoia_dep.found())
if libcdio_paranoia_dep.found()
  input_plugins_sources += 'CdioParanoiaInputPlugin.cxx'
endif

if curl_dep.found()
  input_plugins_sources += [
    'CurlInputPlugin.cxx',
    '../IcyInputStream.cxx',
    '../../IcyMetaDataParser.cxx',
  ]
endif

if ffmpeg_dep.found()
  input_plugins_sources += 'FfmpegInputPlugin.cxx'
endif

libmms_dep = dependency('libmms', version: '>= 0.4', required: get_option('mms'))
input_features.set('ENABLE_MMS', libmms_dep.found())
if libmms_dep.found()
  input_plugins_sources += 'MmsInputPlugin.cxx'
endif

if nfs_dep.found()
  input_plugins_sources += 'NfsInputPlugin.cxx'
endif

if smbclient_dep.found()
  input_plugins_sources += 'SmbclientInputPlugin.cxx'
endif

qobuz_feature = get_option('qobuz')
if qobuz_feature.disabled()
  enable_qobuz = false
else
  enable_qobuz = curl_dep.found() and yajl_dep.found() and crypto_md5_dep.found()
  if not enable_qobuz and qobuz_feature.enabled()
    error('Qobuz requires CURL, libyajl and libgcrypt')
  endif
endif
input_features.set('ENABLE_QOBUZ', enable_qobuz)
if enable_qobuz
  input_plugins_sources += [
    'QobuzClient.cxx',
    'QobuzErrorParser.cxx',
    'QobuzLoginRequest.cxx',
    'QobuzTrackRequest.cxx',
    'QobuzTagScanner.cxx',
    'QobuzInputPlugin.cxx',
  ]
endif

tidal_feature = get_option('tidal')
if tidal_feature.disabled()
  enable_tidal = false
else
  enable_tidal = curl_dep.found() and yajl_dep.found()
  if not enable_tidal and tidal_feature.enabled()
    error('Tidal requires CURL and libyajl')
  endif
endif
input_features.set('ENABLE_TIDAL', enable_tidal)
if enable_tidal
  input_plugins_sources += [
    'TidalErrorParser.cxx',
    'TidalLoginRequest.cxx',
    'TidalSessionManager.cxx',
    'TidalTrackRequest.cxx',
    'TidalTagScanner.cxx',
    'TidalInputPlugin.cxx',
  ]
endif

input_plugins = static_library(
  'input_plugins',
  input_plugins_sources,
  include_directories: inc,
  dependencies: [
    log_dep,
    alsa_dep,
    curl_dep,
    ffmpeg_dep,
    libcdio_paranoia_dep,
    libmms_dep,
    nfs_dep,
    smbclient_dep,
    yajl_dep,
    crypto_md5_dep,
  ],
)

input_plugins_dep = declare_dependency(
  link_with: input_plugins,
  dependencies: [
    input_api_dep,
    pcm_dep,
  ],
)