ogg/opus: Infrastructure.
authorAndre Noll <maan@systemlinux.org>
Sun, 14 Oct 2012 14:17:44 +0000 (16:17 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 26 May 2013 14:26:06 +0000 (16:26 +0200)
This adds tests for libopus to configure.ac and minimal (non-working)
implementations of the ogg/opus decoder and audio format handler.

afh_common.c
configure.ac
error.h
opus_afh.c [new file with mode: 0644]
opus_common.c [new file with mode: 0644]
opus_common.h [new file with mode: 0644]
opusdec_filter.c [new file with mode: 0644]

index 6c161a7..5be4355 100644 (file)
@@ -31,6 +31,10 @@ void mp3_init(struct audio_format_handler *);
        void flac_afh_init(struct audio_format_handler *);
 #endif
 
+#ifdef HAVE_OPUS
+       void opus_afh_init(struct audio_format_handler *);
+#endif
+
 void wma_afh_init(struct audio_format_handler *);
 
 /** The list of all status items */
@@ -79,6 +83,12 @@ static struct audio_format_handler afl[] = {
                .name = "flac",
 #ifdef HAVE_FLAC
                .init = flac_afh_init,
+#endif
+       },
+       {
+               .name = "opus",
+#ifdef HAVE_OPUS
+               .init = opus_afh_init,
 #endif
        },
        {
index 135a0bd..b3f3afa 100644 (file)
@@ -554,7 +554,7 @@ if test ${have_core_audio} = yes; then
        default_writer="OSX_WRITE"
        AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
 fi
-########################################################### ogg/vorbis/speex
+####################################################### ogg/vorbis/speex/opus
 have_ogg="yes"
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LD_FLAGS="$LDFLAGS"
@@ -571,6 +571,10 @@ AC_ARG_WITH(speex_headers, [AS_HELP_STRING(--with-speex-headers=dir,
        [look for speex headers also in dir])])
 AC_ARG_WITH(speex_libs, [AS_HELP_STRING(--with-speex-libs=dir,
        [look for speex libs also in dir])])
+AC_ARG_WITH(opus_headers, [AS_HELP_STRING(--with-opus-headers=dir,
+       [look for opus headers also in dir])])
+AC_ARG_WITH(opus_libs, [AS_HELP_STRING(--with-opus-libs=dir,
+       [look for opus libs also in dir])])
 
 if test -n "$with_ogg_headers"; then
        ogg_cppflags="-I$with_ogg_headers"
@@ -585,6 +589,7 @@ AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ])
 
 have_vorbis="yes"
 have_speex="yes"
+have_opus="yes"
 if test "$have_ogg" = "yes"; then
        # vorbis
        if test -n "$with_vorbis_headers"; then
@@ -609,14 +614,29 @@ if test "$have_ogg" = "yes"; then
        fi
        AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ])
        AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ])
+
+       # opus
+       if test -n "$with_opus_headers"; then
+               opus_cppflags="-I$with_opus_headers"
+               CPPFLAGS="$CPPFLAGS $opus_cppflags"
+       fi
+       if test -n "$with_opus_libs"; then
+               speex_libs="-L$with_opus_libs"
+               LDFLAGS="$LDFLAGS $opus_libs"
+       fi
+       AC_CHECK_LIB([opus], [opus_multistream_decode], [], [ have_opus="no" ])
+       AC_CHECK_HEADERS([opus/opus.h], [], [ have_opus="no" ])
 else
-       AC_MSG_WARN([vorbis/speex depend on libogg, which was not detected])
+       AC_MSG_WARN([vorbis/speex/opus depend on libogg, which was not detected])
        have_vorbis="no"
        have_speex="no"
+       have_opus="no"
 fi
 
 msg="support in para_server/para_filter/para_afh"
-if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then
+if test "$have_vorbis" = "yes" || \
+               test "$have_speex" = "yes" || \
+               test "$have_opus" = "yes"; then
        AC_SUBST(ogg_cppflags)
        ogg_libs="$ogg_libs -logg"
        if test "$OSTYPE" = "Darwin"; then
@@ -682,6 +702,30 @@ if test "$have_speex" = "yes"; then
 else
        AC_MSG_WARN([no ogg/speex $msg])
 fi
+if test "$have_opus" = "yes"; then
+       all_errlist_objs="$all_errlist_objs opusdec_filter opus_afh opus_common"
+       AC_DEFINE(HAVE_OPUS, 1, define to 1 to turn on ogg/opus support)
+       filters="$filters opusdec"
+       opus_libs="-lopus"
+       server_ldflags="$server_ldflags $opus_libs"
+       filter_ldflags="$filter_ldflags $opus_libs"
+       audiod_ldflags="$audiod_ldflags $opus_libs"
+       afh_ldflags="$afh_ldflags $opus_libs"
+       play_ldflags="$play_ldflags $opus_libs"
+       recv_ldflags="$recv_ldflags $opus_libs"
+
+       server_errlist_objs="$server_errlist_objs opus_afh opus_common"
+       filter_errlist_objs="$filter_errlist_objs opusdec_filter opus_common"
+       audiod_errlist_objs="$audiod_errlist_objs opusdec_filter opus_common"
+       afh_errlist_objs="$afh_errlist_objs opus_afh opus_common"
+       play_errlist_objs="$play_errlist_objs opusdec_filter opus_afh opus_common"
+       recv_errlist_objs="$recv_errlist_objs opus_afh opus_common"
+
+       audiod_audio_formats="$audiod_audio_formats opus"
+       server_audio_formats="$server_audio_formats opus"
+else
+       AC_MSG_WARN([no ogg/opus $msg])
+fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
diff --git a/error.h b/error.h
index ca172cb..5307774 100644 (file)
--- a/error.h
+++ b/error.h
@@ -34,6 +34,9 @@ DEFINE_ERRLIST_OBJECT_ENUM;
 #define STDIN_ERRORS
 #define WRITE_ERRORS
 #define CHECK_WAV_ERRORS
+#define OPUSDEC_FILTER_ERRORS
+#define OPUS_AFH_ERRORS
+#define OPUS_COMMON_ERRORS
 
 extern const char **para_errlist[];
 
diff --git a/opus_afh.c b/opus_afh.c
new file mode 100644 (file)
index 0000000..880e903
--- /dev/null
@@ -0,0 +1,19 @@
+#include <ogg/ogg.h>
+#include <regex.h>
+
+#include "para.h"
+#include "afh.h"
+#include "error.h"
+#include "portable_io.h"
+#include "string.h"
+#include "opus_common.h"
+#include "ogg_afh_common.h"
+/**
+ * The init function of the ogg/opus audio format handler.
+ *
+ * \param afh Pointer to the struct to initialize.
+ */
+void opus_afh_init(struct audio_format_handler *afh)
+{
+
+}
diff --git a/opus_common.c b/opus_common.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/opus_common.h b/opus_common.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/opusdec_filter.c b/opusdec_filter.c
new file mode 100644 (file)
index 0000000..fdcb486
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
+
+/** \file opusdec_filter.c The ogg/opus decoder. */
+
+#include <regex.h>
+
+#include "para.h"
+#include "list.h"
+#include "sched.h"
+#include "ggo.h"
+#include "buffer_tree.h"
+#include "filter.h"
+#include "error.h"
+#include "string.h"
+
+/**
+ * The init function of the opusdec filter.
+ *
+ * \param f Pointer to the filter struct to initialize.
+ *
+ * \sa filter::init.
+ */
+void opusdec_filter_init(struct filter *f)
+{
+}