# HG changeset patch # User Matti Hamalainen # Date 1056055741 0 # Node ID 85a7753e2a9a395116cddd49370d631e28b6c05f # Parent dec37e16136e9b50bb318ced40e552ec22880d8c Lots of new code diff -r dec37e16136e -r 85a7753e2a9a src/xs_length.c --- a/src/xs_length.c Thu Jun 19 20:48:04 2003 +0000 +++ b/src/xs_length.c Thu Jun 19 20:49:01 2003 +0000 @@ -20,11 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xmms-sid.h" +#include "xs_length.h" #include "xs_support.h" -#include "xs_length.h" #include "xs_config.h" -#include "xs_md5.h" #include #include #include @@ -324,12 +322,12 @@ gint i; /* Read the database */ - if (xs_cfg.playDBPath == NULL) + if (xs_cfg.songlenDBPath == NULL) return -10; -fprintf(stderr, "reading '%s'\n", xs_cfg.playDBPath); +fprintf(stderr, "reading '%s'\n", xs_cfg.songlenDBPath); - if (xs_db_read(xs_cfg.playDBPath, &xs_database) < 0) + if (xs_db_read(xs_cfg.songlenDBPath, &xs_database) < 0) return -9; fprintf(stderr, "read_done, now size DB for index\n"); @@ -563,9 +561,8 @@ iResult = -1; - switch (xs_cfg.playMethod) { - - case XMMS_SID_PMETHOD_DATABASE: + if (xs_cfg.songlenDBEnable) + { /* Get the hash and then look up from db */ if (xs_get_sid_hash(fileName, dbHash) == 0) { @@ -577,26 +574,11 @@ iResult = dbEntry->sLengths[subTune]; } } - break; - - case XMMS_SID_PMETHOD_MAXSILENCE: - case XMMS_SID_PMETHOD_NONE: - iResult = -1; - break; - - default: - XSERR("Invalid play-method! (%d, unknown)\n", xs_cfg.playMethod); - break; - } + } /* Check for max playtime */ - if (iResult == -1) - { - if (xs_cfg.playUseMaxTime) - iResult = xs_cfg.playMaxTime; - else - iResult = -1; - } + if ((iResult == -1) && xs_cfg.playMaxTimeEnable) + iResult = xs_cfg.playMaxTime; XSDEBUG("fname='%s', sub=%i, res=%i\n", fileName, subTune, iResult); diff -r dec37e16136e -r 85a7753e2a9a src/xs_length.h --- a/src/xs_length.h Thu Jun 19 20:48:04 2003 +0000 +++ b/src/xs_length.h Thu Jun 19 20:49:01 2003 +0000 @@ -5,13 +5,13 @@ extern "C" { #endif -#include +#include "xmms-sid.h" #include "xs_md5.h" /* * Defines and typedefs */ -#define XS_STIL_MAXENTRY (32) +#define XS_STIL_MAXENTRY (48) typedef struct dbnode { t_xs_md5hash md5Hash; /* 128-bit MD5 hash-digest */ gint nLengths; /* Number of lengths */ @@ -25,10 +25,9 @@ /* * Functions */ -gint xs_songlen_init(void); /* Initialize songlength subsystem */ -void xs_songlen_close(void); /* Close/shutdown */ - -gint32 xs_songlen_get(gchar *, gint); /* Get length in seconds */ +gint xs_songlen_init(void); /* Initialize songlength subsystem */ +void xs_songlen_close(void); /* Close/shutdown */ +gint32 xs_songlen_get(gchar *, gint); /* Get length in seconds */ #ifdef __cplusplus