Browse Source

access: cdda: remove CDDB support

The CDDB databse from freedb.videolan.org doesn't reply anymore (due to
MusicBrainz ?). freedb.org is dead and gnudb.org is empty.

We still have MusicBrainz which is better.

The one reason it may still work for some is that they run their own server.
And the CDs they have are not found in MusicBrainz.
work/unnecessary-disc-string
Steve Lhomme 4 years ago
parent
commit
9a8914c417
  1. 2
      NEWS
  2. 15
      configure.ac
  3. 5
      meson_options.txt
  4. 4
      modules/access/Makefile.am
  5. 196
      modules/access/cdda.c
  6. 9
      modules/access/meson.build

2
NEWS

@ -70,7 +70,7 @@ Access:
* Added support for the Gopher Protocol
* Added avaudiocapture module as a replacement for qtsound, which is removed now
* Audio CD data tracks are now correctly detected and skipped
* Deprecates Audio CD CDDB lookups in favor of more accurate Musicbrainz
* Replace Audio CD CDDB lookups in favor of more accurate Musicbrainz
* Improved CD-TEXT and added Shift-JIS encoding support
* Support for YoutubeDL (where available).
* On-the-fly Zstandard (zstd) file decompression (where available).

15
configure.ac

@ -2330,10 +2330,6 @@ AC_ARG_ENABLE([vcd],
AS_HELP_STRING([--disable-vcd],
[disable built-in VCD and CD-DA support (default enabled)]))
AC_ARG_ENABLE([libcddb],
AS_HELP_STRING([--disable-libcddb],
[disable CDDB for Audio CD (default enabled)]))
if test "${enable_vcd}" != "no" -a "${enable_winstore_app}" != "yes"
then
AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
@ -2366,17 +2362,6 @@ then
then
VLC_ADD_PLUGIN([vcd cdda])
fi
if test "$enable_libcddb" != "no"; then
PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
HAVE_LIBCDDB=yes
AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
],:
[AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
HAVE_LIBCDDB=no])
fi
fi
dnl

5
meson_options.txt

@ -474,11 +474,6 @@ option('taglib',
value : 'auto',
description : 'Enable/disable taglib support')
option('libcddb',
type : 'feature',
value : 'auto',
description : 'Enable/disable libcddb support')
option('libass',
type : 'feature',
value : 'auto',

4
modules/access/Makefile.am

@ -246,8 +246,8 @@ libcdda_plugin_la_SOURCES = access/cdda.c access/disc_helper.h access/vcd/cdrom.
access/vcd/cdrom_internals.h \
misc/webservices/json_helper.h misc/webservices/musicbrainz.c \
misc/webservices/musicbrainz.h
libcdda_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBCDDB_CFLAGS)
libcdda_plugin_la_LIBADD = libvlc_json.la $(LIBCDDB_LIBS) $(LIBM)
libcdda_plugin_la_CFLAGS = $(AM_CFLAGS)
libcdda_plugin_la_LIBADD = libvlc_json.la $(LIBM)
libcdda_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(accessdir)'
if HAVE_DARWIN
libcdda_plugin_la_LIBADD += -liconv

196
modules/access/cdda.c

@ -23,7 +23,6 @@
/**
* Todo:
* - Improve CDDB support (non-blocking, ...)
* - Fix tracknumber in MRL
*/
@ -62,11 +61,6 @@
#include "../misc/webservices/musicbrainz.h"
#ifdef HAVE_LIBCDDB
#include <cddb/cddb.h>
#include <errno.h>
#endif
#define INVALID_SECTOR ((unsigned) -1)
static vcddev_t *DiscOpen(vlc_object_t *obj, const char *location,
@ -379,9 +373,6 @@ typedef struct
int i_cdda_last; /* Last .. */
int cdtextc;
vlc_meta_t **cdtextv;
#ifdef HAVE_LIBCDDB
cddb_disc_t *cddb;
#endif
musicbrainz_recording_t *mbrecord;
} access_sys_t;
@ -519,112 +510,6 @@ static musicbrainz_recording_t * GetMusicbrainzInfo( vlc_object_t *obj,
return recording;
}
#ifdef HAVE_LIBCDDB
static cddb_disc_t *GetCDDBInfo( vlc_object_t *obj, const vcddev_toc_t *p_toc )
{
msg_Dbg( obj, "retrieving metadata with CDDB" );
/* */
cddb_conn_t *p_cddb = cddb_new();
if( !p_cddb )
{
msg_Warn( obj, "unable to use CDDB" );
return NULL;
}
/* */
cddb_http_enable( p_cddb );
char *psz_tmp = var_InheritString( obj, "cddb-server" );
if( psz_tmp )
{
cddb_set_server_name( p_cddb, psz_tmp );
free( psz_tmp );
}
cddb_set_server_port( p_cddb, var_InheritInteger( obj, "cddb-port" ) );
cddb_set_email_address( p_cddb, "vlc@videolan.org" );
cddb_set_http_path_query( p_cddb, "/~cddb/cddb.cgi" );
cddb_set_http_path_submit( p_cddb, "/~cddb/submit.cgi" );
char *psz_cachedir;
char *psz_temp = config_GetUserDir( VLC_CACHE_DIR );
if (likely(psz_temp != NULL))
{
if( asprintf( &psz_cachedir, "%s" DIR_SEP "cddb", psz_temp ) > 0 ) {
cddb_cache_enable( p_cddb );
cddb_cache_set_dir( p_cddb, psz_cachedir );
free( psz_cachedir );
}
free( psz_temp );
}
cddb_set_timeout( p_cddb, 10 );
/* */
cddb_disc_t *p_disc = cddb_disc_new();
if( !p_disc )
{
msg_Err( obj, "unable to create CDDB disc structure." );
goto error;
}
for( int i = 0; i < p_toc->i_tracks; i++ )
{
int cddb_offset = LBAPregap(p_toc->p_sectors[i].i_lba); // 2s Pregap offset
cddb_track_t *t = cddb_track_new();
cddb_track_set_frame_offset( t, cddb_offset );
cddb_disc_add_track( p_disc, t );
msg_Dbg( obj, "Track %i offset: %i", i, cddb_offset );
}
const int64_t i_size = p_toc->p_sectors[p_toc->i_tracks].i_lba - p_toc->p_sectors[0].i_lba;
int i_length = (int)(i_size * CDDA_DATA_SIZE / 4 / 44100) + 2 ; // 2s Pregap
msg_Dbg( obj, "Total length: %i", i_length );
cddb_disc_set_length( p_disc, i_length );
if( !cddb_disc_calc_discid( p_disc ) )
{
msg_Err( obj, "CDDB disc ID calculation failed" );
goto error;
}
const int i_matches = cddb_query( p_cddb, p_disc );
if( i_matches < 0 )
{
msg_Warn( obj, "CDDB error: %s", cddb_error_str(errno) );
goto error;
}
else if( i_matches == 0 )
{
msg_Dbg( obj, "Couldn't find any matches in CDDB." );
goto error;
}
else if( i_matches > 1 )
msg_Warn( obj, "found %d matches in CDDB. Using first one.", i_matches );
cddb_read( p_cddb, p_disc );
msg_Dbg( obj, "disc ID: 0x%08x", cddb_disc_get_discid(p_disc) );
cddb_destroy( p_cddb);
return p_disc;
error:
if( p_disc )
cddb_disc_destroy( p_disc );
cddb_destroy( p_cddb );
msg_Dbg( obj, "CDDB failure" );
return NULL;
}
#endif /* HAVE_LIBCDDB */
static void AccessGetMeta(stream_t *access, vlc_meta_t *meta)
{
access_sys_t *sys = access->p_sys;
@ -639,52 +524,6 @@ static void AccessGetMeta(stream_t *access, vlc_meta_t *meta)
#define NONEMPTY( psz ) ( (psz) && *(psz) )
/* If the given string is NULL or empty, fill it by the return value of 'code' */
#define ON_EMPTY( psz, code ) do { if( !NONEMPTY( psz) ) { (psz) = code; } } while(0)
/* Retrieve CDDB information (preferred over CD-TEXT) */
#ifdef HAVE_LIBCDDB
if (sys->cddb != NULL)
{
const char *str = cddb_disc_get_title(sys->cddb);
if (NONEMPTY(str))
vlc_meta_SetTitle(meta, str);
str = cddb_disc_get_genre(sys->cddb);
if (NONEMPTY(str))
vlc_meta_SetGenre(meta, str);
const unsigned year = cddb_disc_get_year(sys->cddb);
if (year != 0)
{
char yearbuf[5];
int ret = snprintf(yearbuf, sizeof (yearbuf), "%u", year);
if (ret >= 0 && (size_t) ret < sizeof (yearbuf))
vlc_meta_SetDate(meta, yearbuf);
}
/* Set artist only if identical across tracks */
str = cddb_disc_get_artist(sys->cddb);
if (NONEMPTY(str))
{
for (int i = 0; i < sys->p_toc->i_tracks; i++)
{
cddb_track_t *t = cddb_disc_get_track(sys->cddb, i);
if (t == NULL)
continue;
const char *track_artist = cddb_track_get_artist(t);
if (NONEMPTY(track_artist))
{
if (strcmp(str, track_artist))
{
str = NULL;
break;
}
}
}
}
}
#endif
}
static int ReadDir(stream_t *access, input_item_node_t *node)
@ -754,23 +593,6 @@ static int ReadDir(stream_t *access, input_item_node_t *node)
const char *isrc = NULL;
int year = 0;
#ifdef HAVE_LIBCDDB
if (sys->cddb != NULL)
{
cddb_track_t *t = cddb_disc_get_track(sys->cddb, i);
if (t != NULL)
{
title = cddb_track_get_title(t);
artist = cddb_track_get_artist(t);
}
ON_EMPTY(artist, cddb_disc_get_artist(sys->cddb));
album = cddb_disc_get_title(sys->cddb);
genre = cddb_disc_get_genre(sys->cddb);
year = cddb_disc_get_year(sys->cddb);
}
#endif
/* Per track CDText */
if(sys->cdtextc > 0)
{
@ -924,18 +746,11 @@ static int AccessOpen(vlc_object_t *obj, vcddev_t *dev)
}
sys->mbrecord = NULL;
#ifdef HAVE_LIBCDDB
sys->cddb = NULL;
#endif
if(var_InheritBool(obj, "metadata-network-access"))
{
sys->mbrecord = GetMusicbrainzInfo(obj, sys->p_toc, sys->i_cdda_tracks,
sys->i_cdda_first, sys->i_cdda_last );
#ifdef HAVE_LIBCDDB
if(!sys->mbrecord)
sys->cddb = GetCDDBInfo(obj, sys->p_toc);
#endif
}
else msg_Dbg(obj, "album art policy set to manual: not fetching");
@ -962,10 +777,6 @@ static void AccessClose(access_sys_t *sys)
}
free(sys->cdtextv);
#ifdef HAVE_LIBCDDB
if (sys->cddb != NULL)
cddb_disc_destroy(sys->cddb);
#endif
if(sys->mbrecord)
musicbrainz_recording_release(sys->mbrecord);
vcddev_toc_Free(sys->p_toc);
@ -1043,13 +854,6 @@ vlc_module_begin ()
add_string( "musicbrainz-server", MUSICBRAINZ_DEFAULT_SERVER,
N_( "Musicbrainz Server" ),
N_( "Address of the musicbrainz server to use." ) )
#ifdef HAVE_LIBCDDB
add_string( "cddb-server", "freedb.videolan.org", N_( "CDDB Server" ),
N_( "Address of the CDDB server to use." ) )
add_integer( "cddb-port", 80, N_( "CDDB port" ),
N_( "CDDB Server port to use." ) )
change_integer_range( 1, 65535 )
#endif
add_shortcut( "cdda", "cddasimple" )
vlc_module_end ()

9
modules/access/meson.build

@ -259,11 +259,6 @@ endif
if get_option('vcd_module')
vcd_cdda_flags = []
libcddb_dep = dependency('libcddb', version: '>= 0.9.5', required: get_option('libcddb'))
if libcddb_dep.found()
vcd_cdda_flags += '-DHAVE_LIBCDDB'
endif
if cc.has_header_symbol('linux/cdrom.h', 'struct cdrom_msf0')
needed_vcd_unix_headers_present = true
elif cc.has_header_symbol('sys/scsiio.h', 'struct scsireq')
@ -293,7 +288,7 @@ if get_option('vcd_module')
),
'c_args' : vcd_cdda_flags,
'link_with' : vlc_json_lib,
'dependencies' : [libcddb_dep, vcd_cdda_darwin_deps, gcrypt_dep]
'dependencies' : [vcd_cdda_darwin_deps, gcrypt_dep]
}
vlc_modules += {
@ -303,7 +298,7 @@ if get_option('vcd_module')
'vcd/cdrom.c',
),
'c_args' : vcd_cdda_flags,
'dependencies' : [libcddb_dep, vcd_cdda_darwin_deps]
'dependencies' : [vcd_cdda_darwin_deps]
}
endif

Loading…
Cancel
Save