mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 06:33:21 -05:00
Drop legacy FLAC, Musepack and WMA file scanners (ffmpeg/libav can do this now)
This commit is contained in:
parent
27876b9187
commit
bf72547b9b
34
configure.ac
34
configure.ac
@ -51,18 +51,6 @@ dnl Large File Support (LFS)
|
||||
AC_SYS_LARGEFILE
|
||||
AC_TYPE_OFF_T
|
||||
|
||||
AC_ARG_ENABLE(flac, AS_HELP_STRING([--enable-flac], [extract FLAC metadata with libflac (default=no)]))
|
||||
AS_IF([test "x$enable_flac" = "xyes"], [
|
||||
use_flac=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DFLAC"
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(musepack, AS_HELP_STRING([--enable-musepack], [extract Musepack metadata with taglib (default=no)]))
|
||||
AS_IF([test "x$enable_musepack" = "xyes"], [
|
||||
use_musepack=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DMUSEPACK"
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(itunes, AS_HELP_STRING([--enable-itunes], [enable iTunes library support (default=no)]))
|
||||
AS_IF([test "x$enable_itunes" = "xyes"], [
|
||||
use_itunes=true;
|
||||
@ -81,6 +69,12 @@ AS_IF([test "x$enable_lastfm" = "xyes"], [
|
||||
CPPFLAGS="${CPPFLAGS} -DLASTFM"
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(mpd, AS_HELP_STRING([--enable-mpd], [enable MPD client protocol support (default=no)]))
|
||||
AS_IF([test "x$enable_mpd" = "xyes"], [
|
||||
use_mpd=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DMPD"
|
||||
])
|
||||
|
||||
case "$host" in
|
||||
*-*-linux-*)
|
||||
use_alsa=true
|
||||
@ -100,18 +94,12 @@ AC_ARG_WITH(alsa, AS_HELP_STRING([--with-alsa], [use ALSA (default Linux=yes, Fr
|
||||
AS_IF([test "x$with_alsa" = "xyes"],[use_alsa=true],[use_alsa=false]);
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(mpd, AS_HELP_STRING([--enable-mpd], [enable MPD client protocol support (default=no)]),
|
||||
use_mpd=true;
|
||||
CPPFLAGS="${CPPFLAGS} -DMPD")
|
||||
|
||||
AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue)
|
||||
AM_CONDITIONAL(COND_MUSEPACK, test x$use_musepack = xtrue)
|
||||
AM_CONDITIONAL(COND_ITUNES, test x$use_itunes = xtrue)
|
||||
AM_CONDITIONAL(COND_SPOTIFY, test x$use_spotify = xtrue)
|
||||
AM_CONDITIONAL(COND_LASTFM, test x$use_lastfm = xtrue)
|
||||
AM_CONDITIONAL(COND_MPD, test x$use_mpd = xtrue)
|
||||
AM_CONDITIONAL(COND_OSS4, test x$use_oss4 = xtrue)
|
||||
AM_CONDITIONAL(COND_ALSA, test x$use_alsa = xtrue)
|
||||
AM_CONDITIONAL(COND_MPD, test x$use_mpd = xtrue)
|
||||
|
||||
dnl Checks for libraries.
|
||||
gl_LIBUNISTRING
|
||||
@ -193,14 +181,6 @@ AC_SUBST(ANTLR3C_LIBS)
|
||||
AM_PATH_LIBGCRYPT([1:1.2.0], , AC_MSG_ERROR([libgcrypt not found]))
|
||||
AM_PATH_GPG_ERROR([1.6], , AC_MSG_ERROR([libgpg-error not found]))
|
||||
|
||||
if test x$use_flac = xtrue; then
|
||||
PKG_CHECK_MODULES(FLAC, [ flac ])
|
||||
fi
|
||||
|
||||
if test x$use_musepack = xtrue; then
|
||||
PKG_CHECK_MODULES(TAGLIB, [ taglib_c ])
|
||||
fi
|
||||
|
||||
if test x$use_itunes = xtrue; then
|
||||
PKG_CHECK_MODULES(LIBPLIST, [ libplist >= 0.16 ])
|
||||
fi
|
||||
|
@ -1,14 +1,6 @@
|
||||
|
||||
sbin_PROGRAMS = forked-daapd
|
||||
|
||||
if COND_FLAC
|
||||
FLAC_SRC=scan-flac.c
|
||||
endif
|
||||
|
||||
if COND_MUSEPACK
|
||||
MUSEPACK_SRC=scan-mpc.c
|
||||
endif
|
||||
|
||||
if COND_ITUNES
|
||||
ITUNES_SRC=filescanner_itunes.c
|
||||
endif
|
||||
@ -74,13 +66,13 @@ forked_daapd_CPPFLAGS = -D_GNU_SOURCE \
|
||||
|
||||
forked_daapd_CFLAGS = \
|
||||
@ZLIB_CFLAGS@ @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @LIBAV_CFLAGS@ \
|
||||
@CONFUSE_CFLAGS@ @TAGLIB_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ \
|
||||
@CONFUSE_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ \
|
||||
@LIBGCRYPT_CFLAGS@ @GPG_ERROR_CFLAGS@ @ALSA_CFLAGS@ @SPOTIFY_CFLAGS@ \
|
||||
@LIBCURL_CFLAGS@
|
||||
|
||||
forked_daapd_LDADD = -lrt \
|
||||
@ZLIB_LIBS@ @AVAHI_LIBS@ @SQLITE3_LIBS@ @LIBAV_LIBS@ \
|
||||
@CONFUSE_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBEVENT_LIBS@ \
|
||||
@CONFUSE_LIBS@ @LIBEVENT_LIBS@ \
|
||||
@MINIXML_LIBS@ @ANTLR3C_LIBS@ @LIBPLIST_LIBS@ \
|
||||
@LIBGCRYPT_LIBS@ @GPG_ERROR_LIBS@ @ALSA_LIBS@ @LIBUNISTRING@ @SPOTIFY_LIBS@ \
|
||||
@LIBCURL_LIBS@
|
||||
@ -116,10 +108,9 @@ forked_daapd_SOURCES = main.c \
|
||||
laudio.c laudio.h \
|
||||
raop.c raop.h \
|
||||
$(RTSP_SRC) \
|
||||
scan-wma.c \
|
||||
$(SPOTIFY_SRC) $(LASTFM_SRC) \
|
||||
$(SPOTIFY_SRC) \
|
||||
$(LASTFM_SRC) \
|
||||
$(MPD_SRC) \
|
||||
$(FLAC_SRC) $(MUSEPACK_SRC) \
|
||||
listener.c listener.h
|
||||
|
||||
nodist_forked_daapd_SOURCES = \
|
||||
@ -129,9 +120,7 @@ BUILT_SOURCES = \
|
||||
$(GPERF_PRODUCTS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(ANTLR_GRAMMARS) \
|
||||
scan-mpc.c \
|
||||
scan-flac.c
|
||||
$(ANTLR_GRAMMARS)
|
||||
|
||||
CLEANFILES = \
|
||||
$(GPERF_PRODUCTS)
|
||||
|
@ -39,17 +39,6 @@
|
||||
#include "misc.h"
|
||||
#include "http.h"
|
||||
|
||||
|
||||
/* Legacy format-specific scanners */
|
||||
extern int scan_get_wmainfo(char *filename, struct media_file_info *pmp3);
|
||||
#ifdef FLAC
|
||||
extern int scan_get_flacinfo(char *filename, struct media_file_info *pmp3);
|
||||
#endif
|
||||
#ifdef MUSEPACK
|
||||
extern int scan_get_mpcinfo(char *filename, struct media_file_info *pmp3);
|
||||
#endif
|
||||
|
||||
|
||||
/* Mapping between the metadata name(s) and the offset
|
||||
* of the equivalent metadata field in struct media_file_info */
|
||||
struct metadata_map {
|
||||
@ -769,37 +758,7 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi)
|
||||
#endif
|
||||
|
||||
if (mdcount == 0)
|
||||
{
|
||||
#if LIBAVFORMAT_VERSION_MAJOR < 54 || (LIBAVFORMAT_VERSION_MAJOR == 54 && LIBAVFORMAT_VERSION_MINOR < 35)
|
||||
/* ffmpeg doesn't support FLAC nor Musepack metadata,
|
||||
* and is buggy for some WMA variants, so fall back to the
|
||||
* legacy format-specific parsers until it gets fixed */
|
||||
if ((codec_id == CODEC_ID_WMAPRO)
|
||||
|| (codec_id == CODEC_ID_WMAVOICE)
|
||||
|| (codec_id == CODEC_ID_WMALOSSLESS))
|
||||
{
|
||||
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy WMA scanner\n");
|
||||
return (scan_get_wmainfo(file, mfi) ? 0 : -1);
|
||||
}
|
||||
#ifdef FLAC
|
||||
else if (codec_id == CODEC_ID_FLAC)
|
||||
{
|
||||
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy FLAC scanner\n");
|
||||
return (scan_get_flacinfo(file, mfi) ? 0 : -1);
|
||||
}
|
||||
#endif /* FLAC */
|
||||
#ifdef MUSEPACK
|
||||
else if ((codec_id == CODEC_ID_MUSEPACK7)
|
||||
|| (codec_id == CODEC_ID_MUSEPACK8))
|
||||
{
|
||||
DPRINTF(E_WARN, L_SCAN, "Falling back to legacy Musepack scanner\n");
|
||||
return (scan_get_mpcinfo(file, mfi) ? 0 : -1);
|
||||
}
|
||||
#endif /* MUSEPACK */
|
||||
else
|
||||
#endif /* LIBAVFORMAT */
|
||||
DPRINTF(E_WARN, L_SCAN, "ffmpeg/libav could not extract any metadata\n");
|
||||
}
|
||||
|
||||
/* Just in case there's no title set ... */
|
||||
if (mfi->title == NULL)
|
||||
|
195
src/scan-flac.c
195
src/scan-flac.c
@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Implementation file for server side format conversion.
|
||||
*
|
||||
* Copyright (C) 2005 Timo J. Rinne (tri@iki.fi)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h> /* why here? For osx 10.2, of course! */
|
||||
#endif
|
||||
#include <netinet/in.h> /* htons and friends */
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "logger.h"
|
||||
#include "db.h"
|
||||
|
||||
#include <FLAC/metadata.h>
|
||||
|
||||
#define TRUE ((1 == 1))
|
||||
#define FALSE (!TRUE)
|
||||
|
||||
typedef struct media_file_info MP3FILE;
|
||||
|
||||
#define GET_VORBIS_COMMENT(comment, name, len) (char*) \
|
||||
(((strncasecmp(name, (char*)(comment).entry, strlen(name)) == 0) && \
|
||||
((comment).entry[strlen(name)] == '=')) ? \
|
||||
((*(len) = (comment).length - (strlen(name) + 1)), \
|
||||
(&((comment).entry[strlen(name) + 1]))) : \
|
||||
NULL)
|
||||
|
||||
/**
|
||||
* scan a flac file for metainfo.
|
||||
*
|
||||
* @param filename file to read metainfo for
|
||||
* @param pmp3 MP3FILE structure to fill
|
||||
* @returns TRUE if file should be added to DB, FALSE otherwise
|
||||
*/
|
||||
int scan_get_flacinfo(char *filename, MP3FILE *pmp3) {
|
||||
FLAC__Metadata_Chain *chain;
|
||||
FLAC__Metadata_Iterator *iterator;
|
||||
FLAC__StreamMetadata *block;
|
||||
int found=0;
|
||||
unsigned int sec, ms;
|
||||
int i;
|
||||
char *val;
|
||||
size_t len;
|
||||
char tmp;
|
||||
|
||||
chain = FLAC__metadata_chain_new();
|
||||
if (! chain) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot allocate FLAC metadata chain\n");
|
||||
return FALSE;
|
||||
}
|
||||
if (! FLAC__metadata_chain_read(chain, filename)) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot read FLAC metadata from %s\n", filename);
|
||||
FLAC__metadata_chain_delete(chain);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
iterator = FLAC__metadata_iterator_new();
|
||||
if (! iterator) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot allocate FLAC metadata iterator\n");
|
||||
FLAC__metadata_chain_delete(chain);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FLAC__metadata_iterator_init(iterator, chain);
|
||||
do {
|
||||
block = FLAC__metadata_iterator_get_block(iterator);
|
||||
|
||||
if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
||||
sec = (unsigned int)(block->data.stream_info.total_samples /
|
||||
block->data.stream_info.sample_rate);
|
||||
ms = (unsigned int)(((block->data.stream_info.total_samples %
|
||||
block->data.stream_info.sample_rate) * 1000) /
|
||||
block->data.stream_info.sample_rate);
|
||||
if ((sec == 0) && (ms == 0))
|
||||
break; /* Info is crap, escape div-by-zero. */
|
||||
pmp3->song_length = (sec * 1000) + ms;
|
||||
pmp3->bitrate = (uint32_t)((pmp3->file_size) / (((sec * 1000) + ms) / 8));
|
||||
pmp3->samplerate = block->data.stream_info.sample_rate;
|
||||
pmp3->bits_per_sample = block->data.stream_info.bits_per_sample;
|
||||
pmp3->sample_count = block->data.stream_info.total_samples;
|
||||
|
||||
found |= 1;
|
||||
if(found == 3)
|
||||
break;
|
||||
}
|
||||
|
||||
if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
|
||||
for (i = 0; i < (int)block->data.vorbis_comment.num_comments; i++) {
|
||||
if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"ARTIST", &len))) {
|
||||
if ((pmp3->artist = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->artist, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"TITLE", &len))) {
|
||||
if ((pmp3->title = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->title, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"ALBUMARTIST", &len))) {
|
||||
if ((pmp3->album_artist = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->album_artist, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"ALBUM", &len))) {
|
||||
if ((pmp3->album = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->album, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"GENRE", &len))) {
|
||||
if ((pmp3->genre = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->genre, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"COMPOSER", &len))) {
|
||||
if ((pmp3->composer = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->composer, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"COMMENT", &len))) {
|
||||
if(pmp3->comment)
|
||||
free(pmp3->comment); /* was description */
|
||||
if ((pmp3->comment = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->comment, val, len);
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"DESCRIPTION", &len))) {
|
||||
if(!pmp3->comment) {
|
||||
if ((pmp3->comment = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->comment, val, len);
|
||||
}
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"TRACKNUMBER", &len))) {
|
||||
tmp = *(val + len);
|
||||
*(val + len) = '\0';
|
||||
pmp3->track = atoi(val);
|
||||
*(val + len) = tmp;
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"DISCNUMBER", &len))) {
|
||||
tmp = *(val + len);
|
||||
*(val + len) = '\0';
|
||||
pmp3->disc = atoi(val);
|
||||
*(val + len) = tmp;
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"YEAR", &len))) {
|
||||
tmp = *(val + len);
|
||||
*(val + len) = '\0';
|
||||
pmp3->year = atoi(val);
|
||||
*(val + len) = tmp;
|
||||
} else if ((val = GET_VORBIS_COMMENT(block->data.vorbis_comment.comments[i],
|
||||
"DATE", &len))) {
|
||||
tmp = *(val + len);
|
||||
*(val + len) = '\0';
|
||||
pmp3->year = atoi(val);
|
||||
*(val + len) = tmp;
|
||||
}
|
||||
}
|
||||
found |= 2;
|
||||
if(found == 3)
|
||||
break;
|
||||
}
|
||||
} while (FLAC__metadata_iterator_next(iterator));
|
||||
|
||||
if (!found) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot find FLAC metadata in %s\n", filename);
|
||||
}
|
||||
|
||||
FLAC__metadata_iterator_delete(iterator);
|
||||
FLAC__metadata_chain_delete(chain);
|
||||
return TRUE;
|
||||
}
|
121
src/scan-mpc.c
121
src/scan-mpc.c
@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Musepack tag parsing routines.
|
||||
*
|
||||
* Copyright (C) 2005 Sebastian Dröge <slomo@ubuntu.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <taglib/tag_c.h>
|
||||
|
||||
#include "logger.h"
|
||||
#include "db.h"
|
||||
|
||||
#define TRUE ((1 == 1))
|
||||
#define FALSE (!TRUE)
|
||||
|
||||
typedef struct media_file_info MP3FILE;
|
||||
|
||||
/**
|
||||
* scan a musepack file for metainfo.
|
||||
*
|
||||
* @param filename file to read metainfo for
|
||||
* @param pmp3 MP3FILE structure to fill
|
||||
* @returns TRUE if file should be added to DB, FALSE otherwise
|
||||
*/
|
||||
int scan_get_mpcinfo(char *filename, MP3FILE *pmp3) {
|
||||
TagLib_File *file;
|
||||
TagLib_Tag *tag;
|
||||
const TagLib_AudioProperties *properties;
|
||||
char *val;
|
||||
int len;
|
||||
unsigned int i;
|
||||
|
||||
/* open file with taglib */
|
||||
if ((file = taglib_file_new_type(filename, TagLib_File_MPC)) == NULL) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Could not open %s with taglib\n", filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* retrieve all tags */
|
||||
if ((tag = taglib_file_tag(file)) == NULL) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Could not retrieve tags of %s\n", filename);
|
||||
taglib_file_free(file);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* fill the MP3FILE structure with the tags */
|
||||
if ((val = taglib_tag_title(tag)) != NULL) {
|
||||
len = strlen(val);
|
||||
if ((pmp3->title = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->title, val, len);
|
||||
taglib_tag_free_strings();
|
||||
}
|
||||
if ((val = taglib_tag_artist(tag)) != NULL) {
|
||||
len = strlen(val);
|
||||
if ((pmp3->artist = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->artist, val, len);
|
||||
taglib_tag_free_strings();
|
||||
}
|
||||
if ((val = taglib_tag_album(tag)) != NULL) {
|
||||
len = strlen(val);
|
||||
if ((pmp3->album = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->album, val, len);
|
||||
taglib_tag_free_strings();
|
||||
}
|
||||
if ((val = taglib_tag_comment(tag)) != NULL) {
|
||||
len = strlen(val);
|
||||
if ((pmp3->comment = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->comment, val, len);
|
||||
taglib_tag_free_strings();
|
||||
}
|
||||
if ((val = taglib_tag_genre(tag)) != NULL) {
|
||||
len = strlen(val);
|
||||
if ((pmp3->genre = calloc(len + 1, 1)) != NULL)
|
||||
strncpy(pmp3->genre, val, len);
|
||||
taglib_tag_free_strings();
|
||||
}
|
||||
|
||||
if ((i = taglib_tag_year(tag)) != 0)
|
||||
pmp3->year = i;
|
||||
if ((i = taglib_tag_track(tag)) != 0)
|
||||
pmp3->track = i;
|
||||
|
||||
/* load the properties (like bitrate) from the file */
|
||||
if ((properties = taglib_file_audioproperties(file)) == NULL) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Could not retrieve properties of %s\n", filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* fill the properties in the MP3FILE structure */
|
||||
pmp3->song_length = taglib_audioproperties_length(properties) * 1000;
|
||||
pmp3->bitrate = taglib_audioproperties_bitrate(properties);
|
||||
pmp3->samplerate = taglib_audioproperties_samplerate(properties);
|
||||
|
||||
taglib_file_free(file);
|
||||
|
||||
return TRUE;
|
||||
}
|
1108
src/scan-wma.c
1108
src/scan-wma.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user