From fc2689bbd0af9323a366d6fe6b37f613e28fc53f Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 29 Sep 2009 22:47:50 +0200 Subject: vfs_curl WIP --- configure.ac | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 2f268ce4..062cdd28 100644 --- a/configure.ac +++ b/configure.ac @@ -47,12 +47,16 @@ if test ${HAVE_SSE2}; then fi AC_SUBST(SIMD_FLAGS) -dnl lastfm plugin +dnl curl lib AC_CHECK_LIB([curl], [main], [HAVE_CURL=1]) if test ${HAVE_CURL}; then - LFM_LIBS="-lcurl" + CURL_LIBS="-lcurl" + AC_SUBST(CURL_LIBS) +fi + +dnl lastfm plugin +if test ${HAVE_CURL}; then LFM_DIR="plugins/lastfm" - AC_SUBST(LFM_LIBS) AC_SUBST(LFM_DIR) fi @@ -106,6 +110,12 @@ if test ${HAVE_SNDFILE} ; then AC_SUBST(SNDFILE_DIR) fi +dnl lastfm plugin +if test ${HAVE_CURL}; then + VFS_CURL_DIR="plugins/vfs_curl" + AC_SUBST(VFS_CURL_DIR) +fi + AC_OUTPUT([ Makefile pixmaps/Makefile @@ -122,6 +132,7 @@ plugins/vorbis/Makefile plugins/flac/Makefile plugins/wavpack/Makefile plugins/sndfile/Makefile +plugins/vfs_curl/Makefile deadbeef.desktop ]) -- cgit v1.2.3 From b7ed1da166a14f2efe485a9889bf86d304d6bef3 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sun, 4 Oct 2009 21:05:16 +0200 Subject: version change to 0.9999 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 062cdd28..0536c87c 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT AC_CONFIG_HEADER(config.h) PACKAGE="deadbeef" -VERSION="0.2.3-rc1" +VERSION="0.9999" AM_INIT_AUTOMAKE($PACKAGE,$VERSION) -- cgit v1.2.3 From 72faae5d47bf49b7e3aa5bde43bf519382a5efc8 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 5 Oct 2009 22:59:22 +0200 Subject: aac/mp4 decoder WIP --- Makefile.am | 3 +- configure.ac | 11 ++ plugins/faad2/Makefile.am | 7 ++ plugins/faad2/faad2.c | 269 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 plugins/faad2/Makefile.am create mode 100644 plugins/faad2/faad2.c (limited to 'configure.ac') diff --git a/Makefile.am b/Makefile.am index 3fda58cc..18377da1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,8 @@ SUBDIRS = gme/Game_Music_Emu-0.5.2\ ${FLAC_DIR}\ ${WAVPACK_DIR}\ ${SNDFILE_DIR}\ - ${VFS_CURL_DIR} + ${VFS_CURL_DIR}\ + ${FAAD2_DIR} dumbpath=@top_srcdir@/dumb sidpath=@top_srcdir@/sid/sidplay-libs-2.1.0 diff --git a/configure.ac b/configure.ac index 0536c87c..0b2808f1 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,16 @@ if test ${HAVE_CURL}; then AC_SUBST(VFS_CURL_DIR) fi +dnl faad2 plugin +AC_CHECK_LIB([faad], [main], [HAVE_FAAD=1]) +AC_CHECK_LIB([mp4ff], [main], [HAVE_MP4FF=1]) +if test ${HAVE_FAAD} && test ${HAVE_MP4FF} ; then + FAAD2_LIBS="-lfaad -lmp4ff -lmp4v2" + FAAD2_DIR="plugins/faad2" + AC_SUBST(FAAD2_LIBS) + AC_SUBST(FAAD2_DIR) +fi + AC_OUTPUT([ Makefile pixmaps/Makefile @@ -133,6 +143,7 @@ plugins/flac/Makefile plugins/wavpack/Makefile plugins/sndfile/Makefile plugins/vfs_curl/Makefile +plugins/faad2/Makefile deadbeef.desktop ]) diff --git a/plugins/faad2/Makefile.am b/plugins/faad2/Makefile.am new file mode 100644 index 00000000..7dcf7aaa --- /dev/null +++ b/plugins/faad2/Makefile.am @@ -0,0 +1,7 @@ +faad2dir = $(libdir)/$(PACKAGE) +pkglib_LTLIBRARIES = faad2.la +faad2_la_SOURCES = faad2.c +faad2_la_LDFLAGS = -module + +faad2_la_LIBADD = $(LDADD) $(FAAD2_LIBS) +AM_CFLAGS = $(CFLAGS) -std=c99 diff --git a/plugins/faad2/faad2.c b/plugins/faad2/faad2.c new file mode 100644 index 00000000..4f5babf2 --- /dev/null +++ b/plugins/faad2/faad2.c @@ -0,0 +1,269 @@ +/* + DeaDBeeF - ultimate music player for GNU/Linux systems with X11 + Copyright (C) 2009 Alexey Yakovenko + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include "../../deadbeef.h" + +#define min(x,y) ((x)<(y)?(x):(y)) +#define max(x,y) ((x)>(y)?(x):(y)) + +#define trace(...) { fprintf(stderr, __VA_ARGS__); } +//#define trace(fmt,...) + +static DB_decoder_t plugin; +static DB_functions_t *deadbeef; + +static int +aac_init (DB_playItem_t *it) { + return 0; +} + +static void +aac_free (void) { +} + +static int +aac_read_int16 (char *bytes, int size) { + return 0; +} + +static int +aac_seek_sample (int sample) { + return 0; +} + +static int +aac_seek (float t) { + return aac_seek_sample (t * plugin.info.samplerate); +} + +static uint32_t +aac_fs_read (void *user_data, void *buffer, uint32_t length) { + trace ("aac_fs_read\n"); + DB_FILE *fp = (DB_FILE *)user_data; + return deadbeef->fread (buffer, 1, length, fp); +} + +static uint32_t +aac_fs_seek (void *user_data, uint64_t position) { + trace ("aac_fs_seek\n"); + DB_FILE *fp = (DB_FILE *)user_data; + return deadbeef->fseek (fp, position, SEEK_SET); +} + +/* + * These routines are derived from MPlayer. + */ + +/// \param srate (out) sample rate +/// \param num (out) number of audio frames in this ADTS frame +/// \return size of the ADTS frame in bytes +/// aac_parse_frames needs a buffer at least 8 bytes long +static int +aac_parse_frame(uint8_t *buf, int *srate, int *num) +{ + int i = 0, sr, fl = 0; + static int srates[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 0, 0, 0}; + + if((buf[i] != 0xFF) || ((buf[i+1] & 0xF6) != 0xF0)) + return 0; + + /* We currently have no use for the id below. + id = (buf[i+1] >> 3) & 0x01; //id=1 mpeg2, 0: mpeg4 + */ + sr = (buf[i+2] >> 2) & 0x0F; + if(sr > 11) + return 0; + *srate = srates[sr]; + + fl = ((buf[i+3] & 0x03) << 11) | (buf[i+4] << 3) | ((buf[i+5] >> 5) & 0x07); + *num = (buf[i+6] & 0x02) + 1; + + return fl; +} + +static int +parse_aac_stream(DB_FILE *stream) +{ + int cnt = 0, len, srate, num; + int8_t c; + off_t init, probed; + static uint8_t buf[8]; + + init = probed = deadbeef->ftell(stream); + while(probed-init <= 32768 && cnt < 8) + { + c = 0; + while(probed-init <= 32768 && c != 0xFF) + { + if (deadbeef->fread (&c, 1, 1, stream) != 1) { + return 1; + } + if(c < 0) + return 0; + probed = deadbeef->ftell(stream); + } + buf[0] = 0xFF; + if(deadbeef->fread(&(buf[1]), 1, 7, stream) < 7) + return 0; + + len = aac_parse_frame(buf, &srate, &num); + if(len > 0) + { + cnt++; + deadbeef->fseek(stream, len - 8, SEEK_CUR); + } + probed = deadbeef->ftell(stream); + } + + if(cnt < 8) + return 0; + + return 1; +} + +static DB_playItem_t * +aac_insert (DB_playItem_t *after, const char *fname) { + return NULL; // to avoid crashes + trace ("adding %s\n", fname); + DB_FILE *fp = deadbeef->fopen (fname); + if (!fp) { + trace ("not found\n"); + return NULL; + } + if (fp->vfs->streaming) { + trace ("no streaming aac yet (%s)\n", fname); + deadbeef->fclose (fp); + return NULL; + } + + // try mp4 + + mp4ff_callback_t cb = { + .read = aac_fs_read, + .write = NULL, + .seek = aac_fs_seek, + .truncate = NULL, + .user_data = fp + }; + + float duration = -1; + const char *ftype = NULL; + mp4ff_t *mp4 = mp4ff_open_read (&cb); + if (!mp4) { + trace ("not an mp4 file\n"); + deadbeef->fclose (fp); + return NULL; + } + int ntracks = mp4ff_total_tracks (mp4); + trace ("ntracks=%d\n", ntracks); + int i = -1; + for (i = 0; i < ntracks; i++) { + unsigned char* buff = 0; + unsigned int buff_size = 0; + mp4AudioSpecificConfig mp4ASC; + mp4ff_get_decoder_config(mp4, i, &buff, &buff_size); + if(buff){ + int rc = AudioSpecificConfig(buff, buff_size, &mp4ASC); + free(buff); + if(rc < 0) + continue; + break; + } + } + if (i != ntracks) + { + trace ("mp4 track: %d\n", i); + int samplerate = mp4ff_get_sample_rate (mp4, i); + duration = mp4ff_get_track_duration (mp4, i) / (float)samplerate; + ftype = "mp4"; + } + else { + trace ("mp4 track not found\n"); + } + + mp4ff_close (mp4); + + if (duration < 0) { + trace ("trying raw aac\n"); + // not an mp4, try raw aac + deadbeef->rewind (fp); + if (parse_aac_stream (fp)) { + trace ("not aac stream either\n"); + deadbeef->fclose (fp); + return -1; + } + else { + trace ("yes, it's aac indeed\n"); + ftype = "aac"; + } + } + + DB_playItem_t *it = deadbeef->pl_item_alloc (); + it->decoder = &plugin; + it->fname = strdup (fname); + it->filetype = ftype; + it->duration = duration; + + // read tags + if (ftype == "aac") { + int apeerr = deadbeef->junk_read_ape (it, fp); + int v2err = deadbeef->junk_read_id3v2 (it, fp); + int v1err = deadbeef->junk_read_id3v1 (it, fp); + } + deadbeef->pl_add_meta (it, "title", NULL); + + deadbeef->fclose (fp); + + return deadbeef->pl_insert_item (after, it); +} + +static const char * exts[] = { "aac", "mp4", "m4a", NULL }; +static const char *filetypes[] = { "aac", "mp4", NULL }; + +// define plugin interface +static DB_decoder_t plugin = { + DB_PLUGIN_SET_API_VERSION + .plugin.version_major = 0, + .plugin.version_minor = 1, + .plugin.type = DB_PLUGIN_DECODER, + .plugin.name = "faad2 AAC decoder", + .plugin.author = "Alexey Yakovenko", + .plugin.email = "waker@users.sourceforge.net", + .plugin.website = "http://deadbeef.sf.net", + .init = aac_init, + .free = aac_free, + .read_int16 = aac_read_int16, + .seek = aac_seek, + .seek_sample = aac_seek_sample, + .insert = aac_insert, + .exts = exts, + .id = "aac", + .filetypes = filetypes +}; + +DB_plugin_t * +faad2_load (DB_functions_t *api) { + deadbeef = api; + return DB_PLUGIN (&plugin); +} -- cgit v1.2.3 From f972d083eb6d8e6ef68485f839a969d610a11837 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Fri, 9 Oct 2009 21:54:26 +0200 Subject: several fixes to initial cdda implementation --- Makefile.am | 1 + configure.ac | 12 ++ plugins/cda/cda.c | 448 ----------------------------------------- plugins/cdda/Makefile.am | 7 + plugins/cdda/cdda.c | 511 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 531 insertions(+), 448 deletions(-) delete mode 100644 plugins/cda/cda.c create mode 100644 plugins/cdda/Makefile.am create mode 100644 plugins/cdda/cdda.c (limited to 'configure.ac') diff --git a/Makefile.am b/Makefile.am index 18377da1..0808d526 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,7 @@ SUBDIRS = gme/Game_Music_Emu-0.5.2\ ${WAVPACK_DIR}\ ${SNDFILE_DIR}\ ${VFS_CURL_DIR}\ + ${CDDA_DIR}\ ${FAAD2_DIR} dumbpath=@top_srcdir@/dumb diff --git a/configure.ac b/configure.ac index 0b2808f1..86efa100 100644 --- a/configure.ac +++ b/configure.ac @@ -126,6 +126,17 @@ if test ${HAVE_FAAD} && test ${HAVE_MP4FF} ; then AC_SUBST(FAAD2_DIR) fi +dnl cdda plugin +AC_CHECK_LIB([cdio], [main], [HAVE_CDIO=1]) +AC_CHECK_LIB([cddb], [main], [HAVE_CDDB=1]) + +if test ${HAVE_CDIO} && test ${HAVE_CDDB}; then + CDDA_LIBS="-lcdio -lcddb" + CDDA_DIR="plugins/cdda" + AC_SUBST(CDDA_LIBS) + AC_SUBST(CDDA_DIR) +fi + AC_OUTPUT([ Makefile pixmaps/Makefile @@ -144,6 +155,7 @@ plugins/wavpack/Makefile plugins/sndfile/Makefile plugins/vfs_curl/Makefile plugins/faad2/Makefile +plugins/cdda/Makefile deadbeef.desktop ]) diff --git a/plugins/cda/cda.c b/plugins/cda/cda.c deleted file mode 100644 index 6df07449..00000000 --- a/plugins/cda/cda.c +++ /dev/null @@ -1,448 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include - -#include "../../deadbeef.h" - -#define SECTORSIZE CDIO_CD_FRAMESIZE_RAW //2352 -#define SAMPLESIZE 4 //bytes -#define BUFSIZE (CDIO_CD_FRAMESIZE_RAW * 2) - -static DB_decoder_t plugin; -static DB_functions_t *deadbeef; - -static CdIo_t* cdio = NULL; -static lsn_t first_sector; -static unsigned int sector_count; -static uint8_t tail [SECTORSIZE]; -static unsigned int tail_len; -static int current_sector; - -static int use_cddb = 1; -static const char *server; -static int port; -static const char *proxy = NULL; -static int proxy_port; -static int proto_cddb = 1; - -static unsigned int current_sample = 0; - -inline int min(int a, int b) { return aget_config_dir()); - - FILE *cfg_file = fopen (config, "rt"); - if (!cfg_file) { - fprintf (stderr, "cdaudio: failed open %s\n", config); - return -1; - } - - while ( fgets( param, sizeof(param), cfg_file ) ) - { - param[ strlen( param )-1 ] = 0; //terminating \n - if (param[0] == '#' || param[0] == 0) - continue; - - char *colon = strchr (param, ':'); - if (!colon) - { - fprintf (stderr, "cdaudio: malformed config string: %s\n", param); - continue; - } - *(colon++) = 0; - key = trim (param); - value = trim (colon + 1); - - if (0 == strcmp (key, "cddb")) - { - if (0 == strcmp (value, "on")) - use_cddb = 1; - else if (0 == strcmp (value, "off")) - use_cddb = 0; - else - { - use_cddb = 0; - fprintf (stderr, "cdaudio: warning, wrong value %s\n", value); - } - } - else if (0 == strcmp (key, "cddb_server")) - { - server = strdup (value); - } - else if (0 == strcmp (key, "cddb_port")) - { - port = atoi (value); - } - else if (0 == strcmp (key, "cddb_proxy")) - { - proxy = strdup (value); - } - else if (0 == strcmp (key, "cddb_proxy_port")) - { - proxy_port = atoi (value); - } - else if (0 == strcmp (key, "proto")) - { - if (0 == strcmp (value, "cddb")) - proto_cddb = 1; - else if (0 == strcmp (value, "http")) - proto_cddb = 0; - else - fprintf (stderr, "cdaudio: unknown protocol \"%s\"\n", value); - } - else - fprintf (stderr, "cdaudio: warning, unknown option %s\n", key); - } - fclose (cfg_file); -} - -static int -cda_init (DB_playItem_t *it) { - printf ("CDA: initing %s\n", it->fname); - - char *location = strdup (it->fname); - - char *nr = strchr (location, '#'); - *nr = 0; nr++; - int track_nr = atoi (nr); - char *fname = (*location) ? location : NULL; //NULL if empty string; means pysical CD drive - - cdio = cdio_open (fname, DRIVER_UNKNOWN); - if (!cdio) - { - fprintf (stderr, "Could not open CD\n"); - return -1; - } - - if (TRACK_FORMAT_AUDIO != cdio_get_track_format (cdio, track_nr)) - { - fprintf (stderr, "Not an audio track (%d)\n", track_nr); - return -1; - } - - plugin.info.bps = 16, - plugin.info.channels = 2, - plugin.info.samplerate = 44100, - plugin.info.readpos = 0; - - first_sector = cdio_get_track_lsn (cdio, track_nr); - sector_count = cdio_get_track_sec_count (cdio, track_nr); - current_sector = first_sector; - tail_len = 0; - current_sample = 0; -} - -int -cda_read_int16 (char *bytes, int size) { - int initsize = size; - int extrasize = 0; - - if (tail_len > 0) - { - if (tail_len >= size) - { - printf ("Easy case\n"); - memcpy (bytes, tail, size); - tail_len -= size; - memmove (tail, tail+size, tail_len); - return size; - } - printf ("Prepending with tail of %d bytes\n", tail_len); - extrasize = tail_len; - memcpy (bytes, tail, tail_len); - bytes += tail_len; - size -= tail_len; - tail_len = 0; - } - - int sectors_to_read = size / SECTORSIZE + 1; - int end = 0; - - if (current_sector + sectors_to_read > first_sector + sector_count) //we reached end of track - { - end = 1; - sectors_to_read = first_sector + sector_count - current_sector; - printf ("We reached end of track\n"); - } - - int bufsize = sectors_to_read * SECTORSIZE; - - tail_len = end ? 0 : bufsize - size; - - char *buf = alloca (bufsize); - - driver_return_code_t ret = cdio_read_audio_sectors (cdio, buf, current_sector, sectors_to_read); - if (ret != DRIVER_OP_SUCCESS) - return 0; - current_sector += sectors_to_read; - - int retsize = end ? bufsize : size; - - memcpy (bytes, buf, retsize); - if (!end) - memcpy (tail, buf+retsize, tail_len); - - retsize += extrasize; - printf ("requested: %d; tail_len: %d; size: %d; sectors_to_read: %d; return: %d\n", initsize, tail_len, size, sectors_to_read, retsize); - current_sample += retsize / SAMPLESIZE; - plugin.info.readpos = current_sample / 44100; - return retsize; -} - -static void -cda_free () -{ - if (cdio) - { - cdio_destroy (cdio); - cdio = NULL; - } -} - -static int -cda_seek_sample (int sample) -{ - int sector = sample / (SECTORSIZE / SAMPLESIZE) + first_sector; - int offset = (sample % (SECTORSIZE / SAMPLESIZE)) * SAMPLESIZE; //in bytes - char buf [SECTORSIZE]; - - driver_return_code_t ret = cdio_read_audio_sector (cdio, buf, sector); - if (ret != DRIVER_OP_SUCCESS) - return -1; - memcpy (tail, buf + offset, SECTORSIZE - offset ); - current_sector = sector; - current_sample = sample; - plugin.info.readpos = current_sample / 44100; - return 0; -} - -static int -cda_seek (float sec) -{ - return cda_seek_sample (sec * 44100); -} - -cddb_disc_t* -resolve_disc (CdIo_t *cdio) -{ - track_t first_track = cdio_get_first_track_num (cdio); - track_t tracks = cdio_get_num_tracks (cdio); - track_t i; - cddb_track_t *track; - - cddb_disc_t *disc = cddb_disc_new(); - - cddb_disc_set_length (disc, cdio_get_track_lba (cdio, CDIO_CDROM_LEADOUT_TRACK) / CDIO_CD_FRAMES_PER_SEC); - - for (i = 0; i < tracks; i++) - { - lsn_t offset = cdio_get_track_lba (cdio, i+first_track); - track = cddb_track_new(); - cddb_track_set_frame_offset (track, offset); - cddb_disc_add_track (disc, track); - } - cdio_destroy (cdio); - - cddb_conn_t *conn = NULL; - - conn = cddb_new(); - - cddb_set_server_name (conn, server); - cddb_set_server_port (conn, port); - - if (!proto_cddb) - { - cddb_http_enable (conn); - if (proxy) - { - cddb_set_server_port(conn, proxy_port); - cddb_set_server_name(conn, proxy); - } - } - - int matches = cddb_query (conn, disc); - if (matches == -1) - { - cddb_disc_destroy (disc); - cddb_destroy (conn); - return NULL; - } - cddb_read (conn, disc); - cddb_destroy (conn); - return disc; -} - -static DB_playItem_t * -insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int track_nr) -{ - char tmp[512]; //FIXME: how much? - if (file) - snprintf (tmp, sizeof (tmp), "%s#%d.cda", file, track_nr); - else - snprintf (tmp, sizeof (tmp), "#%d.cda", track_nr); - - if (TRACK_FORMAT_AUDIO != cdio_get_track_format (cdio, track_nr)) - { - fprintf (stderr, "Not an audio track (%d)\n", track_nr); - return NULL; - } - - sector_count = cdio_get_track_sec_count (cdio, track_nr); - - DB_playItem_t *it = deadbeef->pl_item_alloc (); - it->decoder = &plugin; - it->fname = strdup (tmp); - it->filetype = "cda"; - it->duration = (float)sector_count / 75.0; - - snprintf (tmp, sizeof (tmp), "CD Track %d", track_nr); - deadbeef->pl_add_meta (it, "title", tmp); - - after = deadbeef->pl_insert_item (after, it); - - return after; -} - -static void -cddb_thread (uintptr_t items_i) -{ - struct cddb_thread_params *params = (struct cddb_thread_params*)items_i; - DB_playItem_t **items = params->items; - DB_playItem_t *item; - - cddb_disc_t* disc = resolve_disc (params->cdio); - if (!disc) - { - printf ("disc not resolved\n"); - return; - } - - const char *disc_title = cddb_disc_get_title (disc); - const char *artist = cddb_disc_get_artist (disc); - cddb_track_t *track; - int i; - - for (i = 0, track = cddb_disc_get_track_first (disc); items[i]; ++i, track = cddb_disc_get_track_next (disc)) - { - int idx = deadbeef->pl_get_idx_of (items[i]); - if (idx == -1) - continue; - - deadbeef->pl_delete_all_meta (items[i]); - deadbeef->pl_add_meta (items[i], "artist", artist); - deadbeef->pl_add_meta (items[i], "album", disc_title); - deadbeef->pl_add_meta (items[i], "title", cddb_track_get_title (track)); - deadbeef->sendmessage (M_TRACKCHANGED, 0, idx, 0); - } - cddb_disc_destroy (disc); -} - -static DB_playItem_t * -cda_insert (DB_playItem_t *after, const char *fname) { - printf ("CDA insert: %s\n", fname); - - int all = 0; - int track_nr; - DB_playItem_t *res; - CdIo_t *cdio; //we need its local inst - - static DB_playItem_t *items[100]; - - char* shortname = strdup (strrchr (fname, '/') + 1); - const char *ext = strrchr (shortname, '.') + 1; - int is_image = (0 == strcmp (ext, "nrg")); - - if (0 == strcmp (ext, "cda")) - cdio = cdio_open (NULL, DRIVER_UNKNOWN); - - else if (is_image) - cdio = cdio_open (fname, DRIVER_NRG); - - if (!cdio) - return NULL; - - if (0 == strcasecmp (shortname, "all.cda") || is_image) - { - track_t first_track = cdio_get_first_track_num (cdio); - track_t tracks = cdio_get_num_tracks (cdio); - track_t i; - res = after; - for (i = 0; i < tracks; i++) - { - res = insert_single_track (cdio, res, is_image ? fname : NULL, i+first_track); - items[i] = res; - } - items[tracks] = NULL; - static struct cddb_thread_params p; - p.items = items; - p.cdio = cdio; - deadbeef->thread_start (cddb_thread, (uintptr_t)&p); //will destroy cdio - } - else - { - track_nr = atoi (shortname); - res = insert_single_track (cdio, after, NULL, track_nr); - cdio_destroy (cdio); - } - return res; -} - -static const char * exts[] = { "cda", "nrg", NULL }; -static const char *filetypes[] = { "cda", "Nero CD image", NULL }; - -// define plugin interface -static DB_decoder_t plugin = { - DB_PLUGIN_SET_API_VERSION - .plugin.version_major = 0, - .plugin.version_minor = 1, - .plugin.type = DB_PLUGIN_DECODER, - .plugin.name = "Audio CD Player", - .plugin.author = "Viktor Semykin", - .plugin.email = "thesame.ml@gmail.com", - .plugin.website = "http://deadbeef.sf.net", - .init = cda_init, - .free = cda_free, - .read_int16 = cda_read_int16, - .seek = cda_seek, - .seek_sample = cda_seek_sample, - .insert = cda_insert, - .exts = exts, - .id = "cda", - .filetypes = filetypes, -}; - -DB_plugin_t * -cda_load (DB_functions_t *api) { - deadbeef = api; - read_config(); - return DB_PLUGIN (&plugin); -} - diff --git a/plugins/cdda/Makefile.am b/plugins/cdda/Makefile.am new file mode 100644 index 00000000..48e4a8d1 --- /dev/null +++ b/plugins/cdda/Makefile.am @@ -0,0 +1,7 @@ +cddadir = $(libdir)/$(PACKAGE) +pkglib_LTLIBRARIES = cdda.la +cdda_la_SOURCES = cdda.c +cdda_la_LDFLAGS = -module + +cdda_la_LIBADD = $(LDADD) $(CDDA_LIBS) +AM_CFLAGS = $(CFLAGS) -std=c99 diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c new file mode 100644 index 00000000..8fa212e7 --- /dev/null +++ b/plugins/cdda/cdda.c @@ -0,0 +1,511 @@ +/* + CD audio plugin for DeaDBeeF + Copyright (C) 2009 Viktor Semykin + + 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, see . +*/ +#include +#include +#include +#include +#include + +#include +#include + +#include "../../deadbeef.h" + +#define trace(...) { fprintf (stderr, __VA_ARGS__); } +//#define trace(fmt,...) + +#define SECTORSIZE CDIO_CD_FRAMESIZE_RAW //2352 +#define SAMPLESIZE 4 //bytes +#define BUFSIZE (CDIO_CD_FRAMESIZE_RAW * 2) + +static DB_decoder_t plugin; +static DB_functions_t *deadbeef; + +static CdIo_t* cdio = NULL; +static lsn_t first_sector; +static unsigned int sector_count; +static uint8_t tail [SECTORSIZE]; +static unsigned int tail_len; +static int current_sector; +static unsigned int current_sample = 0; +static uintptr_t mutex; + +static int use_cddb = 1; +static char server[1024] = "freedb.org"; +static int port = 888; +static char proxy[1024] = ""; +static int proxy_port = -1; +static int proto_cddb = 1; + +struct cddb_thread_params +{ + DB_playItem_t *items[100]; + CdIo_t *cdio; +}; + +static inline int +min (int a, int b) { + return a < b ? a : b; +} + +static char* +trim (char* s) +{ + char *h, *t; + + for ( h = s; *h == ' ' || *h == '\t'; h++ ); + for ( t = s + strlen(s); *t == ' ' || *t == '\t'; *t = 0, t-- ); + return h; +} + +static int +read_config () +{ + char param[ 256 ]; + char config[1024]; + char *key, *value; + snprintf (config, 1024, "%s/cdaudio", deadbeef->get_config_dir()); + + FILE *cfg_file = fopen (config, "rt"); + if (!cfg_file) { + trace ("cdaudio: failed open %s\n", config); + return -1; + } + + while ( fgets( param, sizeof(param), cfg_file ) ) + { + param[ strlen( param )-1 ] = 0; //terminating \n + if (param[0] == '#' || param[0] == 0) + continue; + + char *colon = strchr (param, ':'); + if (!colon) + { + trace ("cdaudio: malformed config string: %s\n", param); + continue; + } + *(colon++) = 0; + key = trim (param); + value = trim (colon + 1); + + if (0 == strcmp (key, "cddb")) + { + if (0 == strcmp (value, "on")) + use_cddb = 1; + else if (0 == strcmp (value, "off")) + use_cddb = 0; + else + { + use_cddb = 0; + trace ("cdaudio: warning, wrong value %s\n", value); + } + } + else if (0 == strcmp (key, "cddb_server")) + { + server[0] = 0; + strncat (server, value, sizeof (server)); + } + else if (0 == strcmp (key, "cddb_port")) + { + port = atoi (value); + } + else if (0 == strcmp (key, "cddb_proxy")) + { + proxy[0] = 0; + strncat (proxy, value, sizeof (server)); + } + else if (0 == strcmp (key, "cddb_proxy_port")) + { + proxy_port = atoi (value); + } + else if (0 == strcmp (key, "proto")) + { + if (0 == strcmp (value, "cddb")) + proto_cddb = 1; + else if (0 == strcmp (value, "http")) + proto_cddb = 0; + else + trace ("cdaudio: unknown protocol \"%s\"\n", value); + } + else + trace ("cdaudio: warning, unknown option %s\n", key); + } + fclose (cfg_file); +} + +static int +cda_init (DB_playItem_t *it) { +// trace ("CDA: initing %s\n", it->fname); + + size_t l = strlen (it->fname); + char location[l+1]; + memcpy (location, it->fname, l+1); + + char *nr = strchr (location, '#'); + if (nr) { + *nr = 0; nr++; + } + else { + trace ("malformed cdaudio track filename\n"); + return -1; + } + int track_nr = atoi (nr); + char *fname = (*location) ? location : NULL; //NULL if empty string; means pysical CD drive + + cdio = cdio_open (fname, DRIVER_UNKNOWN); + if (!cdio) + { + trace ("Could not open CD\n"); + return -1; + } + + if (TRACK_FORMAT_AUDIO != cdio_get_track_format (cdio, track_nr)) + { + trace ("Not an audio track (%d)\n", track_nr); + return -1; + } + + plugin.info.bps = 16, + plugin.info.channels = 2, + plugin.info.samplerate = 44100, + plugin.info.readpos = 0; + + first_sector = cdio_get_track_lsn (cdio, track_nr); + sector_count = cdio_get_track_sec_count (cdio, track_nr); + current_sector = first_sector; + tail_len = 0; + current_sample = 0; +} + +int +cda_read_int16 (char *bytes, int size) { + int initsize = size; + int extrasize = 0; + + if (tail_len > 0) + { + if (tail_len >= size) + { +// trace ("Easy case\n"); + memcpy (bytes, tail, size); + tail_len -= size; + memmove (tail, tail+size, tail_len); + return size; + } +// trace ("Prepending with tail of %d bytes\n", tail_len); + extrasize = tail_len; + memcpy (bytes, tail, tail_len); + bytes += tail_len; + size -= tail_len; + tail_len = 0; + } + + int sectors_to_read = size / SECTORSIZE + 1; + int end = 0; + + if (current_sector + sectors_to_read > first_sector + sector_count) //we reached end of track + { + end = 1; + sectors_to_read = first_sector + sector_count - current_sector; +// trace ("We reached end of track\n"); + } + + int bufsize = sectors_to_read * SECTORSIZE; + + tail_len = end ? 0 : bufsize - size; + + char *buf = alloca (bufsize); + + driver_return_code_t ret = cdio_read_audio_sectors (cdio, buf, current_sector, sectors_to_read); + if (ret != DRIVER_OP_SUCCESS) + return 0; + current_sector += sectors_to_read; + + int retsize = end ? bufsize : size; + + memcpy (bytes, buf, retsize); + if (!end) + memcpy (tail, buf+retsize, tail_len); + + retsize += extrasize; +// trace ("requested: %d; tail_len: %d; size: %d; sectors_to_read: %d; return: %d\n", initsize, tail_len, size, sectors_to_read, retsize); + current_sample += retsize / SAMPLESIZE; + plugin.info.readpos = current_sample / 44100; + return retsize; +} + +static void +cda_free () +{ + if (cdio) + { + cdio_destroy (cdio); + cdio = NULL; + } +} + +static int +cda_seek_sample (int sample) +{ + int sector = sample / (SECTORSIZE / SAMPLESIZE) + first_sector; + int offset = (sample % (SECTORSIZE / SAMPLESIZE)) * SAMPLESIZE; //in bytes + char buf [SECTORSIZE]; + + driver_return_code_t ret = cdio_read_audio_sector (cdio, buf, sector); + if (ret != DRIVER_OP_SUCCESS) + return -1; + memcpy (tail, buf + offset, SECTORSIZE - offset ); + current_sector = sector; + current_sample = sample; + plugin.info.readpos = current_sample / 44100; + return 0; +} + +static int +cda_seek (float sec) +{ + return cda_seek_sample (sec * 44100); +} + +cddb_disc_t* +resolve_disc (CdIo_t *cdio) +{ + track_t first_track = cdio_get_first_track_num (cdio); + track_t tracks = cdio_get_num_tracks (cdio); + track_t i; + cddb_track_t *track; + + cddb_disc_t *disc = cddb_disc_new(); + + cddb_disc_set_length (disc, cdio_get_track_lba (cdio, CDIO_CDROM_LEADOUT_TRACK) / CDIO_CD_FRAMES_PER_SEC); + + for (i = 0; i < tracks; i++) + { + lsn_t offset = cdio_get_track_lba (cdio, i+first_track); + track = cddb_track_new(); + cddb_track_set_frame_offset (track, offset); + cddb_disc_add_track (disc, track); + } + cdio_destroy (cdio); + + cddb_conn_t *conn = NULL; + + conn = cddb_new(); + + cddb_set_server_name (conn, server); + cddb_set_server_port (conn, port); + + if (!proto_cddb) + { + cddb_http_enable (conn); + if (proxy) + { + cddb_set_server_port(conn, proxy_port); + cddb_set_server_name(conn, proxy); + } + } + + int matches = cddb_query (conn, disc); + if (matches == -1) + { + cddb_disc_destroy (disc); + cddb_destroy (conn); + return NULL; + } + cddb_read (conn, disc); + cddb_destroy (conn); + return disc; +} + +static DB_playItem_t * +insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int track_nr) +{ + char tmp[file ? strlen (file) + 20 : 20]; + if (file) + snprintf (tmp, sizeof (tmp), "%s#%d.cda", file, track_nr); + else + snprintf (tmp, sizeof (tmp), "#%d.cda", track_nr); + + if (TRACK_FORMAT_AUDIO != cdio_get_track_format (cdio, track_nr)) + { + trace ("Not an audio track (%d)\n", track_nr); + return NULL; + } + + sector_count = cdio_get_track_sec_count (cdio, track_nr); + + DB_playItem_t *it = deadbeef->pl_item_alloc (); + it->decoder = &plugin; + it->fname = strdup (tmp); + it->filetype = "cdda"; + it->duration = (float)sector_count / 75.0; + + snprintf (tmp, sizeof (tmp), "CD Track %d", track_nr); + deadbeef->pl_add_meta (it, "title", tmp); + + after = deadbeef->pl_insert_item (after, it); + + return after; +} + +static void +cddb_thread (uintptr_t items_i) +{ + struct cddb_thread_params *params = (struct cddb_thread_params*)items_i; + DB_playItem_t **items = params->items; + DB_playItem_t *item; + + trace ("calling resolve_disc\n"); + deadbeef->mutex_lock (mutex); + cddb_disc_t* disc = resolve_disc (params->cdio); + deadbeef->mutex_unlock (mutex); + if (!disc) + { + trace ("disc not resolved\n"); + free (params); + return; + } + trace ("disc resolved\n"); + + deadbeef->mutex_lock (mutex); + const char *disc_title = cddb_disc_get_title (disc); + const char *artist = cddb_disc_get_artist (disc); + trace ("disc_title=%s, disk_artist=%s\n", disc_title, artist); + cddb_track_t *track; + int i; + + // FIXME: playlist must be locked before doing that + for (i = 0, track = cddb_disc_get_track_first (disc); items[i]; ++i, track = cddb_disc_get_track_next (disc)) + { + // FIXME: problem will happen here if item(s) were deleted from playlist, and new items were added in their places + // possible solutions: catch EV_TRACKDELETED and mark item(s) in every thread as NULL + int idx = deadbeef->pl_get_idx_of (items[i]); + trace ("track %d, artist=%s, album=%s, title=%s\n", i, artist, disc_title, cddb_track_get_title (track)); + if (idx == -1) + continue; + + deadbeef->pl_delete_all_meta (items[i]); + deadbeef->pl_add_meta (items[i], "artist", artist); + deadbeef->pl_add_meta (items[i], "album", disc_title); + deadbeef->pl_add_meta (items[i], "title", cddb_track_get_title (track)); + deadbeef->sendmessage (M_TRACKCHANGED, 0, idx, 0); + } + cddb_disc_destroy (disc); + deadbeef->mutex_unlock (mutex); + free (params); +} + +static DB_playItem_t * +cda_insert (DB_playItem_t *after, const char *fname) { +// trace ("CDA insert: %s\n", fname); + + int all = 0; + int track_nr; + DB_playItem_t *res; + CdIo_t *cdio; //we need its local inst + + const char* shortname = strrchr (fname, '/'); + if (shortname) { + shortname++; + } + else { + shortname = fname; + } + const char *ext = strrchr (shortname, '.') + 1; + int is_image = ext && (0 == strcmp (ext, "nrg")); + + if (0 == strcmp (ext, "cda")) { + cdio = cdio_open (NULL, DRIVER_UNKNOWN); + } + else if (is_image) { + cdio = cdio_open (fname, DRIVER_NRG); + } + + if (!cdio) { + return NULL; + } + + if (0 == strcasecmp (shortname, "all.cda") || is_image) + { + trace ("querying freedb...\n"); + track_t first_track = cdio_get_first_track_num (cdio); + track_t tracks = cdio_get_num_tracks (cdio); + track_t i; + res = after; + struct cddb_thread_params *p = malloc (sizeof (struct cddb_thread_params)); + memset (p, 0, sizeof (struct cddb_thread_params)); + p->cdio = cdio; + for (i = 0; i < tracks; i++) + { + res = insert_single_track (cdio, res, is_image ? fname : NULL, i+first_track); + p->items[i] = res; + } + deadbeef->thread_start (cddb_thread, (uintptr_t)p); //will destroy cdio + } + else + { + track_nr = atoi (shortname); + res = insert_single_track (cdio, after, NULL, track_nr); + cdio_destroy (cdio); + } + return res; +} + +static int +cda_start (void) { + mutex = deadbeef->mutex_create (); +} + +static int +cda_stop (void) { + deadbeef->mutex_free (mutex); +} + +static const char *exts[] = { "cda", "nrg", NULL }; +static const char *filetypes[] = { "cdda", NULL }; + +// define plugin interface +static DB_decoder_t plugin = { + DB_PLUGIN_SET_API_VERSION + .plugin.version_major = 0, + .plugin.version_minor = 1, + .plugin.type = DB_PLUGIN_DECODER, + .plugin.name = "Audio CD Player", + .plugin.author = "Viktor Semykin", + .plugin.email = "thesame.ml@gmail.com", + .plugin.website = "http://deadbeef.sf.net", + .plugin.start = cda_start, + .plugin.stop = cda_stop, + .init = cda_init, + .free = cda_free, + .read_int16 = cda_read_int16, + .seek = cda_seek, + .seek_sample = cda_seek_sample, + .insert = cda_insert, + .exts = exts, + .id = "cda", + .filetypes = filetypes, +}; + +DB_plugin_t * +cdda_load (DB_functions_t *api) { + deadbeef = api; + read_config(); + return DB_PLUGIN (&plugin); +} + -- cgit v1.2.3 From 5340f842494f011635d063bf8aa8eb8d462016cf Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 12 Oct 2009 20:59:01 +0200 Subject: plugins that miss dependencies will not be built configure now prints list of all plugins being processed --- configure.ac | 49 ++++++++++++++++++++++++++++++++++++++------ plugins/cdda/Makefile.am | 4 ++++ plugins/faad2/Makefile.am | 2 ++ plugins/flac/Makefile.am | 2 ++ plugins/lastfm/Makefile.am | 3 ++- plugins/mpgmad/Makefile.am | 2 ++ plugins/sndfile/Makefile.am | 2 ++ plugins/vfs_curl/Makefile.am | 2 ++ plugins/vorbis/Makefile.am | 4 ++++ plugins/wavpack/Makefile.am | 2 ++ 10 files changed, 65 insertions(+), 7 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 86efa100..9b8ff022 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,7 @@ AC_SUBST(SIMD_FLAGS) dnl curl lib AC_CHECK_LIB([curl], [main], [HAVE_CURL=1]) +AM_CONDITIONAL(HAVE_CURL, test $HAVE_CURL) if test ${HAVE_CURL}; then CURL_LIBS="-lcurl" AC_SUBST(CURL_LIBS) @@ -62,6 +63,7 @@ fi dnl mpgmad plugin AC_CHECK_LIB([mad], [main], [HAVE_LIBMAD=1]) +AM_CONDITIONAL(HAVE_LIBMAD, test $HAVE_LIBMAD) if test ${HAVE_LIBMAD}; then MAD_LIBS="-lmad" MPGMAD_DIR="plugins/mpgmad" @@ -72,7 +74,8 @@ fi dnl vorbis plugin AC_CHECK_LIB([vorbis], [main], [HAVE_VORBIS=1]) AC_CHECK_LIB([vorbisfile], [main], [HAVE_VORBISFILE=1]) - +AM_CONDITIONAL(HAVE_VORBIS, test $HAVE_VORBIS) +AM_CONDITIONAL(HAVE_VORBISFILE, test $HAVE_VORBISFILE) if test ${HAVE_VORBIS} && test ${HAVE_VORBISFILE} ; then VORBIS_LIBS="-lvorbis -lvorbisfile" VORBIS_DIR="plugins/vorbis" @@ -82,7 +85,7 @@ fi dnl flac plugin AC_CHECK_LIB([FLAC], [main], [HAVE_FLAC=1]) - +AM_CONDITIONAL(HAVE_FLAC, test $HAVE_FLAC) if test ${HAVE_FLAC} ; then FLAC_LIBS="-lFLAC" FLAC_DIR="plugins/flac" @@ -92,7 +95,7 @@ fi dnl wavpack plugin AC_CHECK_LIB([wavpack], [main], [HAVE_WAVPACK=1]) - +AM_CONDITIONAL(HAVE_WAVPACK, test $HAVE_WAVPACK) if test ${HAVE_WAVPACK} ; then WAVPACK_LIBS="-lwavpack" WAVPACK_DIR="plugins/wavpack" @@ -102,7 +105,7 @@ fi dnl libsndfile plugin AC_CHECK_LIB([sndfile], [main], [HAVE_SNDFILE=1]) - +AM_CONDITIONAL(HAVE_SNDFILE, test $HAVE_SNDFILE) if test ${HAVE_SNDFILE} ; then SNDFILE_LIBS="-lsndfile" SNDFILE_DIR="plugins/sndfile" @@ -110,7 +113,7 @@ if test ${HAVE_SNDFILE} ; then AC_SUBST(SNDFILE_DIR) fi -dnl lastfm plugin +dnl vfs_curl plugin if test ${HAVE_CURL}; then VFS_CURL_DIR="plugins/vfs_curl" AC_SUBST(VFS_CURL_DIR) @@ -119,6 +122,8 @@ fi dnl faad2 plugin AC_CHECK_LIB([faad], [main], [HAVE_FAAD=1]) AC_CHECK_LIB([mp4ff], [main], [HAVE_MP4FF=1]) +AM_CONDITIONAL(HAVE_FAAD, test $HAVE_FAAD) +AM_CONDITIONAL(HAVE_MP4FF, test $HAVE_MP4FF) if test ${HAVE_FAAD} && test ${HAVE_MP4FF} ; then FAAD2_LIBS="-lfaad -lmp4ff -lmp4v2" FAAD2_DIR="plugins/faad2" @@ -129,7 +134,8 @@ fi dnl cdda plugin AC_CHECK_LIB([cdio], [main], [HAVE_CDIO=1]) AC_CHECK_LIB([cddb], [main], [HAVE_CDDB=1]) - +AM_CONDITIONAL(HAVE_CDIO, test $HAVE_CDIO) +AM_CONDITIONAL(HAVE_CDDB, test $HAVE_CDDB) if test ${HAVE_CDIO} && test ${HAVE_CDDB}; then CDDA_LIBS="-lcdio -lcddb" CDDA_DIR="plugins/cdda" @@ -137,6 +143,37 @@ if test ${HAVE_CDIO} && test ${HAVE_CDDB}; then AC_SUBST(CDDA_DIR) fi +dnl print summary +echo +echo "plugin summary:" +echo + +AC_DEFUN([PRINT_PLUGIN_INFO], + [ + if $3 ; then + echo " $1: yes - $2" + else + echo " $1: no - $2" + fi + ] +) + +PRINT_PLUGIN_INFO([stdio],[Standard IO plugin],[true]) +PRINT_PLUGIN_INFO([sid],[SID player based on libsidplay2],[true]) +PRINT_PLUGIN_INFO([gme],[chiptune music player based on GME],[true]) +PRINT_PLUGIN_INFO([dumb],[module player based on DUMB library],[true]) +PRINT_PLUGIN_INFO([ffap],[Monkey's audio (APE) decoder],[true]) +PRINT_PLUGIN_INFO([lastfm],[last.fm scrobbler],[test $HAVE_CURL]) +PRINT_PLUGIN_INFO([mpgmad],[mpeg player based on libmad],[test $HAVE_LIBMAD]) +PRINT_PLUGIN_INFO([vorbis],[ogg vorbis player],[test $HAVE_VORBISFILE && test $HAVE_VORBIS]) +PRINT_PLUGIN_INFO([flac],[flac player],[test $HAVE_FLAC]) +PRINT_PLUGIN_INFO([wavpack],[wavpack player],[test $HAVE_WAVPACK]) +PRINT_PLUGIN_INFO([sndfile],[PCM (wav,aiff,etc) player based on libsndfile],[test $HAVE_SNDFILE]) +PRINT_PLUGIN_INFO([vfs_curl],[http/ftp streaming support],[test $HAVE_CURL]) +PRINT_PLUGIN_INFO([faad2],[aac/mp4 player],[test $HAVE_FAAD && test $HAVE_MP4FF]) +PRINT_PLUGIN_INFO([cdda],[cd audio player],[test $HAVE_CDIO && test $HAVE_CDDB]) +echo + AC_OUTPUT([ Makefile pixmaps/Makefile diff --git a/plugins/cdda/Makefile.am b/plugins/cdda/Makefile.am index 48e4a8d1..0f5509c1 100644 --- a/plugins/cdda/Makefile.am +++ b/plugins/cdda/Makefile.am @@ -1,3 +1,5 @@ +if HAVE_CDIO +if HAVE_CDDB cddadir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = cdda.la cdda_la_SOURCES = cdda.c @@ -5,3 +7,5 @@ cdda_la_LDFLAGS = -module cdda_la_LIBADD = $(LDADD) $(CDDA_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif +endif diff --git a/plugins/faad2/Makefile.am b/plugins/faad2/Makefile.am index 7dcf7aaa..963e4c7d 100644 --- a/plugins/faad2/Makefile.am +++ b/plugins/faad2/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_FAAD faad2dir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = faad2.la faad2_la_SOURCES = faad2.c @@ -5,3 +6,4 @@ faad2_la_LDFLAGS = -module faad2_la_LIBADD = $(LDADD) $(FAAD2_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif diff --git a/plugins/flac/Makefile.am b/plugins/flac/Makefile.am index 3072883e..1e8b09bc 100644 --- a/plugins/flac/Makefile.am +++ b/plugins/flac/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_FLAC flacdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = flac.la flac_la_SOURCES = flac.c @@ -5,3 +6,4 @@ flac_la_LDFLAGS = -module flac_la_LIBADD = $(LDADD) $(FLAC_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif diff --git a/plugins/lastfm/Makefile.am b/plugins/lastfm/Makefile.am index 9aec3cf4..4702909e 100644 --- a/plugins/lastfm/Makefile.am +++ b/plugins/lastfm/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_CURL lastfmdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = lastfm.la lastfm_la_SOURCES = lastfm.c @@ -5,4 +6,4 @@ lastfm_la_LDFLAGS = -module lastfm_la_LIBADD = $(LDADD) $(CURL_LIBS) AM_CFLAGS = -std=c99 - +endif diff --git a/plugins/mpgmad/Makefile.am b/plugins/mpgmad/Makefile.am index d3019db1..08abdf59 100644 --- a/plugins/mpgmad/Makefile.am +++ b/plugins/mpgmad/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_LIBMAD mpgmaddir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = mpgmad.la mpgmad_la_SOURCES = mpgmad.c @@ -5,3 +6,4 @@ mpgmad_la_LDFLAGS = -module mpgmad_la_LIBADD = $(LDADD) $(MAD_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif diff --git a/plugins/sndfile/Makefile.am b/plugins/sndfile/Makefile.am index a92828f5..d5c7c9af 100644 --- a/plugins/sndfile/Makefile.am +++ b/plugins/sndfile/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_SNDFILE sndfiledir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = sndfile.la sndfile_la_SOURCES = sndfile.c @@ -5,3 +6,4 @@ sndfile_la_LDFLAGS = -module sndfile_la_LIBADD = $(LDADD) $(SNDFILE_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif diff --git a/plugins/vfs_curl/Makefile.am b/plugins/vfs_curl/Makefile.am index 189596a5..3d7cc3a2 100644 --- a/plugins/vfs_curl/Makefile.am +++ b/plugins/vfs_curl/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_CURL vfs_curldir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = vfs_curl.la vfs_curl_la_SOURCES = vfs_curl.c @@ -5,3 +6,4 @@ vfs_curl_la_LDFLAGS = -module vfs_curl_la_LIBADD = $(LDADD) $(CURL_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif diff --git a/plugins/vorbis/Makefile.am b/plugins/vorbis/Makefile.am index 09b30479..a54da1b5 100644 --- a/plugins/vorbis/Makefile.am +++ b/plugins/vorbis/Makefile.am @@ -1,3 +1,5 @@ +if HAVE_VORBISFILE +if HAVE_VORBIS vorbisdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = vorbis.la vorbis_la_SOURCES = vorbis.c @@ -5,3 +7,5 @@ vorbis_la_LDFLAGS = -module vorbis_la_LIBADD = $(LDADD) $(VORBIS_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif +endif diff --git a/plugins/wavpack/Makefile.am b/plugins/wavpack/Makefile.am index 9a86351f..10f44cf1 100644 --- a/plugins/wavpack/Makefile.am +++ b/plugins/wavpack/Makefile.am @@ -1,3 +1,4 @@ +if HAVE_WAVPACK wavpackdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = wavpack.la wavpack_la_SOURCES = wavpack.c @@ -5,3 +6,4 @@ wavpack_la_LDFLAGS = -module wavpack_la_LIBADD = $(LDADD) $(WAVPACK_LIBS) AM_CFLAGS = $(CFLAGS) -std=c99 +endif -- cgit v1.2.3 From 934588b8b01f45b8b7fe23642127cce41b4b8df4 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Wed, 4 Nov 2009 22:14:52 +0100 Subject: removed aac plugin from build for 0.3.0 --- Makefile.am | 3 +-- configure.ac | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'configure.ac') diff --git a/Makefile.am b/Makefile.am index 7bf75fb8..b8d1be0a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,8 +16,7 @@ SUBDIRS = gme/Game_Music_Emu-0.5.2\ ${WAVPACK_DIR}\ ${SNDFILE_DIR}\ ${VFS_CURL_DIR}\ - ${CDDA_DIR}\ - ${FAAD2_DIR} + ${CDDA_DIR} dumbpath=@top_srcdir@/dumb sidpath=@top_srcdir@/sid/sidplay-libs-2.1.0 diff --git a/configure.ac b/configure.ac index 9b8ff022..2dc16135 100644 --- a/configure.ac +++ b/configure.ac @@ -120,16 +120,16 @@ if test ${HAVE_CURL}; then fi dnl faad2 plugin -AC_CHECK_LIB([faad], [main], [HAVE_FAAD=1]) -AC_CHECK_LIB([mp4ff], [main], [HAVE_MP4FF=1]) -AM_CONDITIONAL(HAVE_FAAD, test $HAVE_FAAD) -AM_CONDITIONAL(HAVE_MP4FF, test $HAVE_MP4FF) -if test ${HAVE_FAAD} && test ${HAVE_MP4FF} ; then - FAAD2_LIBS="-lfaad -lmp4ff -lmp4v2" - FAAD2_DIR="plugins/faad2" - AC_SUBST(FAAD2_LIBS) - AC_SUBST(FAAD2_DIR) -fi +dnl AC_CHECK_LIB([faad], [main], [HAVE_FAAD=1]) +dnl AC_CHECK_LIB([mp4ff], [main], [HAVE_MP4FF=1]) +dnl AM_CONDITIONAL(HAVE_FAAD, test $HAVE_FAAD) +dnl AM_CONDITIONAL(HAVE_MP4FF, test $HAVE_MP4FF) +dnl if test ${HAVE_FAAD} && test ${HAVE_MP4FF} ; then +dnl FAAD2_LIBS="-lfaad -lmp4ff -lmp4v2" +dnl FAAD2_DIR="plugins/faad2" +dnl AC_SUBST(FAAD2_LIBS) +dnl AC_SUBST(FAAD2_DIR) +dnl fi dnl cdda plugin AC_CHECK_LIB([cdio], [main], [HAVE_CDIO=1]) @@ -170,7 +170,7 @@ PRINT_PLUGIN_INFO([flac],[flac player],[test $HAVE_FLAC]) PRINT_PLUGIN_INFO([wavpack],[wavpack player],[test $HAVE_WAVPACK]) PRINT_PLUGIN_INFO([sndfile],[PCM (wav,aiff,etc) player based on libsndfile],[test $HAVE_SNDFILE]) PRINT_PLUGIN_INFO([vfs_curl],[http/ftp streaming support],[test $HAVE_CURL]) -PRINT_PLUGIN_INFO([faad2],[aac/mp4 player],[test $HAVE_FAAD && test $HAVE_MP4FF]) +dnl PRINT_PLUGIN_INFO([faad2],[aac/mp4 player],[test $HAVE_FAAD && test $HAVE_MP4FF]) PRINT_PLUGIN_INFO([cdda],[cd audio player],[test $HAVE_CDIO && test $HAVE_CDDB]) echo @@ -191,7 +191,6 @@ plugins/flac/Makefile plugins/wavpack/Makefile plugins/sndfile/Makefile plugins/vfs_curl/Makefile -plugins/faad2/Makefile plugins/cdda/Makefile deadbeef.desktop ]) -- cgit v1.2.3