summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac31
-rw-r--r--decoder_template.c4
-rw-r--r--plugins/aac/Makefile.am9
-rw-r--r--plugins/faad2/Makefile.am9
-rw-r--r--plugins/faad2/faad2.c270
-rw-r--r--plugins/ffmpeg/ffmpeg.c38
6 files changed, 47 insertions, 314 deletions
diff --git a/configure.ac b/configure.ac
index 6e13a319..0c57ba14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ AC_ARG_ENABLE(musepack, [ --disable-musepack disable musepack plugin (defa
AC_ARG_ENABLE(wildmidi, [ --disable-wildmidi disable wildmidi plugin (default: enabled)], [enable_wildmidi=$enableval], [enable_wildmidi=yes])
AC_ARG_ENABLE(tta, [ --disable-tta disable tta plugin (default: enabled)], [enable_tta=$enableval], [enable_tta=yes])
AC_ARG_ENABLE(dca, [ --disable-dca disable dca (DTS audio) plugin (default: enabled)], [enable_dca=$enableval], [enable_dca=yes])
+AC_ARG_ENABLE(aac, [ --disable-aac disable AAC decoder based on FAAD2 (default: enabled)], [enable_aac=$enableval], [enable_aac=yes])
PKG_CHECK_MODULES(DEPS, samplerate)
@@ -201,18 +202,6 @@ if test "x$enable_vfs_curl" != "xno" ; then
fi
fi
-dnl faad2 plugin
-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
if test "x$enable_cdda" != "xno" ; then
AC_CHECK_LIB([cdio], [main], [HAVE_CDIO=yes])
@@ -371,7 +360,19 @@ if test "x$enable_dca" != "xno" ; then
HAVE_DCA=yes
fi
-PLUGINS_DIRS="plugins/lastfm plugins/mpgmad plugins/vorbis plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/dumb plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca"
+if test "x$enable_aac" != "xno" ; then
+ 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"
+ AC_SUBST(FAAD2_LIBS)
+ HAVE_AAC=yes
+ fi
+fi
+
+PLUGINS_DIRS="plugins/lastfm plugins/mpgmad plugins/vorbis plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/dumb plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca plugins/aac"
AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBISPLUGIN" = "xyes")
AM_CONDITIONAL(HAVE_FLAC, test "x$HAVE_FLACPLUGIN" = "xyes")
@@ -402,6 +403,7 @@ AM_CONDITIONAL(HAVE_MUSEPACK, test "x$HAVE_MUSEPACK" = "xyes")
AM_CONDITIONAL(HAVE_WILDMIDI, test "x$HAVE_WILDMIDI" = "xyes")
AM_CONDITIONAL(HAVE_TTA, test "x$HAVE_TTA" = "xyes")
AM_CONDITIONAL(HAVE_DCA, test "x$HAVE_DCA" = "xyes")
+AM_CONDITIONAL(HAVE_AAC, test "x$HAVE_AAC" = "xyes")
AC_SUBST(PLUGINS_DIRS)
@@ -444,7 +446,6 @@ PRINT_PLUGIN_INFO([sndfile],[PCM (wav,aiff,etc) player based on libsndfile],[tes
PRINT_PLUGIN_INFO([vtx],[vtx file player (ay8910/12 emulation)],[test "x$HAVE_VTX" = "xyes"])
PRINT_PLUGIN_INFO([adplug],[adplug player (OPL2/OPL3 emulation)],[test "x$HAVE_ADPLUG" = "xyes"])
PRINT_PLUGIN_INFO([vfs_curl],[http/ftp streaming support],[test "x$HAVE_VFS_CURL" = "xyes"])
-dnl PRINT_PLUGIN_INFO([faad2],[aac/mp4 player],[test $HAVE_FAAD && test $HAVE_MP4FF])
PRINT_PLUGIN_INFO([cdda],[cd audio player],[test "x$HAVE_CDDAPLUGIN" = "xyes"])
PRINT_PLUGIN_INFO([gtkui],[GTK user interface],[test "x$HAVE_GTK" = "xyes"])
PRINT_PLUGIN_INFO([hotkeys],[Global hotkeys support],[test "x$HAVE_HOTKEYS" = "xyes"])
@@ -459,6 +460,7 @@ PRINT_PLUGIN_INFO([musepack],[musepack player plugin],[test "x$HAVE_MUSEPACK" =
PRINT_PLUGIN_INFO([wildmidi],[WildMidi player plugin],[test "x$HAVE_WILDMIDI" = "xyes"])
PRINT_PLUGIN_INFO([tta],[TTA player plugin],[test "x$HAVE_TTA" = "xyes"])
PRINT_PLUGIN_INFO([dca],[libdca (DTS Audio) player plugin],[test "x$HAVE_DCA" = "xyes"])
+PRINT_PLUGIN_INFO([aac],[AAC player (m4a, aac, mp4) based on FAAD2],[test "x$HAVE_AAC" = "xyes"])
echo
@@ -494,6 +496,7 @@ plugins/musepack/Makefile
plugins/wildmidi/Makefile
plugins/tta/Makefile
plugins/dca/Makefile
+plugins/aac/Makefile
intl/Makefile
po/Makefile.in
deadbeef.desktop
diff --git a/decoder_template.c b/decoder_template.c
index ea9d8f43..694f8e45 100644
--- a/decoder_template.c
+++ b/decoder_template.c
@@ -92,7 +92,7 @@ example_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
// return 0 on success
// return -1 on failure
static int
-example_seek_sample (int sample) {
+example_seek_sample (DB_fileinfo_t *_info, int sample) {
example_info_t *info = (example_info_t *)_info;
info->currentsample = sample + info->startsample;
@@ -104,7 +104,7 @@ example_seek_sample (int sample) {
// return 0 on success
// return -1 on failure
static int
-example_seek (float time) {
+example_seek (DB_fileinfo_t *_info, float time) {
return example_seek_sample (time * plugin.info.samplerate);
}
diff --git a/plugins/aac/Makefile.am b/plugins/aac/Makefile.am
new file mode 100644
index 00000000..5a6e1ec7
--- /dev/null
+++ b/plugins/aac/Makefile.am
@@ -0,0 +1,9 @@
+if HAVE_AAC
+aacdir = $(libdir)/$(PACKAGE)
+pkglib_LTLIBRARIES = aac.la
+aac_la_SOURCES = aac.c
+aac_la_LDFLAGS = -module
+
+aac_la_LIBADD = $(LDADD) $(FAAD2_LIBS)
+AM_CFLAGS = $(CFLAGS) -std=c99
+endif
diff --git a/plugins/faad2/Makefile.am b/plugins/faad2/Makefile.am
deleted file mode 100644
index 963e4c7d..00000000
--- a/plugins/faad2/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-if HAVE_FAAD
-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
-endif
diff --git a/plugins/faad2/faad2.c b/plugins/faad2/faad2.c
deleted file mode 100644
index 9b30667a..00000000
--- a/plugins/faad2/faad2.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- DeaDBeeF - ultimate music player for GNU/Linux systems with X11
- Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net>
-
- 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 <string.h>
-#include <stdio.h>
-#include <neaacdec.h>
-#include <mp4ff.h>
-#include <stdlib.h>
-#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 NULL;
- }
- 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;
- deadbeef->pl_set_item_duration (it, 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.descr = "aac/mp4 player",
- .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);
-}
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 62c60bf8..447d2ebe 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -55,20 +55,20 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static const char * exts[] = { "m4a", "aac", "mp4", "mp+", "mpp", "wma", "shn", "aa3", "oma", "ac3", "vqf", NULL };
+static const char * exts[] = { "mp+", "mpp", "wma", "shn", "aa3", "oma", "ac3", "vqf", NULL };
enum {
- FT_AAC = 0,
- FT_M4A = 1,
- FT_WMA = 2,
- FT_SHORTEN = 3,
- FT_ATRAC3 = 4,
- FT_VQF = 5,
- FT_TTA = 6,
- FT_UNKNOWN = 7
+// FT_AAC = 0,
+// FT_M4A = 1,
+ FT_WMA = 0,
+ FT_SHORTEN = 1,
+ FT_ATRAC3 = 2,
+ FT_VQF = 3,
+ FT_TTA = 4,
+ FT_UNKNOWN = 5
};
-static const char *filetypes[] = { "AAC", "M4A", "WMA", "Shorten", "atrac3", "VQF", "TTA", "FFMPEG", NULL };
+static const char *filetypes[] = { "WMA", "Shorten", "atrac3", "VQF", "TTA", "FFMPEG (unknown)", NULL };
#define FF_PROTOCOL_NAME "deadbeef"
@@ -516,15 +516,15 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) {
ext++;
}
- if (!strcasecmp (ext, "m4a")) {
- filetype = filetypes[FT_M4A];
- }
- if (!strcasecmp (ext, "aac")) {
- filetype = filetypes[FT_AAC];
- }
- else if (!strcasecmp (ext, "mp4")) {
- filetype = filetypes[FT_M4A];
- }
+// if (!strcasecmp (ext, "m4a")) {
+// filetype = filetypes[FT_M4A];
+// }
+// if (!strcasecmp (ext, "aac")) {
+// filetype = filetypes[FT_AAC];
+// }
+// else if (!strcasecmp (ext, "mp4")) {
+// filetype = filetypes[FT_M4A];
+// }
else if (!strcasecmp (ext, "wma")) {
filetype = filetypes[FT_WMA];
}