mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 14:13:18 -05:00
Remove Ogg Vorbis file scanner
This commit is contained in:
parent
056f788c99
commit
f14ba228ec
13
configure.in
13
configure.in
@ -46,14 +46,6 @@ AC_ARG_ENABLE(iconv, AC_HELP_STRING([--enable-iconv], [Enable iconv conversion])
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-iconv);;
|
||||
esac ])
|
||||
|
||||
AC_ARG_ENABLE(oggvorbis, AC_HELP_STRING([--enable-oggvorbis], [Enable Ogg/Vorbis support]),
|
||||
[ case "${enableval}" in
|
||||
yes) use_oggvorbis=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DOGGVORBIS";;
|
||||
no) use_oggvorbis=false;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-oggvorbis);;
|
||||
esac ])
|
||||
|
||||
AC_ARG_ENABLE(flac, AC_HELP_STRING([--enable-flac], [Enable FLAC support]),
|
||||
use_flac=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DFLAC")
|
||||
@ -65,7 +57,6 @@ AC_ARG_ENABLE(musepack, AC_HELP_STRING([--enable-musepack], [Enable Musepack sup
|
||||
AC_ARG_ENABLE(upnp, AC_HELP_STRING([--enable-upnp], [Enable upnp support]),
|
||||
CPPFLAGS="${CPPFLAGS} -DUPNP"; use_upnp=true;)
|
||||
|
||||
AM_CONDITIONAL(COND_OGGVORBIS, test x$use_oggvorbis = xtrue)
|
||||
AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue)
|
||||
AM_CONDITIONAL(COND_MUSEPACK, test x$use_musepack = xtrue)
|
||||
AM_CONDITIONAL(COND_UPNP,test x$use_upnp = xtrue)
|
||||
@ -82,10 +73,6 @@ PKG_CHECK_MODULES(SQLITE3, [ sqlite3 ],
|
||||
AC_DEFINE(HAVE_SQLITE3, 1, [define if sqlite3 is available]))
|
||||
PKG_CHECK_MODULES(FFMPEG, [ libavcodec libavformat ])
|
||||
|
||||
if test x$use_oggvorbis = xtrue; then
|
||||
PKG_CHECK_MODULES(OGGVORBIS, [ ogg vorbis vorbisfile ])
|
||||
fi
|
||||
|
||||
if test x$use_flac = xtrue; then
|
||||
PKG_CHECK_MODULES(FLAC, [ flac ])
|
||||
fi
|
||||
|
@ -3,10 +3,6 @@ SUBDIRS = plugins
|
||||
|
||||
sbin_PROGRAMS = mt-daapd
|
||||
|
||||
if COND_OGGVORBIS
|
||||
OGGVORBISSRC=scan-ogg.c
|
||||
endif
|
||||
|
||||
if COND_FLAC
|
||||
FLACSRC=scan-flac.c
|
||||
endif
|
||||
@ -20,8 +16,8 @@ UPNP=upnp.c upnp.h
|
||||
endif
|
||||
|
||||
|
||||
mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @FFMPEG_CFLAGS@ @OGGVORBIS_CFLAGS@ @TAGLIB_CFLAGS@
|
||||
mt_daapd_LDADD = @AVAHI_LIBS@ @SQLITE3_LIBS@ @FFMPEG_LIBS@ @OGGVORBIS_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBICONV@ @LIBDL@
|
||||
mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @FFMPEG_CFLAGS@ @TAGLIB_CFLAGS@
|
||||
mt_daapd_LDADD = @AVAHI_LIBS@ @SQLITE3_LIBS@ @FFMPEG_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBICONV@ @LIBDL@
|
||||
mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
|
||||
webserver.h configfile.c configfile.h err.c err.h \
|
||||
mp3-scanner.h mp3-scanner.c \
|
||||
@ -35,10 +31,9 @@ mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \
|
||||
io.h io.c io-errors.h io-plugin.h \
|
||||
rend-avahi.c \
|
||||
db-sql.c db-sql.h db-sql-sqlite3.c db-sql-sqlite3.h\
|
||||
$(OGGVORBISSRC) \
|
||||
$(FLACSRC) $(MUSEPACKSRC) \
|
||||
$(UPNP)
|
||||
|
||||
EXTRA_DIST = scan-mpc.c \
|
||||
scan-ogg.c scan-flac.c \
|
||||
scan-flac.c \
|
||||
ff-plugins.h ff-dbstruct.h upnp.c upnp.h ff-plugin-events.h
|
||||
|
@ -1105,10 +1105,6 @@ void config_emit_system(WS_CONNINFO *pwsc, void *value, char *arg) {
|
||||
* \param arg any args passwd with the meta command. Unused.
|
||||
*/
|
||||
void config_emit_flags(WS_CONNINFO *pwsc, void *value, char *arg) {
|
||||
#ifdef OGGVORBIS
|
||||
ws_writefd(pwsc,"%s ","--enable-oggvorbis");
|
||||
#endif
|
||||
|
||||
#ifdef FLAC
|
||||
ws_writefd(pwsc,"%s ","--enable-flac");
|
||||
#endif
|
||||
|
@ -71,11 +71,6 @@ static void scan_music_file(char *path, char *fname,struct stat *psb, int is_com
|
||||
|
||||
|
||||
/* EXTERNAL SCANNERS */
|
||||
|
||||
#ifdef OGGVORBIS
|
||||
extern int scan_get_ogginfo(char *filename, MP3FILE *pmp3);
|
||||
#endif
|
||||
|
||||
#ifdef FLAC
|
||||
extern int scan_get_flacinfo(char *filename, MP3FILE *pmp3);
|
||||
#endif
|
||||
|
141
src/scan-ogg.c
141
src/scan-ogg.c
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Ogg parsing routines.
|
||||
*
|
||||
*
|
||||
* Copyright 2002 Michael Smith <msmith@xiph.org>
|
||||
* Licensed under the GNU GPL, distributed with this program.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
|
||||
#include "daapd.h"
|
||||
#include "err.h"
|
||||
#include "io.h"
|
||||
#include "mp3-scanner.h"
|
||||
|
||||
size_t scan_ogg_read(void *ptr, size_t size, size_t nmemb, void *datasource) {
|
||||
IOHANDLE hfile = (IOHANDLE)datasource;
|
||||
uint32_t bytes_read;
|
||||
|
||||
bytes_read = (uint32_t)(size * nmemb);
|
||||
if(!io_read(hfile,ptr,&bytes_read))
|
||||
return -1;
|
||||
|
||||
return (size_t)bytes_read;
|
||||
}
|
||||
|
||||
int scan_ogg_seek(void *datasource, int64_t offset, int whence) {
|
||||
IOHANDLE hfile = (IOHANDLE)datasource;
|
||||
|
||||
if(!io_setpos(hfile,(uint64_t)offset,whence))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int scan_ogg_close(void *datasource) {
|
||||
IOHANDLE hfile = (IOHANDLE)datasource;
|
||||
int retcode;
|
||||
|
||||
retcode = io_close(hfile);
|
||||
io_dispose(hfile);
|
||||
|
||||
return retcode ? 0 : EOF;
|
||||
}
|
||||
|
||||
long scan_ogg_tell(void *datasource) {
|
||||
IOHANDLE hfile = (IOHANDLE)datasource;
|
||||
uint64_t pos;
|
||||
|
||||
if(!io_getpos(hfile,&pos))
|
||||
return -1;
|
||||
|
||||
return (long)pos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get ogg metainfo
|
||||
*
|
||||
* @param filename file to read metainfo for
|
||||
* @param pmp3 MP3FILE struct to fill with metainfo
|
||||
* @returns TRUE if file should be added to DB, FALSE otherwise
|
||||
*/
|
||||
int scan_get_ogginfo(char *filename, MP3FILE *pmp3) {
|
||||
IOHANDLE hfile;
|
||||
OggVorbis_File vf;
|
||||
vorbis_comment *comment = NULL;
|
||||
vorbis_info *vi = NULL;
|
||||
char *val;
|
||||
ov_callbacks callbacks = { scan_ogg_read, scan_ogg_seek, scan_ogg_close, scan_ogg_tell };
|
||||
|
||||
|
||||
hfile = io_new();
|
||||
if(!hfile) {
|
||||
DPRINTF(E_LOG,L_SCAN,"Could not create file handle\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!io_open(hfile,"file://%U",filename)) {
|
||||
DPRINTF(E_LOG,L_SCAN,"Error opening %s: %s", filename, io_errstr(hfile));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(ov_open_callbacks(hfile,&vf,NULL,0,callbacks) < 0) {
|
||||
DPRINTF(E_LOG,L_SCAN,"Could not create oggvorbis file handler\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vi=ov_info(&vf,-1);
|
||||
if(vi) {
|
||||
DPRINTF(E_DBG,L_SCAN," Bitrates: %d %d %d\n",vi->bitrate_upper,
|
||||
vi->bitrate_nominal,vi->bitrate_lower);
|
||||
if(vi->bitrate_nominal) {
|
||||
pmp3->bitrate=vi->bitrate_nominal / 1000;
|
||||
} else if(vi->bitrate_upper) {
|
||||
pmp3->bitrate=vi->bitrate_upper / 1000;
|
||||
} else if(vi->bitrate_lower) {
|
||||
pmp3->bitrate=vi->bitrate_lower / 1000;
|
||||
}
|
||||
|
||||
DPRINTF(E_DBG,L_SCAN," Bitrates: %d",pmp3->bitrate);
|
||||
pmp3->samplerate=vi->rate;
|
||||
}
|
||||
|
||||
pmp3->song_length=(int)ov_time_total(&vf,-1) * 1000;
|
||||
|
||||
comment = ov_comment(&vf, -1);
|
||||
if (comment != NULL) {
|
||||
if ((val = vorbis_comment_query(comment, "artist", 0)) != NULL)
|
||||
pmp3->artist = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "title", 0)) != NULL)
|
||||
pmp3->title = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "album", 0)) != NULL)
|
||||
pmp3->album = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "genre", 0)) != NULL)
|
||||
pmp3->genre = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "composer", 0)) != NULL)
|
||||
pmp3->composer = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "comment", 0)) != NULL)
|
||||
pmp3->comment = strdup(val);
|
||||
if ((val = vorbis_comment_query(comment, "tracknumber", 0)) != NULL)
|
||||
pmp3->track = atoi(val);
|
||||
if ((val = vorbis_comment_query(comment, "discnumber", 0)) != NULL)
|
||||
pmp3->disc = atoi(val);
|
||||
if ((val = vorbis_comment_query(comment, "year", 0)) != NULL)
|
||||
pmp3->year = atoi(val);
|
||||
}
|
||||
ov_clear(&vf);
|
||||
return TRUE;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user