diff --git a/src/config-driver.c b/src/config-driver.c deleted file mode 100644 index 7140ef51..00000000 --- a/src/config-driver.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * $Id$ - */ - -#include - -#define os_opensyslog() -#define os_syslog(a,b) -#define os_closesyslog() - -#include "daapd.h" -#include "conf.h" -#include "err.h" - - -int main(int argc, char *argv[]) { - int err; - - printf("Reading %s\n",argv[1]); - - if((err=conf_read(argv[1])) != CONF_E_SUCCESS) { - printf("Error reading config: %d\n",err); - conf_close(); - } else { - printf("Read config!\n"); - conf_set_string("general","stupid","lalala"); - conf_set_int("potato","yummy",0); - if(conf_iswritable()) { - printf("writing config\n"); - conf_write(); - } - } - conf_close(); -} diff --git a/src/config.mk b/src/config.mk deleted file mode 100644 index 4db35319..00000000 --- a/src/config.mk +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -CC=gcc -CFLAGS := $(CFLAGS) -g -DHAVE_CONFIG_H -I. -I.. -DERR_LEAN -LDFLAGS := $(LDFLAGS) -TARGET = conf -OBJECTS=config-driver.o conf.o ll.o err.o - -$(TARGET): $(OBJECTS) - $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) - -clean: - rm -f $(OBJECTS) $(TARGET) diff --git a/src/io-driver.c b/src/io-driver.c deleted file mode 100644 index 6f9e76b7..00000000 --- a/src/io-driver.c +++ /dev/null @@ -1,372 +0,0 @@ - -#define _CRT_SECURE_NO_WARNINGS 1 -#define _CRT_SECURE_NO_DEPRECATE 1 - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef WIN32 -# include "getopt.h" -#endif - -#include "io.h" - -struct testinfo { - char *name; - int files; - int restart; - int (*handler)(void); -}; - -int test_readfile(void); -int test_readfile_timeout(void); -int test_servefile(void); -int test_udpserver(void); -int test_udpclient(void); -int test_buffer(void); - -struct testinfo tests[] = { - { "Read file, showing block size [uri to read]", 1, 0, test_readfile }, - { "Read file, with 10s timeout [uri to read]", 1, 0, test_readfile_timeout }, - { "Serve a file [listen://port] [uri to serve]", 2, 1, test_servefile }, - { "UDP echo server [udplisten://port]", 1, 0, test_udpserver }, - { "UDP echo client [udp://server:port]", 1, 0, test_udpclient }, - { "Buffered line read [uri]", 1, 0, test_buffer } -}; - -int debuglevel=1; -char *files[20]; - -int test_udpclient(void) { - IOHANDLE ioclient; - unsigned char buffer[256]; - uint32_t len; - - ioclient = io_new(); - if(!io_open(ioclient,files[0])) { - printf("Can't open udp connection: %s\n", io_errstr(ioclient)); - return FALSE; - } - - strncpy((char*)buffer,"foo",sizeof(buffer)); - len = (uint32_t)strlen((char*)buffer); - if(!io_write(ioclient,buffer,&len)) { - printf("Write error: %s\n",io_errstr(ioclient)); - return FALSE; - } - - /* wait for return */ - len = sizeof(buffer); - if(!io_read(ioclient, buffer, &len)) { - printf("Read error: %s\n",io_errstr(ioclient)); - return FALSE; - } - - buffer[len] = '\0'; - printf("Read %d bytes: %s\n",len,buffer); - return TRUE; -} - -int test_udpserver(void) { - IOHANDLE ioserver; - IO_WAITHANDLE iow; - struct sockaddr_in si_from; - socklen_t si_len; - unsigned char buffer[256]; - uint32_t len; - uint32_t timeout; - - ioserver = io_new(); - if(!io_open(ioserver,files[0])) { - printf("Can't open listener: %s\n", io_errstr(ioserver)); - return FALSE; - } - - si_len = sizeof(si_from); - iow = io_wait_new(); - io_wait_add(iow, ioserver, IO_WAIT_READ | IO_WAIT_ERROR); - - timeout = 30000; /* 30 seconds */ - io_wait(iow, &timeout); - - if(timeout == 0) { - printf("Timeout!\n"); - return TRUE; - } - - if(io_wait_status(iow, ioserver) & IO_WAIT_ERROR) { - printf("Error in ioserver socket\n"); - return FALSE; - } - - len = sizeof(buffer); - if(!io_udp_recvfrom(ioserver, buffer, &len, &si_from, &si_len)) { - printf("Error in recvfrom: %s\n",io_errstr(ioserver)); - return FALSE; - } - - buffer[len] = '\0'; - printf("Got %s\n",buffer); - printf("Returning...\n"); - io_udp_sendto(ioserver,buffer,&len,&si_from,si_len); - - io_close(ioserver); - io_dispose(ioserver); - io_wait_dispose(iow); - - return TRUE; -} - - -int test_servefile(void) { - IOHANDLE ioserver, ioclient, iofile; - IO_WAITHANDLE iow; - uint32_t timeout; - unsigned char buffer[256]; - uint32_t len = sizeof(buffer); - - ioserver = io_new(); - if(!io_open(ioserver,files[0])) { - printf("Can't open listener: %s\n",io_errstr(ioserver)); - return FALSE; - } - - printf("Making new waiter...\n"); - iow = io_wait_new(); - printf("Adding io object to waiter\n"); - io_wait_add(iow, ioserver, IO_WAIT_READ | IO_WAIT_ERROR); - - timeout = 30000; /* 30 seconds */ - printf("Waiting...\n"); - while(io_wait(iow, &timeout)) { - printf("Done waiting.\n"); - if(io_wait_status(iow, ioserver) & IO_WAIT_ERROR) { - printf("Got a status of IO_WAIT_ERROR\n"); - break; - } - if(io_wait_status(iow, ioserver) & IO_WAIT_READ) { - /* got a client */ - printf("Got a client...\n"); - iofile = io_new(); - if(!io_open(iofile,files[1])) { - printf("Can't open file to serve: %s\n",io_errstr(iofile)); - io_dispose(iofile); - io_dispose(ioserver); - return FALSE; - } - printf("Opened %s to serve\n",files[1]); - - /* jet it out to the client */ - ioclient = io_new(); - io_listen_accept(ioserver,ioclient,NULL); - - printf("Got client socket\n"); - len = sizeof(buffer); - while(io_read(iofile,buffer,&len) && len) { - printf("Read %d bytes\n",len); - if(!io_write(ioclient,buffer,&len)) { - printf("write error: %s\n",io_errstr(ioclient)); - } - - len = sizeof(buffer); - } - io_close(ioclient); - io_dispose(ioclient); - printf("Closing client connection\n"); - io_close(iofile); - io_dispose(iofile); - printf("Looping to wait again.\n"); - } - timeout = 30000; /* 30 seconds */ - } - - printf("Wait failed: timeout: %d\n",timeout); - - if(!timeout) { - printf("Timeout waiting for socket\n"); - return TRUE; - } - - /* socket error? */ - printf("Socket error: %s\n",io_errstr(ioserver)); - return FALSE; -} - -int test_readfile(void) { - IOHANDLE ioh; - unsigned char buffer[256]; - uint32_t len = sizeof(buffer); - uint64_t file_len; - - ioh = io_new(); - if(ioh != INVALID_HANDLE) { - if(!io_open(ioh,files[0])) { - printf("Can't open file: %s\n",io_errstr(ioh)); - return FALSE; - } - io_size(ioh, &file_len); - printf("File size: %ld bytes\n",file_len); - while(io_read(ioh,buffer,&len) && len) { - printf("Read %d bytes\n",len); - len = sizeof(buffer); - } - if(!len) { - printf("EOF!\n"); - } else { - printf("Read error: %s\n",io_errstr(ioh)); - } - io_close(ioh); - } else { - return FALSE; - } - - return TRUE; -} - -int test_buffer(void) { - IOHANDLE ioh; - unsigned char buffer[256]; - uint32_t len = sizeof(buffer); - uint64_t file_len; - int line=1; - - ioh = io_new(); - if(ioh != INVALID_HANDLE) { - if(!io_open(ioh,files[0])) { - printf("Can't open file: %s\n",io_errstr(ioh)); - return FALSE; - } - io_size(ioh, &file_len); - io_buffer(ioh); - - printf("File size: %ld bytes\n",file_len); - while(io_readline(ioh,buffer,&len) && len) { - printf("Read %d bytes\n",len); - len = sizeof(buffer); - printf("Line %d: %s\n",line,buffer); - line++; - } - if(!len) { - printf("EOF!\n"); - } else { - printf("Read error: %s\n",io_errstr(ioh)); - } - io_close(ioh); - } else { - return FALSE; - } - - return TRUE; -} - -int test_readfile_timeout(void) { - IOHANDLE ioh; - unsigned char buffer[256]; - uint32_t len = sizeof(buffer); - uint32_t timeout; - - ioh = io_new(); - if(ioh != INVALID_HANDLE) { - if(!io_open(ioh,files[0])) { - printf("Can't open file: %s\n",io_errstr(ioh)); - return FALSE; - } - timeout = 1000; - while(io_read_timeout(ioh,buffer,&len,&timeout) && len) { - printf("Read %d bytes\n",len); - len = sizeof(buffer); - timeout = 1000; - } - if(!len) { - printf("EOF!\n"); - } else { - if(!timeout) { - printf("Timeout\n"); - } else { - printf("Read error: %s\n",io_errstr(ioh)); - } - } - io_close(ioh); - } else { - return FALSE; - } - - return TRUE; -} - -void errhandler(int level, char *msg) { - if(level <= debuglevel) { - fprintf(stderr,"L%d: %s",level,msg); - } - - if(!level) { - fflush(stdout); - exit(1); - } -} - -void usage(void) { - int ntests; - int test; - - fprintf(stderr,"io -t [[file] [...]]\n\n"); - - ntests = (sizeof(tests)/sizeof(struct testinfo)); - for(test=0; test < ntests; test++) { - fprintf(stderr, "Test %02d: %s\n",test+1,tests[test].name); - } - - exit(-1); -} - -int main(int argc, char *argv[]) { - int option; - int test = 0; - int nfiles=0; - int retval; - - while((option = getopt(argc, argv, "t:d:")) != -1) { - switch(option) { - case 't': - test = atoi(optarg); - break; - case 'd': - debuglevel = atoi(optarg); - break; - } - } - - if(!test || (test > (sizeof(tests)/sizeof(struct testinfo)))) - usage(); - - test--; - - while((optind + nfiles) != argc) { - files[nfiles] = argv[optind + nfiles]; - nfiles++; - } - - if(tests[test].files != nfiles) { - fprintf(stderr,"Test %d requres %d files, only got %d\n", - test, tests[test].files, nfiles); - exit(-1); - } - - io_init(); - io_set_errhandler(errhandler); - - printf("Executing test: %s\n",tests[test].name); - retval = tests[test].handler(); - io_deinit(); - - return (retval == FALSE); -} diff --git a/src/io.mk b/src/io.mk deleted file mode 100644 index e574acf6..00000000 --- a/src/io.mk +++ /dev/null @@ -1,11 +0,0 @@ -CC=gcc -CFLAGS := $(CFLAGS) -DDEBUG -g -DHAVE_UNISTD_H -LDFLAGS := $(LDFLAGS) -TARGET = io -OBJECTS= io.o io-driver.o bsd-snprintf.o - -$(TARGET): $(OBJECTS) - $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) - -clean: - rm -f $(OBJECTS) $(TARGET) diff --git a/src/parser-driver.c b/src/parser-driver.c deleted file mode 100644 index 0b62451d..00000000 --- a/src/parser-driver.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Test harness for the parser - */ - -#include -#include -#include -#include -#include - -#include "daapd.h" -#include "conf.h" -#include "db-generic.h" -#include "err.h" -#include "smart-parser.h" - -CONFIG config; -char *scan_winamp_genre[] = { NULL }; - -void usage(void) { - printf("Usage:\n\n parser [-t ] [-d ] \"phrase\"\n\n"); - exit(0); -} - -int main(int argc, char *argv[]) { - int option; - int type=0; - PARSETREE pt; - char *configfile = "/etc/mt-daapd.conf"; - int debuglevel=0; - char db_type[40]; - char db_parms[PATH_MAX]; - int size; - int err; - char *perr; - - while((option = getopt(argc, argv, "d:t:c:")) != -1) { - switch(option) { - case 'c': - configfile = optarg; - break; - case 'd': - debuglevel = atoi(optarg); - break; - case 't': - type = atoi(optarg); - break; - default: - fprintf(stderr,"Error: unknown option (%c)\n\n",option); - usage(); - } - } - - // err_setdebugmask("parse"); - - if(conf_read(configfile) != CONF_E_SUCCESS) { - fprintf(stderr,"could not read config file: %s\n",configfile); - exit(1); - } - - if(debuglevel) { - printf("Setting debug level to %d\n",debuglevel); - err_setlevel(debuglevel); - err_setdest(LOGDEST_STDERR); - } - - size = sizeof(db_type); - conf_get_string("general","db_type","sqlite",db_type,&size); - size = sizeof(db_parms); - conf_get_string("general","db_parms","/var/cache/mt-daapd",db_parms,&size); - - err=db_open(&perr,db_type,db_parms); - if(err != DB_E_SUCCESS) { - fprintf(stderr,"Error opening db: %s\n",perr); - free(perr); - exit(1); - } - - printf("Parsing %s\n",argv[optind]); - - pt=sp_init(); - if(!sp_parse(pt,argv[optind],type)) { - printf("%s\n",sp_get_error(pt)); - } else { - printf("SQL: %s\n",sp_sql_clause(pt)); - } - - sp_dispose(pt); - conf_close(); - - printf("Done!\n"); - return 0; -} diff --git a/src/parser.mk b/src/parser.mk deleted file mode 100644 index 96945953..00000000 --- a/src/parser.mk +++ /dev/null @@ -1,9 +0,0 @@ -CC=gcc -CFLAGS := $(CFLAGS) -g -I/opt/local/include -DHAVE_CONFIG_H -I. -I.. -Wall -DHAVE_SQL -no-cpp-precomp -DMAC -DHOST='"argh"' -LDFLAGS := $(LDFLAGS) -L/opt/local/lib -lsqlite -lsqlite3 -lm -framework CoreFoundation -TARGET=parser -OBJECTS=parser-driver.o smart-parser.o err.o db-sql.o db-generic.o db-sql-sqlite3.o db-sql-sqlite2.o conf.o ll.o xml-rpc.o webserver.o uici.o os-unix.o restart.o configfile.o rend-win32.o plugin.o db-sql-updates.o dispatch.o dynamic-art.o scan-aac.o - -$(TARGET): $(OBJECTS) - $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) - diff --git a/src/scanner-driver.c b/src/scanner-driver.c deleted file mode 100644 index 5c877094..00000000 --- a/src/scanner-driver.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * $Id$ - * Simple driver to test tag scanners without the overhead - * of all of mt-daapd - * - * Copyright (C) 2005 Ron Pedde (ron@pedde.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 - -#include -#include -#include -#include - -#include "daapd.h" -#include "conf.h" -#include "err.h" -#include "mp3-scanner.h" - -/* - * externs - */ -extern int scan_get_wmainfo(char *filename, MP3FILE *pmp3); -extern int scan_get_ogginfo(char *filename, MP3FILE *pmp3); -extern int scan_get_flacinfo(char *filename, MP3FILE *pmp3); -extern int scan_get_mpcinfo(char *filename, MP3FILE *pmp3); -extern int scan_get_wavinfo(char *filename, MP3FILE *pmp3); -extern int scan_get_aacinfo(char *filename, MP3FILE *pmp3); -extern int scan_get_mp3info(char *filename, MP3FILE *pmp3); -extern int scan_get_urlinfo(char *filename, MP3FILE *pmp3); -extern int scan_get_aifinfo(char *filename, MP3FILE *pmp3); - -/* - * Typedefs - */ -typedef struct scannerlist_tag { - char *ext; - int (*scanner)(char *file, MP3FILE *pmp3); -} SCANNERLIST; - -/* - * Globals - */ -SCANNERLIST scanner_list[] = { - { "wma",scan_get_wmainfo }, - { "flac",scan_get_flacinfo }, - { "fla",scan_get_flacinfo }, - { "mpc",scan_get_mpcinfo }, - { "mpp",scan_get_mpcinfo }, - { "mp+",scan_get_mpcinfo }, - { "ogg",scan_get_ogginfo }, - { "m4a",scan_get_aacinfo }, - { "m4p",scan_get_aacinfo }, - { "mp4",scan_get_aacinfo }, - { "wav",scan_get_wavinfo }, - { "url",scan_get_urlinfo }, - { "mp3",scan_get_mp3info }, - { "aif",scan_get_aifinfo }, - { "aiff",scan_get_aifinfo }, - { NULL, NULL } -}; -char *av0; - -CONFIG config; - - -/** - * dump a mp3 file - * - * \param pmp3 mp3 file to dump - */ -void dump_mp3(MP3FILE *pmp3) { - int min,sec,msec; - - min=(pmp3->song_length/1000) / 60; - sec = (pmp3->song_length/1000) - (60 * min); - msec = pmp3->song_length - ((pmp3->song_length/1000)*1000); - - printf("path..........: %s\n",pmp3->path); - printf("fname.........: %s\n",pmp3->fname); - printf("title.........: %s\n",pmp3->title); - printf("artist........: %s\n",pmp3->artist); - printf("album_artist..: %s\n",pmp3->album_artist); - printf("album.........: %s\n",pmp3->album); - printf("genre.........: %s\n",pmp3->genre); - printf("comment.......: %s\n",pmp3->comment); - printf("type..........: %s\n",pmp3->type); - printf("composter.....: %s\n",pmp3->composer); - printf("orchestra.....: %s\n",pmp3->orchestra); - printf("conductor.....: %s\n",pmp3->conductor); - printf("grouping......: %s\n",pmp3->grouping); - printf("url...........: %s\n",pmp3->url); - printf("description...: %s\n",pmp3->description); - printf("codectype.....: %s\n",pmp3->codectype); - printf("year..........: %d\n",pmp3->year); - - printf("bitrate.......: %dkb\n",pmp3->bitrate); - printf("samplerate....: %d\n",pmp3->samplerate); - printf("length........: %dms (%d:%02d.%03d)\n",pmp3->song_length,min,sec,msec); - printf("size..........: %d\n",pmp3->file_size); - - printf("track.........: %d of %d\n",pmp3->track,pmp3->total_tracks); - printf("disc..........: %d of %d\n",pmp3->disc,pmp3->total_discs); - - printf("compilation...: %d\n",pmp3->compilation); - - printf("rating........: %d\n",pmp3->rating); - printf("disabled......: %d\n",pmp3->disabled); - printf("bpm...........: %d\n",pmp3->bpm); - printf("has_video.....: %d\n",pmp3->has_video); -} - - -/* - * dump suage - */ - -void usage(int errorcode) { - fprintf(stderr,"Usage: %s [options] input-file\n\n",av0); - fprintf(stderr,"options:\n\n"); - fprintf(stderr," -d level set debuglevel (9 is highest)\n"); - fprintf(stderr," -c config read config file\n"); - - fprintf(stderr,"\n\n"); - exit(errorcode); -} - -int main(int argc, char *argv[]) { - MP3FILE mp3; - SCANNERLIST *plist; - int option; - char *ext; - char *configfile = "mt-daapd.conf"; - int debuglevel=1; - FILE *fin; - - memset((void*)&mp3,0x00,sizeof(MP3FILE)); - - if(strchr(argv[0],'/')) { - av0 = strrchr(argv[0],'/')+1; - } else { - av0 = argv[0]; - } - - while((option = getopt(argc, argv, "d:c:")) != -1) { - switch(option) { - case 'd': - debuglevel = atoi(optarg); - break; - case 'c': - configfile=optarg; - break; - - default: - fprintf(stderr,"Error: unknown option (%c)\n\n",option); - usage(-1); - } - } - - argc -= optind; - argv += optind; - - if(argc == 0) { - fprintf(stderr,"Error: Must specifiy file name\n\n"); - usage(-1); - } - - printf("Reading config file %s\n",configfile); - if(conf_read(configfile) != CONF_E_SUCCESS) { - fprintf(stderr,"Bummer.\n"); - exit(EXIT_FAILURE); - } - - err_setdest(LOGDEST_STDERR); - err_setlevel(debuglevel); - printf("Getting info for %s\n",argv[0]); - - fin=fopen(argv[0],"r"); - if(!fin) { - perror("fopen"); - exit(EXIT_FAILURE); - } - - fseek(fin,0,SEEK_END); - mp3.file_size = ftell(fin); - fclose(fin); - - ext = strrchr(argv[0],'.')+1; - plist=scanner_list; - - while(plist->ext && (strcasecmp(plist->ext,ext) != 0)) { - plist++; - } - - if(plist->ext) { - fprintf(stderr,"dispatching as single-file metatag parser\n"); - plist->scanner(argv[0],&mp3); - dump_mp3(&mp3); - } else { - fprintf(stderr,"unknown file extension: %s\n",ext); - exit(-1); - } -} diff --git a/src/scanner.mk b/src/scanner.mk deleted file mode 100644 index 3943686a..00000000 --- a/src/scanner.mk +++ /dev/null @@ -1,11 +0,0 @@ -CC=gcc -CFLAGS := $(CFLAGS) -g -I/sw/include -DHAVE_CONFIG_H -I. -I.. -DHOST='"foo"' -DHAVE_SQL -DHAVE_CONFIG_H -LDFLAGS := $(LDFLAGS) -L/sw/lib -lid3tag -logg -lvorbisfile -lFLAC -lvorbis -ltag_c -lsqlite -lsqlite3 -lm -framework CoreFoundation -TARGET = scanner -OBJECTS=scanner-driver.o restart.o err.o scan-aif.o scan-wma.o scan-aac.o scan-wav.o scan-flac.o scan-ogg.o scan-mp3.o scan-url.o scan-mpc.o os-unix.o conf.o ll.o xml-rpc.o webserver.o uici.o rend-win32.o configfile.o db-generic.o db-sql-sqlite3.o db-sql-sqlite2.o db-sql.o smart-parser.o plugin.o dynamic-art.o db-sql-updates.o - -$(TARGET): $(OBJECTS) - $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) - -clean: - rm -f $(OBJECTS) $(TARGET) diff --git a/src/transcoder-driver.c b/src/transcoder-driver.c deleted file mode 100644 index 0f2aba4b..00000000 --- a/src/transcoder-driver.c +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include -#include -#include - -#include "daapd.h" -#include "conf.h" -#include "err.h" -#include "os.h" -#include "plugin.h" -#include "webserver.h" - -char *av0; -CONFIG config; -char *scan_winamp_genre[] = { NULL }; - -void usage(void) { - fprintf(stderr,"Usage: %s [options]\n\n",av0); - fprintf(stderr,"options:\n\n"); - fprintf(stderr," -d level set debuglevel (9 is highest)\n"); - fprintf(stderr," -c config read config file\n"); - fprintf(stderr," -f file file to transcode\n"); - fprintf(stderr," -p plugin plugin to use\n"); - fprintf(stderr," -t codectype\n"); - - fprintf(stderr,"\n\n"); - exit(-1); -} - -int main(int argc, char *argv[]) { - int option; - int debuglevel; - char *plugin=NULL; - char *file=NULL; - char *codectype=NULL; - char *configfile="mt-daapd.conf"; - int bytes_read; - char *pe; - WS_CONNINFO wsc; - - if(strchr(argv[0],'/')) { - av0 = strrchr(argv[0],'/')+1; - } else { - av0 = argv[0]; - } - - while((option = getopt(argc, argv, "d:c:f:p:t:")) != -1) { - switch(option) { - case 'd': - debuglevel = atoi(optarg); - break; - case 'c': - configfile=optarg; - break; - case 'f': - file = optarg; - break; - case 'p': - plugin = optarg; - break; - case 't': - codectype = optarg; - break; - default: - fprintf(stderr,"Error: unknown option (%c)\n\n",option); - usage(); - } - } - - if((!plugin) || (!file) || (!codectype)) { - usage(); - } - - printf("Reading config file %s\n",configfile); - if(conf_read(configfile) != CONF_E_SUCCESS) { - fprintf(stderr,"Bummer.\n"); - exit(-1); - } - - err_setdest(LOGDEST_STDERR); - err_setlevel(debuglevel); - - plugin_init(); - if(plugin_load(&pe, plugin) != PLUGIN_E_SUCCESS) { - fprintf(stderr,"Could not load %s: %s\n",plugin, pe); - exit(-1); - } - - /* fake up a wsconninfo */ - memset(&wsc,0,sizeof(wsc)); - wsc.fd = open("out.wav",O_WRONLY | O_CREAT, 0666); - if(wsc.fd == -1) { - fprintf(stderr,"Error opening output file\n"); - exit(-1); - } - - bytes_read=plugin_ssc_transcode(&wsc,file,codectype,60*1000*3, 0,0); - close(wsc.fd); - - if(bytes_read < 1) { - fprintf(stderr,"Could not transcode\n"); - exit(-1); - } - - fprintf(stderr,"Transcoded %d bytes\n",bytes_read); - - plugin_deinit(); -} - diff --git a/src/transcoder.mk b/src/transcoder.mk deleted file mode 100644 index dceef21b..00000000 --- a/src/transcoder.mk +++ /dev/null @@ -1,11 +0,0 @@ -CC=gcc -CFLAGS := $(CFLAGS) -g -I/sw/include -DHAVE_CONFIG_H -I. -I.. -DHOST='"foo"' -DHAVE_SQL -DHAVE_CONFIG_H -LDFLAGS := $(LDFLAGS) -L/sw/lib -lid3tag -logg -lvorbisfile -lFLAC -lvorbis -lsqlite -lsqlite3 -lm -TARGET = transcoder -OBJECTS=transcoder-driver.o restart.o err.o os-unix.o conf.o ll.o webserver.o uici.o configfile.o plugin.o xml-rpc.o db-generic.o smart-parser.o db-sql.o db-sql-sqlite2.o db-sql-sqlite3.o dispatch.o rend-win32.o dynamic-art.o scan-aac.o - -$(TARGET): $(OBJECTS) - $(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS) - -clean: - rm -f $(OBJECTS) $(TARGET)