summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-16 21:27:27 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-16 21:27:27 +0200
commit7a72b074f0f5108ff56a7ec770a58cc0bfca908b (patch)
treed089df51d9f48194078632bceeb0ef1cc0ccb6af /playlist.c
parent1cdc11fdf2b5f01c3dd9370f5adc3b05159fe55c (diff)
new cue api
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/playlist.c b/playlist.c
index fb318824..94f2181e 100644
--- a/playlist.c
+++ b/playlist.c
@@ -27,6 +27,11 @@
#include <assert.h>
#include "playlist.h"
#include "codec.h"
+#include "streamer.h"
+#include "messagepump.h"
+#include "messages.h"
+#include "playback.h"
+
#include "cwav.h"
#include "cvorbis.h"
#include "cdumb.h"
@@ -34,10 +39,6 @@
#include "cgme.h"
#include "cflac.h"
#include "csid.h"
-#include "streamer.h"
-#include "messagepump.h"
-#include "messages.h"
-#include "playback.h"
codec_t *codecs[] = {
&cdumb, &cvorbis, &cflac, &cgme, &cmp3, &csid, NULL
@@ -136,10 +137,22 @@ pl_cue_parse_time (const char *p) {
}
playItem_t *
-pl_insert_cue (playItem_t *after, const char *cuename, const char *ftype) {
+pl_insert_cue (playItem_t *after, const char *fname, codec_t *codec, const char *ftype) {
+ int len = strlen (fname);
+ char cuename[len+5];
+ strcpy (cuename, fname);
+ strcpy (cuename+len, ".cue");
FILE *fp = fopen (cuename, "rt");
if (!fp) {
- return NULL;
+ char *ptr = cuename + len;
+ while (ptr >= cuename && *ptr != '.') {
+ ptr--;
+ }
+ strcpy (ptr+1, "cue");
+ fp = fopen (cuename, "rt");
+ if (!fp) {
+ return NULL;
+ }
}
char performer[1024];
char albumtitle[1024];
@@ -233,7 +246,7 @@ pl_insert_cue (playItem_t *after, const char *cuename, const char *ftype) {
// printf ("adding %s\n", str);
playItem_t *it = malloc (sizeof (playItem_t));
memset (it, 0, sizeof (playItem_t));
- it->codec = &cflac;
+ it->codec = codec;
it->fname = strdup (file);
it->tracknum = atoi (track);
it->timestart = tstart;