changeset 39:85a7753e2a9a

Lots of new code
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 Jun 2003 20:49:01 +0000
parents dec37e16136e
children 1788f4ce6a44
files src/xs_length.c src/xs_length.h
diffstat 2 files changed, 14 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- 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 <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -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);
   
--- 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 <glib.h>
+#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