summaryrefslogtreecommitdiff
path: root/cmp3.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-19 13:50:36 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-19 13:50:36 +0200
commite89e2345859798fa596e01bd9460a63c92785f49 (patch)
treebf1f0c36b9ded842a43e6fb09a764dce9ce0311b /cmp3.c
parentb41446ad033a52ed24176f9ba01362e3648e97ee (diff)
better format checking before adding to playlist,
more file types supported, bad files are skipped when attempted to be played
Diffstat (limited to 'cmp3.c')
-rw-r--r--cmp3.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/cmp3.c b/cmp3.c
index d5488fbd..6e512e51 100644
--- a/cmp3.c
+++ b/cmp3.c
@@ -5,9 +5,8 @@
#include <stdlib.h>
#include "codec.h"
#include "cmp3.h"
-
-#define min(x,y) ((x)<(y)?(x):(y))
-#define max(x,y) ((x)>(y)?(x):(y))
+#include "playlist.h"
+#include "common.h"
#define READBUFFER 5*8192
#define CACHESIZE 81920
@@ -482,14 +481,34 @@ cmp3_seek (float time) {
int
cmp3_add (const char *fname) {
+ playItem_t *it = malloc (sizeof (playItem_t));
+ memset (it, 0, sizeof (playItem_t));
+ it->codec = &cmp3;
+ it->fname = strdup (fname);
+ it->tracknum = 0;
+ it->timestart = 0;
+ it->timeend = 0;
+ it->displayname = strdup (fname);
+ ps_append_item (it);
return 0;
}
+static const char * exts[]=
+{
+ "mp2","mp3",NULL
+};
+
+const char **cmp3_getexts (void) {
+ return exts;
+}
+
codec_t cmp3 = {
.init = cmp3_init,
.free = cmp3_free,
.read = cmp3_read,
- .seek = cmp3_seek
+ .seek = cmp3_seek,
+ .add = cmp3_add,
+ .getexts = cmp3_getexts
};