Blame SOURCES/alsa-plugins-1.1.6-post.patch

0bd0d3
From e8fabec7adc70220f52588dc170d90d146b92ba7 Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Thu, 5 Apr 2018 09:23:09 +0200
0bd0d3
Subject: [PATCH 1/8] samplerate: fix unused variable warning
0bd0d3
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 rate/rate_samplerate.c | 4 ++--
0bd0d3
 1 file changed, 2 insertions(+), 2 deletions(-)
0bd0d3
0bd0d3
diff --git a/rate/rate_samplerate.c b/rate/rate_samplerate.c
0bd0d3
index 0b14a59..100d6f2 100644
0bd0d3
--- a/rate/rate_samplerate.c
0bd0d3
+++ b/rate/rate_samplerate.c
0bd0d3
@@ -154,14 +154,14 @@ static void pcm_src_close(void *obj)
0bd0d3
 }
0bd0d3
 
0bd0d3
 #if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
-static int get_supported_rates(void *obj, unsigned int *rate_min,
0bd0d3
+static int get_supported_rates(void *obj ATTRIBUTE_UNUSED, unsigned int *rate_min,
0bd0d3
 			       unsigned int *rate_max)
0bd0d3
 {
0bd0d3
 	*rate_min = *rate_max = 0; /* both unlimited */
0bd0d3
 	return 0;
0bd0d3
 }
0bd0d3
 
0bd0d3
-static void dump(void *obj, snd_output_t *out)
0bd0d3
+static void dump(void *obj ATTRIBUTE_UNUSED, snd_output_t *out)
0bd0d3
 {
0bd0d3
 	snd_output_printf(out, "Converter: libsamplerate\n");
0bd0d3
 }
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From 6e40eb5fd346207021a95d06bc30205a537926ea Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Wed, 4 Apr 2018 19:57:56 +0200
0bd0d3
Subject: [PATCH 2/8] configure: add --with-alsaaddondir, add default config
0bd0d3
 files for plugins
0bd0d3
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 a52/60-a52-encoder.conf       | 38 ++++++++++++++++++++++++++
0bd0d3
 a52/Makefile.am               |  4 +++
0bd0d3
 a52/pcm_a52.c                 |  2 +-
0bd0d3
 arcam-av/50-arcam-av-ctl.conf | 16 +++++++++++
0bd0d3
 arcam-av/Makefile.am          |  4 +++
0bd0d3
 configure.ac                  | 12 +++++++++
0bd0d3
 jack/50-jack.conf             | 18 +++++++++++++
0bd0d3
 jack/Makefile.am              |  4 +++
0bd0d3
 maemo/98-maemo.conf           | 11 ++++++++
0bd0d3
 maemo/Makefile.am             |  4 +++
0bd0d3
 mix/60-upmix.conf             | 26 ++++++++++++++++++
0bd0d3
 mix/60-vdownmix.conf          | 24 +++++++++++++++++
0bd0d3
 mix/Makefile.am               |  5 +++-
0bd0d3
 oss/50-oss.conf               | 26 ++++++++++++++++++
0bd0d3
 oss/Makefile.am               |  4 +++
0bd0d3
 pph/10-speexrate.conf         | 28 +++++++++++++++++++
0bd0d3
 pph/Makefile.am               |  4 +++
0bd0d3
 pulse/50-pulseaudio.conf      | 15 ++++++-----
0bd0d3
 pulse/Makefile.am             |  4 +--
0bd0d3
 rate-lavc/10-rate-lavc.conf   | 28 +++++++++++++++++++
0bd0d3
 rate-lavc/Makefile.am         |  4 +++
0bd0d3
 rate/10-samplerate.conf       | 28 +++++++++++++++++++
0bd0d3
 rate/Makefile.am              |  4 +++
0bd0d3
 speex/60-speex.conf           | 63 +++++++++++++++++++++++++++++++++++++++++++
0bd0d3
 speex/Makefile.am             |  4 +++
0bd0d3
 usb_stream/98-usb-stream.conf | 27 +++++++++++++++++++
0bd0d3
 usb_stream/Makefile.am        |  4 +++
0bd0d3
 27 files changed, 401 insertions(+), 10 deletions(-)
0bd0d3
 create mode 100644 a52/60-a52-encoder.conf
0bd0d3
 create mode 100644 arcam-av/50-arcam-av-ctl.conf
0bd0d3
 create mode 100644 jack/50-jack.conf
0bd0d3
 create mode 100644 maemo/98-maemo.conf
0bd0d3
 create mode 100644 mix/60-upmix.conf
0bd0d3
 create mode 100644 mix/60-vdownmix.conf
0bd0d3
 create mode 100644 oss/50-oss.conf
0bd0d3
 create mode 100644 pph/10-speexrate.conf
0bd0d3
 create mode 100644 rate-lavc/10-rate-lavc.conf
0bd0d3
 create mode 100644 rate/10-samplerate.conf
0bd0d3
 create mode 100644 speex/60-speex.conf
0bd0d3
 create mode 100644 usb_stream/98-usb-stream.conf
0bd0d3
0bd0d3
diff --git a/a52/60-a52-encoder.conf b/a52/60-a52-encoder.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..346c94f
0bd0d3
--- /dev/null
0bd0d3
+++ b/a52/60-a52-encoder.conf
0bd0d3
@@ -0,0 +1,38 @@
0bd0d3
+pcm.a52 {
0bd0d3
+	@args [ CARD SLAVE RATE BITRATE CHANNELS ]
0bd0d3
+	@args.CARD {
0bd0d3
+		type integer
0bd0d3
+		default {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.pcm.card
0bd0d3
+		}
0bd0d3
+	}
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+	}
0bd0d3
+	@args.RATE {
0bd0d3
+		type integer
0bd0d3
+		default 48000
0bd0d3
+	}
0bd0d3
+	@args.BITRATE {
0bd0d3
+		type integer
0bd0d3
+		default 448
0bd0d3
+	}
0bd0d3
+	@args.CHANNELS {
0bd0d3
+		type string
0bd0d3
+		default 6
0bd0d3
+	}
0bd0d3
+	type a52
0bd0d3
+	card $CARD
0bd0d3
+	slavepcm $SLAVE
0bd0d3
+	rate $RATE
0bd0d3
+	bitrate $BITRATE
0bd0d3
+	channels $CHANNELS
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Plugin to convert multichannel stream to A52 (AC3) bitstream"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/a52/Makefile.am b/a52/Makefile.am
0bd0d3
index 48567b4..cbc1497 100644
0bd0d3
--- a/a52/Makefile.am
0bd0d3
+++ b/a52/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 60-a52-encoder.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_a52_LTLIBRARIES = libasound_module_pcm_a52.la
0bd0d3
+asound_module_addon_DATA = 60-a52-encoder.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_a52dir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @AVCODEC_CFLAGS@ \
0bd0d3
 	-DAVCODEC_HEADER="@AVCODEC_HEADER@"
0bd0d3
diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
0bd0d3
index 348d58f..155da36 100644
0bd0d3
--- a/a52/pcm_a52.c
0bd0d3
+++ b/a52/pcm_a52.c
0bd0d3
@@ -937,7 +937,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(a52)
0bd0d3
 		goto error;
0bd0d3
 	}
0bd0d3
 
0bd0d3
-	if (! pcm_string) {
0bd0d3
+	if (! pcm_string || pcm_string[0] == '\0') {
0bd0d3
 		snprintf(devstr, sizeof(devstr),
0bd0d3
 			 "iec958:{AES0 0x%x AES1 0x%x AES2 0x%x AES3 0x%x %s%s}",
0bd0d3
 			 IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO |
0bd0d3
diff --git a/arcam-av/50-arcam-av-ctl.conf b/arcam-av/50-arcam-av-ctl.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..b76caa9
0bd0d3
--- /dev/null
0bd0d3
+++ b/arcam-av/50-arcam-av-ctl.conf
0bd0d3
@@ -0,0 +1,16 @@
0bd0d3
+ctl.arcam_av {
0bd0d3
+	@args [ PORT ]
0bd0d3
+	@args.PORT {
0bd0d3
+		type string
0bd0d3
+		default "/dev/ttyUSB0"
0bd0d3
+	}
0bd0d3
+	type arcam_av
0bd0d3
+	port $PORT
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+		description "Arcam-AV Amplifier"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/arcam-av/Makefile.am b/arcam-av/Makefile.am
0bd0d3
index 5c7855f..4a54ccd 100644
0bd0d3
--- a/arcam-av/Makefile.am
0bd0d3
+++ b/arcam-av/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 50-arcam-av-ctl.conf
0bd0d3
+
0bd0d3
 asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
0bd0d3
+asound_module_addon_DATA = 50-arcam-av-ctl.conf
0bd0d3
 
0bd0d3
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
0bd0d3
diff --git a/configure.ac b/configure.ac
0bd0d3
index ecc265b..ae98caa 100644
0bd0d3
--- a/configure.ac
0bd0d3
+++ b/configure.ac
0bd0d3
@@ -206,6 +206,18 @@ AC_DEFINE_UNQUOTED(ALSA_DATA_DIR, "$alsadatadir", [directory containing ALSA dat
0bd0d3
 ALSA_DATA_DIR="$alsadatadir"
0bd0d3
 AC_SUBST(ALSA_DATA_DIR)
0bd0d3
 
0bd0d3
+dnl ALSA add-on config directory
0bd0d3
+AC_ARG_WITH(alsaaddondir,
0bd0d3
+    AS_HELP_STRING([--with-alsaaddondir=dir],
0bd0d3
+	[path where ALSA add-on config files are stored]),
0bd0d3
+    alsaaddondir="$withval", alsaaddondir="")
0bd0d3
+if test -z "$alsaaddondir"; then
0bd0d3
+    alsaaddondir="/etc/alsa/conf.d"
0bd0d3
+fi
0bd0d3
+AC_DEFINE_UNQUOTED(ALSA_ADDON_DIR, "$alsaaddondir", [directory containing ALSA add-on config files])
0bd0d3
+ALSA_ADDON_DIR="$alsaaddondir"
0bd0d3
+AC_SUBST(ALSA_ADDON_DIR)
0bd0d3
+
0bd0d3
 SAVE_PLUGINS_VERSION
0bd0d3
 
0bd0d3
 AC_OUTPUT([
0bd0d3
diff --git a/jack/50-jack.conf b/jack/50-jack.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..d780dfc
0bd0d3
--- /dev/null
0bd0d3
+++ b/jack/50-jack.conf
0bd0d3
@@ -0,0 +1,18 @@
0bd0d3
+pcm.jack {
0bd0d3
+	type jack
0bd0d3
+	playback_ports {
0bd0d3
+		0 alsa_pcm:playback_1
0bd0d3
+		1 alsa_pcm:playback_2
0bd0d3
+	}
0bd0d3
+	capture_ports {
0bd0d3
+		0 alsa_pcm:capture_1
0bd0d3
+		1 alsa_pcm:capture_2
0bd0d3
+	}
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+		description "JACK Audio Connection Kit"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/jack/Makefile.am b/jack/Makefile.am
0bd0d3
index f913cb6..0a3d6ae 100644
0bd0d3
--- a/jack/Makefile.am
0bd0d3
+++ b/jack/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 50-jack.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_jack_LTLIBRARIES = libasound_module_pcm_jack.la
0bd0d3
+asound_module_addon_DATA = 50-jack.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_jackdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @JACK_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/maemo/98-maemo.conf b/maemo/98-maemo.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..a9ad6a0
0bd0d3
--- /dev/null
0bd0d3
+++ b/maemo/98-maemo.conf
0bd0d3
@@ -0,0 +1,11 @@
0bd0d3
+pcm.!default {
0bd0d3
+	type alsa_dsp
0bd0d3
+	playback_device_file [ "/dev/dsptask/pcm2" ]
0bd0d3
+	recording_device_file [ "/dev/dsptask/pcm_rec" ]
0bd0d3
+}
0bd0d3
+
0bd0d3
+ctl.!default {
0bd0d3
+	type dsp_ctl
0bd0d3
+	playback_devices [ "/dev/dsptask/pcm2" ]
0bd0d3
+	recording_devices [ "/dev/dsptask/pcm_rec" ]
0bd0d3
+}
0bd0d3
diff --git a/maemo/Makefile.am b/maemo/Makefile.am
0bd0d3
index 2684781..aca481d 100644
0bd0d3
--- a/maemo/Makefile.am
0bd0d3
+++ b/maemo/Makefile.am
0bd0d3
@@ -1,8 +1,12 @@
0bd0d3
+EXTRA_DIST = 98-maemo.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_alsa_dsp_LTLIBRARIES = libasound_module_pcm_alsa_dsp.la
0bd0d3
 asound_module_ctl_dsp_ctl_LTLIBRARIES = libasound_module_ctl_dsp_ctl.la
0bd0d3
+asound_module_addon_DATA = 98-maemo.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_alsa_dspdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctl_dsp_ctldir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -O2 @ALSA_CFLAGS@ $(DBUS_CFLAGS)
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/mix/60-upmix.conf b/mix/60-upmix.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..028cfe1
0bd0d3
--- /dev/null
0bd0d3
+++ b/mix/60-upmix.conf
0bd0d3
@@ -0,0 +1,26 @@
0bd0d3
+pcm.upmix {
0bd0d3
+	@args [ SLAVE CHANNELS DELAY ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.CHANNELS {
0bd0d3
+		type integer
0bd0d3
+		default 6
0bd0d3
+	}
0bd0d3
+	@args.DELAY {
0bd0d3
+		type integer
0bd0d3
+		default 0
0bd0d3
+	}
0bd0d3
+	type upmix
0bd0d3
+	channels $CHANNELS
0bd0d3
+	delay $DELAY
0bd0d3
+	slave.pcm $SLAVE
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Plugin for channel upmix (4,6,8)"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/mix/60-vdownmix.conf b/mix/60-vdownmix.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..32e9c56
0bd0d3
--- /dev/null
0bd0d3
+++ b/mix/60-vdownmix.conf
0bd0d3
@@ -0,0 +1,24 @@
0bd0d3
+pcm.vdownmix {
0bd0d3
+	@args [ SLAVE CHANNELS DELAY ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.CHANNELS {
0bd0d3
+		type integer
0bd0d3
+		default 6
0bd0d3
+	}
0bd0d3
+	@args.DELAY {
0bd0d3
+		type integer
0bd0d3
+		default 0
0bd0d3
+	}
0bd0d3
+	type vdownmix
0bd0d3
+	slave.pcm $SLAVE
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Plugin for channel downmix (stereo) with a simple spacialization"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/mix/Makefile.am b/mix/Makefile.am
0bd0d3
index e31839a..710606c 100644
0bd0d3
--- a/mix/Makefile.am
0bd0d3
+++ b/mix/Makefile.am
0bd0d3
@@ -1,8 +1,12 @@
0bd0d3
+EXTRA_DIST = 60-upmix.conf 60-vdownmix.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_upmix_LTLIBRARIES = libasound_module_pcm_upmix.la
0bd0d3
 asound_module_pcm_vdownmix_LTLIBRARIES = libasound_module_pcm_vdownmix.la
0bd0d3
+asound_module_addon_DATA = 60-upmix.conf 60-vdownmix.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_upmixdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_pcm_vdownmixdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -11,4 +15,3 @@ libasound_module_pcm_upmix_la_SOURCES = pcm_upmix.c
0bd0d3
 libasound_module_pcm_upmix_la_LIBADD = @ALSA_LIBS@
0bd0d3
 libasound_module_pcm_vdownmix_la_SOURCES = pcm_vdownmix.c
0bd0d3
 libasound_module_pcm_vdownmix_la_LIBADD = @ALSA_LIBS@
0bd0d3
-
0bd0d3
diff --git a/oss/50-oss.conf b/oss/50-oss.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..5b2817b
0bd0d3
--- /dev/null
0bd0d3
+++ b/oss/50-oss.conf
0bd0d3
@@ -0,0 +1,26 @@
0bd0d3
+pcm.oss {
0bd0d3
+	@args [ DEVICE ]
0bd0d3
+	@args.DEVICE {
0bd0d3
+		type string
0bd0d3
+		default "/dev/dsp"
0bd0d3
+	}
0bd0d3
+	type oss
0bd0d3
+	port $DEVICE
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+		description "Open Sound System"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
+
0bd0d3
+ctl.oss {
0bd0d3
+	@args [ DEVICE ]
0bd0d3
+	@args.DEVICE {
0bd0d3
+		type string
0bd0d3
+		default "/dev/mixer"
0bd0d3
+	}
0bd0d3
+	type oss
0bd0d3
+	device $DEVICE
0bd0d3
+}
0bd0d3
diff --git a/oss/Makefile.am b/oss/Makefile.am
0bd0d3
index 302538b..df83d20 100644
0bd0d3
--- a/oss/Makefile.am
0bd0d3
+++ b/oss/Makefile.am
0bd0d3
@@ -1,8 +1,12 @@
0bd0d3
+EXTRA_DIST = 50-oss.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_oss_LTLIBRARIES = libasound_module_pcm_oss.la
0bd0d3
 asound_module_ctl_oss_LTLIBRARIES = libasound_module_ctl_oss.la
0bd0d3
+asound_module_addon_DATA = 50-oss.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_ossdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctl_ossdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/pph/10-speexrate.conf b/pph/10-speexrate.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..1d9eae9
0bd0d3
--- /dev/null
0bd0d3
+++ b/pph/10-speexrate.conf
0bd0d3
@@ -0,0 +1,28 @@
0bd0d3
+pcm.speexrate {
0bd0d3
+	@args [ SLAVE RATE CONVERTER ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.RATE {
0bd0d3
+		type integer
0bd0d3
+		default 48000
0bd0d3
+	}
0bd0d3
+	@args.CONVERTER {
0bd0d3
+		type string
0bd0d3
+		default "speexrate"
0bd0d3
+	}
0bd0d3
+	type rate
0bd0d3
+	converter $CONVERTER
0bd0d3
+	slave {
0bd0d3
+		pcm $SLAVE
0bd0d3
+		rate $RATE
0bd0d3
+	}
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Rate Converter Plugin Using Speex Resampler"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/pph/Makefile.am b/pph/Makefile.am
0bd0d3
index 551e5bd..abb950b 100644
0bd0d3
--- a/pph/Makefile.am
0bd0d3
+++ b/pph/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 10-speexrate.conf
0bd0d3
+
0bd0d3
 asound_module_rate_speexrate_LTLIBRARIES = libasound_module_rate_speexrate.la
0bd0d3
+asound_module_addon_DATA = 10-speexrate.conf
0bd0d3
 
0bd0d3
 asound_module_rate_speexratedir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -DVAR_ARRAYS -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/pulse/50-pulseaudio.conf b/pulse/50-pulseaudio.conf
0bd0d3
index dd85dab..62da207 100644
0bd0d3
--- a/pulse/50-pulseaudio.conf
0bd0d3
+++ b/pulse/50-pulseaudio.conf
0bd0d3
@@ -1,13 +1,16 @@
0bd0d3
 # Add a specific named PulseAudio pcm and ctl (typically useful for testing)
0bd0d3
 
0bd0d3
 pcm.pulse {
0bd0d3
-    type pulse
0bd0d3
-    hint {
0bd0d3
-        show on
0bd0d3
-        description "PulseAudio Sound Server"
0bd0d3
-    }
0bd0d3
+	type pulse
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+		description "PulseAudio Sound Server"
0bd0d3
+	}
0bd0d3
 }
0bd0d3
 
0bd0d3
 ctl.pulse {
0bd0d3
-    type pulse
0bd0d3
+	type pulse
0bd0d3
 }
0bd0d3
diff --git a/pulse/Makefile.am b/pulse/Makefile.am
0bd0d3
index a5550b9..835808c 100644
0bd0d3
--- a/pulse/Makefile.am
0bd0d3
+++ b/pulse/Makefile.am
0bd0d3
@@ -3,12 +3,12 @@ EXTRA_DIST = 50-pulseaudio.conf 99-pulseaudio-default.conf.example
0bd0d3
 asound_module_pcm_LTLIBRARIES = libasound_module_pcm_pulse.la
0bd0d3
 asound_module_ctl_LTLIBRARIES = libasound_module_ctl_pulse.la
0bd0d3
 asound_module_conf_LTLIBRARIES = libasound_module_conf_pulse.la
0bd0d3
-asound_module_data_DATA = 50-pulseaudio.conf 99-pulseaudio-default.conf.example
0bd0d3
+asound_module_addon_DATA = 50-pulseaudio.conf 99-pulseaudio-default.conf.example
0bd0d3
 
0bd0d3
 asound_module_pcmdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctldir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_confdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_datadir = @ALSA_DATA_DIR@/alsa.conf.d
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(PTHREAD_CFLAGS) $(pulseaudio_CFLAGS) -D_GNU_SOURCE
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/rate-lavc/10-rate-lavc.conf b/rate-lavc/10-rate-lavc.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..bab1694
0bd0d3
--- /dev/null
0bd0d3
+++ b/rate-lavc/10-rate-lavc.conf
0bd0d3
@@ -0,0 +1,28 @@
0bd0d3
+pcm.lavcrate {
0bd0d3
+	@args [ SLAVE RATE CONVERTER ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.RATE {
0bd0d3
+		type integer
0bd0d3
+		default 48000
0bd0d3
+	}
0bd0d3
+	@args.CONVERTER {
0bd0d3
+		type string
0bd0d3
+		default "lavcrate"
0bd0d3
+	}
0bd0d3
+	type rate
0bd0d3
+	converter $CONVERTER
0bd0d3
+	slave {
0bd0d3
+		pcm $SLAVE
0bd0d3
+		rate $RATE
0bd0d3
+	}
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Rate Converter Plugin Using AVC Library"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/rate-lavc/Makefile.am b/rate-lavc/Makefile.am
0bd0d3
index 5cffd44..5f66472 100644
0bd0d3
--- a/rate-lavc/Makefile.am
0bd0d3
+++ b/rate-lavc/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 10-rate-lavc.conf
0bd0d3
+
0bd0d3
 asound_module_rate_lavcrate_LTLIBRARIES = libasound_module_rate_lavcrate.la
0bd0d3
+asound_module_addon_DATA = 10-rate-lavc.conf
0bd0d3
 
0bd0d3
 asound_module_rate_lavcratedir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @AVCODEC_CFLAGS@ \
0bd0d3
 	-DAVCODEC_HEADER="@AVCODEC_HEADER@"
0bd0d3
diff --git a/rate/10-samplerate.conf b/rate/10-samplerate.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..0d2e604
0bd0d3
--- /dev/null
0bd0d3
+++ b/rate/10-samplerate.conf
0bd0d3
@@ -0,0 +1,28 @@
0bd0d3
+pcm.samplerate {
0bd0d3
+	@args [ SLAVE RATE CONVERTER ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.RATE {
0bd0d3
+		type integer
0bd0d3
+		default 48000
0bd0d3
+	}
0bd0d3
+	@args.CONVERTER {
0bd0d3
+		type string
0bd0d3
+		default "samplerate"
0bd0d3
+	}
0bd0d3
+	type rate
0bd0d3
+	converter $CONVERTER
0bd0d3
+	slave {
0bd0d3
+		pcm $SLAVE
0bd0d3
+		rate $RATE
0bd0d3
+	}
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Rate Converter Plugin Using Samplerate Library"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/rate/Makefile.am b/rate/Makefile.am
0bd0d3
index 0605bfd..25014d8 100644
0bd0d3
--- a/rate/Makefile.am
0bd0d3
+++ b/rate/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 10-samplerate.conf
0bd0d3
+
0bd0d3
 asound_module_rate_samplerate_LTLIBRARIES = libasound_module_rate_samplerate.la
0bd0d3
+asound_module_addon_DATA = 10-samplerate.conf
0bd0d3
 
0bd0d3
 asound_module_rate_sampleratedir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(samplerate_CFLAGS)
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/speex/60-speex.conf b/speex/60-speex.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..bf2ce95
0bd0d3
--- /dev/null
0bd0d3
+++ b/speex/60-speex.conf
0bd0d3
@@ -0,0 +1,63 @@
0bd0d3
+pcm.speex {
0bd0d3
+	@args [ SLAVE AGC AGC_LEVEL DENOISE ECHO
0bd0d3
+                DEREVERB DEREVERB_DECAY DEREVERB_LEVEL
0bd0d3
+                FRAMES FILTER_LENGTH ]
0bd0d3
+	@args.SLAVE {
0bd0d3
+		type string
0bd0d3
+		default "plug:hw"
0bd0d3
+	}
0bd0d3
+	@args.AGC {
0bd0d3
+		type string
0bd0d3
+		default off
0bd0d3
+	}
0bd0d3
+	@args.AGC_LEVEL {
0bd0d3
+		type integer
0bd0d3
+		default 8000
0bd0d3
+	}
0bd0d3
+	@args.DENOISE {
0bd0d3
+		type string
0bd0d3
+		default on
0bd0d3
+	}
0bd0d3
+	@args.ECHO {
0bd0d3
+		type string
0bd0d3
+		default off
0bd0d3
+	}
0bd0d3
+	@args.DEREVERB {
0bd0d3
+		type string
0bd0d3
+		default off
0bd0d3
+	}
0bd0d3
+	@args.DEREVERB_DECAY {
0bd0d3
+		type real
0bd0d3
+		default 0
0bd0d3
+	}
0bd0d3
+	@args.DEREVERB_LEVEL {
0bd0d3
+		type real
0bd0d3
+		default 0
0bd0d3
+	}
0bd0d3
+	@args.FRAMES {
0bd0d3
+		type integer
0bd0d3
+		default 64
0bd0d3
+	}
0bd0d3
+	@args.FILTER_LENGTH {
0bd0d3
+		type integer
0bd0d3
+		default 256
0bd0d3
+	}
0bd0d3
+	type speex
0bd0d3
+	agc $AGC
0bd0d3
+	agc_level $AGC_LEVEL
0bd0d3
+	denoise $DENOISE
0bd0d3
+	echo $ECHO
0bd0d3
+	dereverb $DEREVERB
0bd0d3
+	dereverb_decay $DEREVERB_DECAY
0bd0d3
+	dereverb_level $DEREVERB_LEVEL
0bd0d3
+	frames $FRAMES
0bd0d3
+	filter_length $FILTER_LENGTH
0bd0d3
+	slave.pcm $SLAVE
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/speex/Makefile.am b/speex/Makefile.am
0bd0d3
index 7d84190..7891954 100644
0bd0d3
--- a/speex/Makefile.am
0bd0d3
+++ b/speex/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 60-speex.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_speex_LTLIBRARIES = libasound_module_pcm_speex.la
0bd0d3
+asound_module_addon_DATA = 60-speex.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_speexdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @speexdsp_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
diff --git a/usb_stream/98-usb-stream.conf b/usb_stream/98-usb-stream.conf
0bd0d3
new file mode 100644
0bd0d3
index 0000000..2efc95f
0bd0d3
--- /dev/null
0bd0d3
+++ b/usb_stream/98-usb-stream.conf
0bd0d3
@@ -0,0 +1,27 @@
0bd0d3
+pcm.usbstream {
0bd0d3
+	@args [ CARD RATE PERIOD_SIZE ]
0bd0d3
+	@args.CARD {
0bd0d3
+		type string
0bd0d3
+		default {
0bd0d3
+			func refer
0bd0d3
+			name defaults.pcm.card
0bd0d3
+		}
0bd0d3
+	}
0bd0d3
+	@args.RATE {
0bd0d3
+		type integer
0bd0d3
+	}
0bd0d3
+	@args.PERIOD_SIZE {
0bd0d3
+		type integer
0bd0d3
+	}
0bd0d3
+	type usb_stream
0bd0d3
+	card $CARD
0bd0d3
+	rate $RATE
0bd0d3
+	period_size $PERIOD_SIZE
0bd0d3
+	hint {
0bd0d3
+		show {
0bd0d3
+			@func refer
0bd0d3
+			name defaults.namehint.basic
0bd0d3
+		}
0bd0d3
+                description "USB Stream Output"
0bd0d3
+	}
0bd0d3
+}
0bd0d3
diff --git a/usb_stream/Makefile.am b/usb_stream/Makefile.am
0bd0d3
index 50a98a0..b606d3d 100644
0bd0d3
--- a/usb_stream/Makefile.am
0bd0d3
+++ b/usb_stream/Makefile.am
0bd0d3
@@ -1,6 +1,10 @@
0bd0d3
+EXTRA_DIST = 98-usb-stream.conf
0bd0d3
+
0bd0d3
 asound_module_pcm_usb_stream_LTLIBRARIES = libasound_module_pcm_usb_stream.la
0bd0d3
+asound_module_addon_DATA = 98-usb-stream.conf
0bd0d3
 
0bd0d3
 asound_module_pcm_usb_streamdir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic $(LDFLAGS_NOUNDEFINED)
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From cc6bed233a3167d806834460befca2c6d655f0fb Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Fri, 13 Apr 2018 13:37:36 +0200
0bd0d3
Subject: [PATCH 3/8] config/Makefile: make everything modular
0bd0d3
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 Makefile.am     | 21 ++++++++++++++++++---
0bd0d3
 configure.ac    | 20 +++++++++++++++++++-
0bd0d3
 doc/Makefile.am | 37 ++++++++++++++++++++++++++++++++++---
0bd0d3
 3 files changed, 71 insertions(+), 7 deletions(-)
0bd0d3
0bd0d3
diff --git a/Makefile.am b/Makefile.am
0bd0d3
index 69cfe0d..303bc83 100644
0bd0d3
--- a/Makefile.am
0bd0d3
+++ b/Makefile.am
0bd0d3
@@ -1,4 +1,10 @@
0bd0d3
-SUBDIRS = oss mix usb_stream arcam-av doc
0bd0d3
+SUBDIRS = doc
0bd0d3
+if HAVE_OSS
0bd0d3
+SUBDIRS += oss
0bd0d3
+endif
0bd0d3
+if HAVE_MIX
0bd0d3
+SUBDIRS += mix
0bd0d3
+endif
0bd0d3
 if HAVE_JACK
0bd0d3
 SUBDIRS += jack
0bd0d3
 endif
0bd0d3
@@ -8,8 +14,17 @@ endif
0bd0d3
 if HAVE_SAMPLERATE
0bd0d3
 SUBDIRS += rate
0bd0d3
 endif
0bd0d3
-if HAVE_AVCODEC
0bd0d3
-SUBDIRS += a52 rate-lavc
0bd0d3
+if HAVE_A52
0bd0d3
+SUBDIRS += a52
0bd0d3
+endif
0bd0d3
+if HAVE_AVCRATE
0bd0d3
+SUBDIRS += rate-lavc
0bd0d3
+endif
0bd0d3
+if HAVE_USBSTREAM
0bd0d3
+SUBDIRS += usb_stream
0bd0d3
+endif
0bd0d3
+if HAVE_ARCAMAV
0bd0d3
+SUBDIRS += arcam-av
0bd0d3
 endif
0bd0d3
 if HAVE_MAEMO_PLUGIN
0bd0d3
 SUBDIRS += maemo
0bd0d3
diff --git a/configure.ac b/configure.ac
0bd0d3
index ae98caa..2d7e6aa 100644
0bd0d3
--- a/configure.ac
0bd0d3
+++ b/configure.ac
0bd0d3
@@ -135,6 +135,22 @@ AC_SUBST(AVCODEC_CFLAGS)
0bd0d3
 AC_SUBST(AVCODEC_LIBS)
0bd0d3
 AC_SUBST(AVCODEC_HEADER)
0bd0d3
 
0bd0d3
+AC_ARG_ENABLE([a52],
0bd0d3
+      AS_HELP_STRING([--disable-a52], [Disable building of A52 encoder plugin]))
0bd0d3
+
0bd0d3
+if test "x$enable_a52" != "xno" -a "$HAVE_AVCODEC" = "yes"; then
0bd0d3
+  HAVE_A52=yes
0bd0d3
+fi
0bd0d3
+AM_CONDITIONAL(HAVE_A52, test x$HAVE_A52 = xyes)
0bd0d3
+
0bd0d3
+AC_ARG_ENABLE([avcrate],
0bd0d3
+      AS_HELP_STRING([--disable-avcrate], [Disable building of AVC rate plugin]))
0bd0d3
+
0bd0d3
+if test "x$enable_avcrate" != "xno" -a "$HAVE_AVCODEC" = "yes"; then
0bd0d3
+  HAVE_AVCRATE=yes
0bd0d3
+fi
0bd0d3
+AM_CONDITIONAL(HAVE_AVCRATE, test x$HAVE_AVCRATE = xyes)
0bd0d3
+
0bd0d3
 AC_ARG_ENABLE([speexdsp],
0bd0d3
       AS_HELP_STRING([--disable-speexdsp], [Disable building of speexdsp plugin]))
0bd0d3
 
0bd0d3
@@ -260,12 +276,14 @@ if test "$HAVE_SAMPLERATE" = "yes"; then
0bd0d3
 fi
0bd0d3
 echo "Maemo plugin:       $HAVE_MAEMO_PLUGIN"
0bd0d3
 echo "  Using Osso resource manager: $use_maemo_rm"
0bd0d3
-echo "A52, lavc plugins:  $HAVE_AVCODEC"
0bd0d3
 if test "$HAVE_AVCODEC" = "yes"; then
0bd0d3
+  echo "AVCodec config:"
0bd0d3
   echo "  AVCODEC_CFLAGS: $AVCODEC_CFLAGS"
0bd0d3
   echo "  AVCODEC_LIBS: $AVCODEC_LIBS"
0bd0d3
   echo "  AVCODEC_HEADER: $AVCODEC_HEADER"
0bd0d3
 fi
0bd0d3
+echo "A52 plugin:         $HAVE_A52"
0bd0d3
+echo "AVC rate plugin:    $HAVE_AVCRATE"
0bd0d3
 echo "Speex rate plugin:  $PPH"
0bd0d3
 echo "Speex preprocess plugin:  $HAVE_SPEEXDSP"
0bd0d3
 if test "$HAVE_SPEEX" = "yes"; then
0bd0d3
diff --git a/doc/Makefile.am b/doc/Makefile.am
0bd0d3
index 19fa0d2..0d6f6e5 100644
0bd0d3
--- a/doc/Makefile.am
0bd0d3
+++ b/doc/Makefile.am
0bd0d3
@@ -1,4 +1,35 @@
0bd0d3
-EXTRA_DIST = README-pcm-oss README-jack README-pulse README-maemo \
0bd0d3
-	upmix.txt vdownmix.txt samplerate.txt a52.txt lavcrate.txt \
0bd0d3
-	speexrate.txt speexdsp.txt README-arcam-av
0bd0d3
+EXTRA_DIST =
0bd0d3
 
0bd0d3
+if HAVE_OSS
0bd0d3
+EXTRA_DIST += README-pcm-oss
0bd0d3
+endif
0bd0d3
+if HAVE_MIX
0bd0d3
+EXTRA_DIST += upmix.txt vdownmix.txt
0bd0d3
+endif
0bd0d3
+if HAVE_JACK
0bd0d3
+EXTRA_DIST += README-jack
0bd0d3
+endif
0bd0d3
+if HAVE_PULSE
0bd0d3
+EXTRA_DIST += README-pulse
0bd0d3
+endif
0bd0d3
+if HAVE_MAEMO_PLUGIN
0bd0d3
+EXTRA_DIST += README-maemo
0bd0d3
+endif
0bd0d3
+if HAVE_SAMPLERATE
0bd0d3
+EXTRA_DIST += samplerate.txt
0bd0d3
+endif
0bd0d3
+if HAVE_A52
0bd0d3
+EXTRA_DIST += a52.txt
0bd0d3
+endif
0bd0d3
+if HAVE_AVCRATE
0bd0d3
+EXTRA_DIST += lavcrate.txt
0bd0d3
+endif
0bd0d3
+if HAVE_PPH
0bd0d3
+EXTRA_DIST += speexrate.txt
0bd0d3
+endif
0bd0d3
+if HAVE_SPEEXDSP
0bd0d3
+EXTRA_DIST += speexdsp.txt
0bd0d3
+endif
0bd0d3
+if HAVE_ARCAMAV
0bd0d3
+EXTRA_DIST += README-arcam-av
0bd0d3
+endif
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From 24db7f59d76984e2901f2834a297735853cab776 Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Mon, 16 Apr 2018 16:24:29 +0200
0bd0d3
Subject: [PATCH 4/8] Move rate-lavc to rate-lav subdirectory and update to use
0bd0d3
 libavresample
0bd0d3
0bd0d3
- --disable-avcodec renamed to --disable-libav
0bd0d3
- --avcodec-includedir renamed to --libav-includedir
0bd0d3
- --avcodec-libdir renamed to --libav-libdir
0bd0d3
- --disable-lavcrate renamed to --disable-lavrate
0bd0d3
0bd0d3
The .c changes are from Anton Khirnov. The rest is from Jaroslav Kysela.
0bd0d3
0bd0d3
From: Anton Khirnov
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 Makefile.am                                        |   4 +-
0bd0d3
 a52/Makefile.am                                    |   5 +-
0bd0d3
 a52/pcm_a52.c                                      |   2 +-
0bd0d3
 configure.ac                                       |  85 +++---
0bd0d3
 doc/Makefile.am                                    |   4 +-
0bd0d3
 doc/{lavcrate.txt => lavrate.txt}                  |  10 +-
0bd0d3
 .../10-rate-lavc.conf => rate-lav/10-rate-lav.conf |   6 +-
0bd0d3
 rate-lav/Makefile.am                               |  25 ++
0bd0d3
 {rate-lavc => rate-lav}/gcd.h                      |   0
0bd0d3
 rate-lav/rate_lavrate.c                            | 235 +++++++++++++++++
0bd0d3
 rate-lavc/Makefile.am                              |  26 --
0bd0d3
 rate-lavc/rate_lavcrate.c                          | 291 ---------------------
0bd0d3
 12 files changed, 311 insertions(+), 382 deletions(-)
0bd0d3
 rename doc/{lavcrate.txt => lavrate.txt} (76%)
0bd0d3
 rename rate-lavc/10-rate-lavc.conf => rate-lav/10-rate-lav.conf (73%)
0bd0d3
 create mode 100644 rate-lav/Makefile.am
0bd0d3
 rename {rate-lavc => rate-lav}/gcd.h (100%)
0bd0d3
 create mode 100644 rate-lav/rate_lavrate.c
0bd0d3
 delete mode 100644 rate-lavc/Makefile.am
0bd0d3
 delete mode 100644 rate-lavc/rate_lavcrate.c
0bd0d3
0bd0d3
diff --git a/Makefile.am b/Makefile.am
0bd0d3
index 303bc83..27f61a4 100644
0bd0d3
--- a/Makefile.am
0bd0d3
+++ b/Makefile.am
0bd0d3
@@ -17,8 +17,8 @@ endif
0bd0d3
 if HAVE_A52
0bd0d3
 SUBDIRS += a52
0bd0d3
 endif
0bd0d3
-if HAVE_AVCRATE
0bd0d3
-SUBDIRS += rate-lavc
0bd0d3
+if HAVE_LAVRATE
0bd0d3
+SUBDIRS += rate-lav
0bd0d3
 endif
0bd0d3
 if HAVE_USBSTREAM
0bd0d3
 SUBDIRS += usb_stream
0bd0d3
diff --git a/a52/Makefile.am b/a52/Makefile.am
0bd0d3
index cbc1497..4ac8edd 100644
0bd0d3
--- a/a52/Makefile.am
0bd0d3
+++ b/a52/Makefile.am
0bd0d3
@@ -6,9 +6,8 @@ asound_module_addon_DATA = 60-a52-encoder.conf
0bd0d3
 asound_module_pcm_a52dir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
 
0bd0d3
-AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @AVCODEC_CFLAGS@ \
0bd0d3
-	-DAVCODEC_HEADER="@AVCODEC_HEADER@"
0bd0d3
+AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @LIBAV_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
 
0bd0d3
 libasound_module_pcm_a52_la_SOURCES = pcm_a52.c
0bd0d3
-libasound_module_pcm_a52_la_LIBADD = @ALSA_LIBS@ @AVCODEC_LIBS@
0bd0d3
+libasound_module_pcm_a52_la_LIBADD = @ALSA_LIBS@ @LIBAV_LIBS@ @LIBAV_CODEC_LIBS@
0bd0d3
diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
0bd0d3
index 155da36..29ce45f 100644
0bd0d3
--- a/a52/pcm_a52.c
0bd0d3
+++ b/a52/pcm_a52.c
0bd0d3
@@ -25,7 +25,7 @@
0bd0d3
 #include <alsa/asoundlib.h>
0bd0d3
 #include <alsa/pcm_external.h>
0bd0d3
 #include <alsa/pcm_plugin.h>
0bd0d3
-#include AVCODEC_HEADER
0bd0d3
+#include <libavcodec/avcodec.h>
0bd0d3
 #include <libavutil/avutil.h>
0bd0d3
 
0bd0d3
 /* some compatibility wrappers */
0bd0d3
diff --git a/configure.ac b/configure.ac
0bd0d3
index 2d7e6aa..cb1ae2d 100644
0bd0d3
--- a/configure.ac
0bd0d3
+++ b/configure.ac
0bd0d3
@@ -89,67 +89,55 @@ if test "$use_maemo_rm" = "yes"; then
0bd0d3
         fi
0bd0d3
 fi
0bd0d3
 
0bd0d3
-AC_ARG_ENABLE([avcodec],
0bd0d3
-      AS_HELP_STRING([--disable-avcodec], [Don't build plugins depending on avcodec (a52)]))
0bd0d3
+AC_ARG_ENABLE([libav],
0bd0d3
+      AS_HELP_STRING([--disable-avlib], [Do not build plugins depending on libav/ffmpeg (a52,lavrate...)]))
0bd0d3
 
0bd0d3
-if test "x$enable_avcodec" != "xno"; then
0bd0d3
-  PKG_CHECK_MODULES(AVCODEC, [libavcodec libavutil], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
0bd0d3
+if test "x$enable_libav" != "xno"; then
0bd0d3
+  PKG_CHECK_MODULES(LIBAV, [libavcodec libavutil libavresample], [HAVE_LIBAV=yes], [HAVE_LIBAV=no])
0bd0d3
 fi
0bd0d3
 
0bd0d3
-if test "x$HAVE_AVCODEC" = "xno"; then
0bd0d3
-  AC_ARG_WITH([avcodec-includedir],
0bd0d3
-	AS_HELP_STRING([--with-avcodec-includedir=dir],
0bd0d3
-		[AVcodec include directory]),
0bd0d3
-	[AVCODEC_CFLAGS="-I$withval"], [AVCODEC_CFLAGS=""])
0bd0d3
-  AC_ARG_WITH([avcodec-libdir],
0bd0d3
-	AS_HELP_STRING([--with-avcodec-libdir=dir],
0bd0d3
-		[AVcodec library directory]),
0bd0d3
-	[AVCODEC_LIBS="-L$withval"], [AVCODEC_LIBS=""])
0bd0d3
+if test "x$HAVE_LIBAV" = "xno"; then
0bd0d3
+  AC_ARG_WITH([libav-includedir],
0bd0d3
+	AS_HELP_STRING([--with-libav-includedir=dir],
0bd0d3
+		[Libav/ffmpeg include directory]),
0bd0d3
+		[LIBAV_CFLAGS="-I$(withval)"], [LIBAV_CFLAGS=""])
0bd0d3
+  AC_ARG_WITH([libav-libdir],
0bd0d3
+	AS_HELP_STRING([--with-libav-libdir=dir],
0bd0d3
+		[Libav/ffmpeg library directory]),
0bd0d3
+		[LIBAV_LIBS="-L$withval"], [LIBAV_LIBS=""])
0bd0d3
 
0bd0d3
   CFLAGS_saved="$CFLAGS"
0bd0d3
   LDFLAGS_saved="$LDFLAGS"
0bd0d3
-  CFLAGS="$CFLAGS $AVCODEC_CFLAGS"
0bd0d3
-  LDFLAGS="$LDFLAGS $AVCODEC_LIBS"
0bd0d3
-  AVCODEC_LIBS="$AVCODEC_LIBS -lavcodec"
0bd0d3
-  AC_CHECK_LIB([avcodec], [avcodec_open], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
0bd0d3
+  CFLAGS="$CFLAGS $LIBAV_CFLAGS"
0bd0d3
+  LDFLAGS="$LDFLAGS $LIBAV_LIBS"
0bd0d3
+  AC_CHECK_LIB([avcodec], [avcodec_open], [HAVE_LIBAV=yes], [HAVE_LIBAV=no])
0bd0d3
   CFLAGS="$CFLAGS_saved"
0bd0d3
   LDFLAGS="$LDFLAGS_saved"
0bd0d3
+  LIBAV_CODEC_LIBS="-lavcodec"
0bd0d3
+  LIBAV_RESAMPLE_LIBS="-lavresample -lavutil"
0bd0d3
 fi
0bd0d3
 
0bd0d3
-if test $HAVE_AVCODEC = yes; then
0bd0d3
-  AVCODEC_HEADER=""
0bd0d3
-  CFLAGS_saved="$CFLAGS"
0bd0d3
-  CFLAGS="$CFLAGS $AVCODEC_CFLAGS"
0bd0d3
-  AC_CHECK_HEADER([ffmpeg/avcodec.h], [AVCODEC_HEADER='<ffmpeg/avcodec.h>'])
0bd0d3
-  if test -z "$AVCODEC_HEADER"; then
0bd0d3
-    AC_CHECK_HEADER([libavcodec/avcodec.h], [AVCODEC_HEADER='<libavcodec/avcodec.h>'])
0bd0d3
-  fi
0bd0d3
-  if test -z "$AVCODEC_HEADER"; then
0bd0d3
-    HAVE_AVCODEC=no
0bd0d3
-  fi
0bd0d3
-  CFLAGS="$CFLAGS_saved"
0bd0d3
-fi
0bd0d3
-
0bd0d3
-AM_CONDITIONAL(HAVE_AVCODEC, test x$HAVE_AVCODEC = xyes)
0bd0d3
-AC_SUBST(AVCODEC_CFLAGS)
0bd0d3
-AC_SUBST(AVCODEC_LIBS)
0bd0d3
-AC_SUBST(AVCODEC_HEADER)
0bd0d3
+AM_CONDITIONAL(HAVE_LIBAV, test x$HAVE_LIBAV = xyes)
0bd0d3
+AC_SUBST(LIBAV_CFLAGS)
0bd0d3
+AC_SUBST(LIBAV_LIBS)
0bd0d3
+AC_SUBST(LIBAV_CODEC_LIBS)
0bd0d3
+AC_SUBST(LIBAV_RESAMPLE_LIBS)
0bd0d3
 
0bd0d3
 AC_ARG_ENABLE([a52],
0bd0d3
       AS_HELP_STRING([--disable-a52], [Disable building of A52 encoder plugin]))
0bd0d3
 
0bd0d3
-if test "x$enable_a52" != "xno" -a "$HAVE_AVCODEC" = "yes"; then
0bd0d3
+if test "x$enable_a52" != "xno" -a "$HAVE_LIBAV" = "yes"; then
0bd0d3
   HAVE_A52=yes
0bd0d3
 fi
0bd0d3
 AM_CONDITIONAL(HAVE_A52, test x$HAVE_A52 = xyes)
0bd0d3
 
0bd0d3
-AC_ARG_ENABLE([avcrate],
0bd0d3
-      AS_HELP_STRING([--disable-avcrate], [Disable building of AVC rate plugin]))
0bd0d3
+AC_ARG_ENABLE([lavrate],
0bd0d3
+      AS_HELP_STRING([--disable-lavrate], [Disable building of libav/ffmpeg rate plugin]))
0bd0d3
 
0bd0d3
-if test "x$enable_avcrate" != "xno" -a "$HAVE_AVCODEC" = "yes"; then
0bd0d3
-  HAVE_AVCRATE=yes
0bd0d3
+if test "x$enable_lavrate" != "xno" -a "$HAVE_LIBAV" = "yes"; then
0bd0d3
+  HAVE_LAVRATE=yes
0bd0d3
 fi
0bd0d3
-AM_CONDITIONAL(HAVE_AVCRATE, test x$HAVE_AVCRATE = xyes)
0bd0d3
+AM_CONDITIONAL(HAVE_LAVRATE, test x$HAVE_LAVRATE = xyes)
0bd0d3
 
0bd0d3
 AC_ARG_ENABLE([speexdsp],
0bd0d3
       AS_HELP_STRING([--disable-speexdsp], [Disable building of speexdsp plugin]))
0bd0d3
@@ -245,7 +233,7 @@ AC_OUTPUT([
0bd0d3
 	mix/Makefile
0bd0d3
 	rate/Makefile
0bd0d3
 	a52/Makefile
0bd0d3
-	rate-lavc/Makefile
0bd0d3
+	rate-lav/Makefile
0bd0d3
 	maemo/Makefile
0bd0d3
 	doc/Makefile
0bd0d3
 	usb_stream/Makefile
0bd0d3
@@ -276,14 +264,13 @@ if test "$HAVE_SAMPLERATE" = "yes"; then
0bd0d3
 fi
0bd0d3
 echo "Maemo plugin:       $HAVE_MAEMO_PLUGIN"
0bd0d3
 echo "  Using Osso resource manager: $use_maemo_rm"
0bd0d3
-if test "$HAVE_AVCODEC" = "yes"; then
0bd0d3
-  echo "AVCodec config:"
0bd0d3
-  echo "  AVCODEC_CFLAGS: $AVCODEC_CFLAGS"
0bd0d3
-  echo "  AVCODEC_LIBS: $AVCODEC_LIBS"
0bd0d3
-  echo "  AVCODEC_HEADER: $AVCODEC_HEADER"
0bd0d3
+if test "$HAVE_LIBAV" = "yes"; then
0bd0d3
+  echo "Libav/ffmpeg config:"
0bd0d3
+  echo "  LIBAV_CFLAGS:   $LIBAV_CFLAGS"
0bd0d3
+  echo "  LIBAV_LIBS:     $LIBAV_LIBS / $LIBAV_CODEC_LIBS / $LIBAV_RESAMPLE_LIBS"
0bd0d3
 fi
0bd0d3
-echo "A52 plugin:         $HAVE_A52"
0bd0d3
-echo "AVC rate plugin:    $HAVE_AVCRATE"
0bd0d3
+echo "Libav A52 plugin:   $HAVE_A52"
0bd0d3
+echo "Libav rate plugin:  $HAVE_LAVRATE"
0bd0d3
 echo "Speex rate plugin:  $PPH"
0bd0d3
 echo "Speex preprocess plugin:  $HAVE_SPEEXDSP"
0bd0d3
 if test "$HAVE_SPEEX" = "yes"; then
0bd0d3
diff --git a/doc/Makefile.am b/doc/Makefile.am
0bd0d3
index 0d6f6e5..7c004e5 100644
0bd0d3
--- a/doc/Makefile.am
0bd0d3
+++ b/doc/Makefile.am
0bd0d3
@@ -21,8 +21,8 @@ endif
0bd0d3
 if HAVE_A52
0bd0d3
 EXTRA_DIST += a52.txt
0bd0d3
 endif
0bd0d3
-if HAVE_AVCRATE
0bd0d3
-EXTRA_DIST += lavcrate.txt
0bd0d3
+if HAVE_LAVRATE
0bd0d3
+EXTRA_DIST += lavrate.txt
0bd0d3
 endif
0bd0d3
 if HAVE_PPH
0bd0d3
 EXTRA_DIST += speexrate.txt
0bd0d3
diff --git a/doc/lavcrate.txt b/doc/lavrate.txt
0bd0d3
similarity index 76%
0bd0d3
rename from doc/lavcrate.txt
0bd0d3
rename to doc/lavrate.txt
0bd0d3
index faf3e25..6575183 100644
0bd0d3
--- a/doc/lavcrate.txt
0bd0d3
+++ b/doc/lavrate.txt
0bd0d3
@@ -1,14 +1,14 @@
0bd0d3
-Rate Converter Plugin Using libavcodec
0bd0d3
-======================================
0bd0d3
+Rate Converter Plugin Using libavresample
0bd0d3
+=========================================0
0bd0d3
 
0bd0d3
-The plugin in rate-lavc subdirectory is an external rate converter using
0bd0d3
-libavcodec's resampler.  You can use this rate converter plugin by defining a
0bd0d3
+The plugin in rate-lavr subdirectory is an external rate converter using
0bd0d3
+libavresample library. You can use this rate converter plugin by defining a
0bd0d3
 rate PCM with "converter" parameter, such as:
0bd0d3
 
0bd0d3
 	pcm.my_rate {
0bd0d3
 		type rate
0bd0d3
 		slave.pcm "hw"
0bd0d3
-		converter "lavcrate"
0bd0d3
+		converter "lavrate"
0bd0d3
 	}
0bd0d3
 
0bd0d3
 The plug plugin has also a similar field, "rate_converter".
0bd0d3
diff --git a/rate-lavc/10-rate-lavc.conf b/rate-lav/10-rate-lav.conf
0bd0d3
similarity index 73%
0bd0d3
rename from rate-lavc/10-rate-lavc.conf
0bd0d3
rename to rate-lav/10-rate-lav.conf
0bd0d3
index bab1694..48ede62 100644
0bd0d3
--- a/rate-lavc/10-rate-lavc.conf
0bd0d3
+++ b/rate-lav/10-rate-lav.conf
0bd0d3
@@ -1,4 +1,4 @@
0bd0d3
-pcm.lavcrate {
0bd0d3
+pcm.lavrate {
0bd0d3
 	@args [ SLAVE RATE CONVERTER ]
0bd0d3
 	@args.SLAVE {
0bd0d3
 		type string
0bd0d3
@@ -10,7 +10,7 @@ pcm.lavcrate {
0bd0d3
 	}
0bd0d3
 	@args.CONVERTER {
0bd0d3
 		type string
0bd0d3
-		default "lavcrate"
0bd0d3
+		default "lavrate"
0bd0d3
 	}
0bd0d3
 	type rate
0bd0d3
 	converter $CONVERTER
0bd0d3
@@ -23,6 +23,6 @@ pcm.lavcrate {
0bd0d3
 			@func refer
0bd0d3
 			name defaults.namehint.basic
0bd0d3
 		}
0bd0d3
-                description "Rate Converter Plugin Using AVC Library"
0bd0d3
+                description "Rate Converter Plugin Using Libav/FFmpeg Library"
0bd0d3
 	}
0bd0d3
 }
0bd0d3
diff --git a/rate-lav/Makefile.am b/rate-lav/Makefile.am
0bd0d3
new file mode 100644
0bd0d3
index 0000000..0f6ecb6
0bd0d3
--- /dev/null
0bd0d3
+++ b/rate-lav/Makefile.am
0bd0d3
@@ -0,0 +1,25 @@
0bd0d3
+EXTRA_DIST = 10-rate-lav.conf
0bd0d3
+
0bd0d3
+asound_module_rate_lavrate_LTLIBRARIES = libasound_module_rate_lavrate.la
0bd0d3
+asound_module_addon_DATA = 10-rate-lav.conf
0bd0d3
+
0bd0d3
+asound_module_rate_lavratedir = @ALSA_PLUGIN_DIR@
0bd0d3
+asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+
0bd0d3
+AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @LIBAV_CFLAGS@
0bd0d3
+AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
+
0bd0d3
+libasound_module_rate_lavrate_la_SOURCES = rate_lavrate.c
0bd0d3
+libasound_module_rate_lavrate_la_LIBADD = @ALSA_LIBS@ @LIBAV_LIBS@ @LIBAV_RESAMPLE_LIBS@
0bd0d3
+
0bd0d3
+noinst_HEADERS = gcd.h
0bd0d3
+
0bd0d3
+install-exec-hook:
0bd0d3
+	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_*.so
0bd0d3
+	$(LN_S) libasound_module_rate_lavrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_higher.so
0bd0d3
+	$(LN_S) libasound_module_rate_lavrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_high.so
0bd0d3
+	$(LN_S) libasound_module_rate_lavrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_fast.so
0bd0d3
+	$(LN_S) libasound_module_rate_lavrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_faster.so
0bd0d3
+
0bd0d3
+uninstall-hook:
0bd0d3
+	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_*.so
0bd0d3
diff --git a/rate-lavc/gcd.h b/rate-lav/gcd.h
0bd0d3
similarity index 100%
0bd0d3
rename from rate-lavc/gcd.h
0bd0d3
rename to rate-lav/gcd.h
0bd0d3
diff --git a/rate-lav/rate_lavrate.c b/rate-lav/rate_lavrate.c
0bd0d3
new file mode 100644
0bd0d3
index 0000000..2b992c5
0bd0d3
--- /dev/null
0bd0d3
+++ b/rate-lav/rate_lavrate.c
0bd0d3
@@ -0,0 +1,235 @@
0bd0d3
+/*
0bd0d3
+ * Rate converter plugin using libavresample
0bd0d3
+ * Copyright (c) 2014 by Anton Khirnov
0bd0d3
+ *
0bd0d3
+ * This library is free software; you can redistribute it and/or
0bd0d3
+ * modify it under the terms of the GNU Lesser General Public
0bd0d3
+ * License as published by the Free Software Foundation; either
0bd0d3
+ * version 2.1 of the License, or (at your option) any later version.
0bd0d3
+ *
0bd0d3
+ * This library is distributed in the hope that it will be useful,
0bd0d3
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
0bd0d3
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0bd0d3
+ * Lesser General Public License for more details.
0bd0d3
+ */
0bd0d3
+
0bd0d3
+#include <stdio.h>
0bd0d3
+#include <alsa/asoundlib.h>
0bd0d3
+#include <alsa/pcm_rate.h>
0bd0d3
+
0bd0d3
+#include <libavresample/avresample.h>
0bd0d3
+#include <libavutil/channel_layout.h>
0bd0d3
+#include <libavutil/opt.h>
0bd0d3
+#include <libavutil/mathematics.h>
0bd0d3
+#include <libavutil/samplefmt.h>
0bd0d3
+
0bd0d3
+
0bd0d3
+static unsigned int filter_size = 16;
0bd0d3
+static unsigned int phase_shift = 10; /* auto-adjusts */
0bd0d3
+static double cutoff = 0; /* auto-adjusts */
0bd0d3
+
0bd0d3
+struct rate_src {
0bd0d3
+	AVAudioResampleContext *avr;
0bd0d3
+
0bd0d3
+	unsigned int in_rate;
0bd0d3
+	unsigned int out_rate;
0bd0d3
+	unsigned int channels;
0bd0d3
+};
0bd0d3
+
0bd0d3
+static snd_pcm_uframes_t input_frames(void *obj ATTRIBUTE_UNUSED,
0bd0d3
+				      snd_pcm_uframes_t frames)
0bd0d3
+{
0bd0d3
+	return frames;
0bd0d3
+}
0bd0d3
+
0bd0d3
+static snd_pcm_uframes_t output_frames(void *obj ATTRIBUTE_UNUSED,
0bd0d3
+				       snd_pcm_uframes_t frames)
0bd0d3
+{
0bd0d3
+	return frames;
0bd0d3
+}
0bd0d3
+
0bd0d3
+static void pcm_src_free(void *obj)
0bd0d3
+{
0bd0d3
+	struct rate_src *rate = obj;
0bd0d3
+	avresample_free(&rate->avr);
0bd0d3
+}
0bd0d3
+
0bd0d3
+static int pcm_src_init(void *obj, snd_pcm_rate_info_t *info)
0bd0d3
+{
0bd0d3
+	struct rate_src *rate = obj;
0bd0d3
+	int i, ir, or;
0bd0d3
+
0bd0d3
+	if (!rate->avr || rate->channels != info->channels) {
0bd0d3
+		int ret;
0bd0d3
+
0bd0d3
+		pcm_src_free(rate);
0bd0d3
+		rate->channels = info->channels;
0bd0d3
+		ir = rate->in_rate = info->in.rate;
0bd0d3
+		or = rate->out_rate = info->out.rate;
0bd0d3
+		i = av_gcd(or, ir);
0bd0d3
+		if (or > ir) {
0bd0d3
+			phase_shift = or/i;
0bd0d3
+		} else {
0bd0d3
+			phase_shift = ir/i;
0bd0d3
+		}
0bd0d3
+		if (cutoff <= 0.0) {
0bd0d3
+			cutoff = 1.0 - 1.0/filter_size;
0bd0d3
+			if (cutoff < 0.80)
0bd0d3
+				cutoff = 0.80;
0bd0d3
+		}
0bd0d3
+
0bd0d3
+		rate->avr = avresample_alloc_context();
0bd0d3
+		if (!rate->avr)
0bd0d3
+			return -ENOMEM;
0bd0d3
+
0bd0d3
+		av_opt_set_int(rate->avr, "in_sample_rate",     info->in.rate,  0);
0bd0d3
+		av_opt_set_int(rate->avr, "out_sample_rate",    info->out.rate, 0);
0bd0d3
+		av_opt_set_int(rate->avr, "in_sample_format",   AV_SAMPLE_FMT_S16, 0);
0bd0d3
+		av_opt_set_int(rate->avr, "out_sample_format",  AV_SAMPLE_FMT_S16, 0);
0bd0d3
+		av_opt_set_int(rate->avr, "in_channel_layout",  av_get_default_channel_layout(rate->channels), 0);
0bd0d3
+		av_opt_set_int(rate->avr, "out_channel_layout", av_get_default_channel_layout(rate->channels), 0);
0bd0d3
+
0bd0d3
+		av_opt_set_int(rate->avr, "filter_size",        filter_size, 0);
0bd0d3
+		av_opt_set_int(rate->avr, "phase_shift",        phase_shift, 0);
0bd0d3
+		av_opt_set_double(rate->avr, "cutoff",          cutoff,      0);
0bd0d3
+
0bd0d3
+		ret = avresample_open(rate->avr);
0bd0d3
+		if (ret < 0) {
0bd0d3
+			avresample_free(&rate->avr);
0bd0d3
+			return -EINVAL;
0bd0d3
+		}
0bd0d3
+	}
0bd0d3
+
0bd0d3
+	return 0;
0bd0d3
+}
0bd0d3
+
0bd0d3
+static int pcm_src_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
0bd0d3
+{
0bd0d3
+	struct rate_src *rate = obj;
0bd0d3
+
0bd0d3
+	if (info->out.rate != rate->out_rate || info->in.rate != rate->in_rate)
0bd0d3
+		pcm_src_init(obj, info);
0bd0d3
+	return 0;
0bd0d3
+}
0bd0d3
+
0bd0d3
+static void pcm_src_reset(void *obj)
0bd0d3
+{
0bd0d3
+	struct rate_src *rate = obj;
0bd0d3
+
0bd0d3
+	if (rate->avr) {
0bd0d3
+#if 0
0bd0d3
+		avresample_close(rate->avr);
0bd0d3
+		avresample_open(rate->avr);
0bd0d3
+#endif
0bd0d3
+	}
0bd0d3
+}
0bd0d3
+
0bd0d3
+static void pcm_src_convert_s16(void *obj, int16_t *dst,
0bd0d3
+				unsigned int dst_frames,
0bd0d3
+				const int16_t *src,
0bd0d3
+				unsigned int src_frames)
0bd0d3
+{
0bd0d3
+	struct rate_src *rate = obj;
0bd0d3
+	int chans = rate->channels;
0bd0d3
+	unsigned int total_in = avresample_get_delay(rate->avr) + src_frames;
0bd0d3
+
0bd0d3
+	avresample_convert(rate->avr, (uint8_t **)&dst, dst_frames * chans * 2, dst_frames,
0bd0d3
+	                   (uint8_t **)&src, src_frames * chans * 2, src_frames);
0bd0d3
+
0bd0d3
+	avresample_set_compensation(rate->avr,
0bd0d3
+                                    total_in - src_frames > filter_size ? 0 : 1, src_frames);
0bd0d3
+}
0bd0d3
+
0bd0d3
+static void pcm_src_close(void *obj)
0bd0d3
+{
0bd0d3
+	pcm_src_free(obj);
0bd0d3
+}
0bd0d3
+
0bd0d3
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
+static int get_supported_rates(void *obj ATTRIBUTE_UNUSED,
0bd0d3
+			       unsigned int *rate_min,
0bd0d3
+			       unsigned int *rate_max)
0bd0d3
+{
0bd0d3
+	*rate_min = *rate_max = 0; /* both unlimited */
0bd0d3
+	return 0;
0bd0d3
+}
0bd0d3
+
0bd0d3
+static void dump(void *obj ATTRIBUTE_UNUSED, snd_output_t *out)
0bd0d3
+{
0bd0d3
+	snd_output_printf(out, "Converter: libavr\n");
0bd0d3
+}
0bd0d3
+#endif
0bd0d3
+
0bd0d3
+static snd_pcm_rate_ops_t pcm_src_ops = {
0bd0d3
+	.close = pcm_src_close,
0bd0d3
+	.init = pcm_src_init,
0bd0d3
+	.free = pcm_src_free,
0bd0d3
+	.reset = pcm_src_reset,
0bd0d3
+	.adjust_pitch = pcm_src_adjust_pitch,
0bd0d3
+	.convert_s16 = pcm_src_convert_s16,
0bd0d3
+	.input_frames = input_frames,
0bd0d3
+	.output_frames = output_frames,
0bd0d3
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
+	.version = SND_PCM_RATE_PLUGIN_VERSION,
0bd0d3
+	.get_supported_rates = get_supported_rates,
0bd0d3
+	.dump = dump,
0bd0d3
+#endif
0bd0d3
+};
0bd0d3
+
0bd0d3
+int pcm_src_open(unsigned int version, void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
+
0bd0d3
+{
0bd0d3
+	struct rate_src *rate;
0bd0d3
+
0bd0d3
+#if SND_PCM_RATE_PLUGIN_VERSION < 0x010002
0bd0d3
+	if (version != SND_PCM_RATE_PLUGIN_VERSION) {
0bd0d3
+		fprintf(stderr, "Invalid rate plugin version %x\n", version);
0bd0d3
+		return -EINVAL;
0bd0d3
+	}
0bd0d3
+#endif
0bd0d3
+	rate = calloc(1, sizeof(*rate));
0bd0d3
+	if (!rate)
0bd0d3
+		return -ENOMEM;
0bd0d3
+
0bd0d3
+	*objp = rate;
0bd0d3
+	rate->avr = NULL;
0bd0d3
+#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
+	if (version == 0x010001)
0bd0d3
+		memcpy(ops, &pcm_src_ops, sizeof(snd_pcm_rate_old_ops_t));
0bd0d3
+	else
0bd0d3
+#endif
0bd0d3
+		*ops = pcm_src_ops;
0bd0d3
+	return 0;
0bd0d3
+}
0bd0d3
+
0bd0d3
+int SND_PCM_RATE_PLUGIN_ENTRY(lavrate)(unsigned int version, void **objp,
0bd0d3
+			snd_pcm_rate_ops_t *ops)
0bd0d3
+{
0bd0d3
+	return pcm_src_open(version, objp, ops);
0bd0d3
+}
0bd0d3
+int SND_PCM_RATE_PLUGIN_ENTRY(lavrate_higher)(unsigned int version,
0bd0d3
+			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
+{
0bd0d3
+	filter_size = 64;
0bd0d3
+	return pcm_src_open(version, objp, ops);
0bd0d3
+}
0bd0d3
+int SND_PCM_RATE_PLUGIN_ENTRY(lavrate_high)(unsigned int version,
0bd0d3
+			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
+{
0bd0d3
+	filter_size = 32;
0bd0d3
+	return pcm_src_open(version, objp, ops);
0bd0d3
+}
0bd0d3
+int SND_PCM_RATE_PLUGIN_ENTRY(lavrate_fast)(unsigned int version,
0bd0d3
+			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
+{
0bd0d3
+	filter_size = 8;
0bd0d3
+	return pcm_src_open(version, objp, ops);
0bd0d3
+}
0bd0d3
+int SND_PCM_RATE_PLUGIN_ENTRY(lavrate_faster)(unsigned int version,
0bd0d3
+			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
+{
0bd0d3
+	filter_size = 4;
0bd0d3
+	return pcm_src_open(version, objp, ops);
0bd0d3
+}
0bd0d3
+
0bd0d3
+
0bd0d3
diff --git a/rate-lavc/Makefile.am b/rate-lavc/Makefile.am
0bd0d3
deleted file mode 100644
0bd0d3
index 5f66472..0000000
0bd0d3
--- a/rate-lavc/Makefile.am
0bd0d3
+++ /dev/null
0bd0d3
@@ -1,26 +0,0 @@
0bd0d3
-EXTRA_DIST = 10-rate-lavc.conf
0bd0d3
-
0bd0d3
-asound_module_rate_lavcrate_LTLIBRARIES = libasound_module_rate_lavcrate.la
0bd0d3
-asound_module_addon_DATA = 10-rate-lavc.conf
0bd0d3
-
0bd0d3
-asound_module_rate_lavcratedir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
-
0bd0d3
-AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @AVCODEC_CFLAGS@ \
0bd0d3
-	-DAVCODEC_HEADER="@AVCODEC_HEADER@"
0bd0d3
-AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
-
0bd0d3
-libasound_module_rate_lavcrate_la_SOURCES = rate_lavcrate.c
0bd0d3
-libasound_module_rate_lavcrate_la_LIBADD = @ALSA_LIBS@ @AVCODEC_LIBS@
0bd0d3
-
0bd0d3
-noinst_HEADERS = gcd.h
0bd0d3
-
0bd0d3
-install-exec-hook:
0bd0d3
-	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_*.so
0bd0d3
-	$(LN_S) libasound_module_rate_lavcrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_higher.so
0bd0d3
-	$(LN_S) libasound_module_rate_lavcrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_high.so
0bd0d3
-	$(LN_S) libasound_module_rate_lavcrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_fast.so
0bd0d3
-	$(LN_S) libasound_module_rate_lavcrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_faster.so
0bd0d3
-
0bd0d3
-uninstall-hook:
0bd0d3
-	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavcrate_*.so
0bd0d3
diff --git a/rate-lavc/rate_lavcrate.c b/rate-lavc/rate_lavcrate.c
0bd0d3
deleted file mode 100644
0bd0d3
index 14a2198..0000000
0bd0d3
--- a/rate-lavc/rate_lavcrate.c
0bd0d3
+++ /dev/null
0bd0d3
@@ -1,291 +0,0 @@
0bd0d3
-/*
0bd0d3
- * Rate converter plugin using libavcodec's resampler
0bd0d3
- * Copyright (c) 2007 by Nicholas Kain <njkain@gmail.com>
0bd0d3
- *
0bd0d3
- * based on rate converter that uses libsamplerate
0bd0d3
- * Copyright (c) 2006 by Takashi Iwai <tiwai@suse.de>
0bd0d3
- *
0bd0d3
- * This library is free software; you can redistribute it and/or
0bd0d3
- * modify it under the terms of the GNU Lesser General Public
0bd0d3
- * License as published by the Free Software Foundation; either
0bd0d3
- * version 2.1 of the License, or (at your option) any later version.
0bd0d3
- *
0bd0d3
- * This library is distributed in the hope that it will be useful,
0bd0d3
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
0bd0d3
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0bd0d3
- * Lesser General Public License for more details.
0bd0d3
- */
0bd0d3
-
0bd0d3
-#include <stdio.h>
0bd0d3
-#include <alsa/asoundlib.h>
0bd0d3
-#include <alsa/pcm_rate.h>
0bd0d3
-#include AVCODEC_HEADER
0bd0d3
-#include "gcd.h"
0bd0d3
-
0bd0d3
-static int filter_size = 16;
0bd0d3
-static int phase_shift = 10; /* auto-adjusts */
0bd0d3
-static double cutoff = 0; /* auto-adjusts */
0bd0d3
-
0bd0d3
-struct rate_src {
0bd0d3
-	struct AVResampleContext *context;
0bd0d3
-	int in_rate;
0bd0d3
-	int out_rate;
0bd0d3
-	int stored;
0bd0d3
-	int point;
0bd0d3
-	int16_t **out;
0bd0d3
-	int16_t **in;
0bd0d3
-	unsigned int channels;
0bd0d3
-};
0bd0d3
-
0bd0d3
-static snd_pcm_uframes_t input_frames(void *obj, snd_pcm_uframes_t frames)
0bd0d3
-{
0bd0d3
-	return frames;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames)
0bd0d3
-{
0bd0d3
-	return frames;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void pcm_src_free(void *obj)
0bd0d3
-{
0bd0d3
-	struct rate_src *rate = obj;
0bd0d3
-	int i;
0bd0d3
-
0bd0d3
-	if (rate->out) {
0bd0d3
-		for (i=0; i<rate->channels; i++) {
0bd0d3
-			free(rate->out[i]);
0bd0d3
-		}
0bd0d3
-		free(rate->out);
0bd0d3
-	}
0bd0d3
-	if (rate->in) {
0bd0d3
-		for (i=0; i<rate->channels; i++) {
0bd0d3
-			free(rate->in[i]);
0bd0d3
-		}
0bd0d3
-		free(rate->in);
0bd0d3
-	}
0bd0d3
-	rate->out = rate->in = NULL;
0bd0d3
-
0bd0d3
-	if (rate->context) {
0bd0d3
-		av_resample_close(rate->context);
0bd0d3
-		rate->context = NULL;
0bd0d3
-	}
0bd0d3
-}
0bd0d3
-
0bd0d3
-static int pcm_src_init(void *obj, snd_pcm_rate_info_t *info)
0bd0d3
-{
0bd0d3
-	struct rate_src *rate = obj;
0bd0d3
-	int i, ir, or;
0bd0d3
-
0bd0d3
-	if (! rate->context || rate->channels != info->channels) {
0bd0d3
-		pcm_src_free(rate);
0bd0d3
-		rate->channels = info->channels;
0bd0d3
-		ir = rate->in_rate = info->in.rate;
0bd0d3
-		or = rate->out_rate = info->out.rate;
0bd0d3
-		i = gcd(or, ir);
0bd0d3
-		if (or > ir) {
0bd0d3
-			phase_shift = or/i;
0bd0d3
-		} else {
0bd0d3
-			phase_shift = ir/i;
0bd0d3
-		}
0bd0d3
-		if (cutoff <= 0.0) {
0bd0d3
-			cutoff = 1.0 - 1.0/filter_size;
0bd0d3
-			if (cutoff < 0.80)
0bd0d3
-				cutoff = 0.80;
0bd0d3
-		}
0bd0d3
-		rate->context = av_resample_init(info->out.rate, info->in.rate,
0bd0d3
-			filter_size, phase_shift,
0bd0d3
-			(info->out.rate >= info->in.rate ? 0 : 1), cutoff);
0bd0d3
-		if (!rate->context)
0bd0d3
-			return -EINVAL;
0bd0d3
-	}
0bd0d3
-
0bd0d3
-	rate->out = malloc(rate->channels * sizeof(int16_t *));
0bd0d3
-	rate->in = malloc(rate->channels * sizeof(int16_t *));
0bd0d3
-	for (i=0; i<rate->channels; i++) {
0bd0d3
-		rate->out[i] = calloc(info->out.period_size * 2, 
0bd0d3
-			sizeof(int16_t));
0bd0d3
-		rate->in[i] = calloc(info->in.period_size * 2,
0bd0d3
-			sizeof(int16_t));
0bd0d3
-	}
0bd0d3
-	rate->point = info->in.period_size / 2;
0bd0d3
-	if (!rate->out || !rate->in) {
0bd0d3
-		pcm_src_free(rate);
0bd0d3
-		return -ENOMEM;
0bd0d3
-	}
0bd0d3
-
0bd0d3
-	return 0;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static int pcm_src_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
0bd0d3
-{
0bd0d3
-	struct rate_src *rate = obj;
0bd0d3
-
0bd0d3
-	if (info->out.rate != rate->out_rate || info->in.rate != rate->in_rate)
0bd0d3
-		pcm_src_init(obj, info);
0bd0d3
-	return 0;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void pcm_src_reset(void *obj)
0bd0d3
-{
0bd0d3
-	struct rate_src *rate = obj;
0bd0d3
-	rate->stored = 0;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void deinterleave(const int16_t *src, int16_t **dst, unsigned int frames,
0bd0d3
-	unsigned int chans, int overflow)
0bd0d3
-{
0bd0d3
-	int i, j;
0bd0d3
-
0bd0d3
-	if (chans == 1) {
0bd0d3
-		memcpy(dst + overflow, src, frames*sizeof(int16_t));
0bd0d3
-	} else if (chans == 2) {
0bd0d3
-		for (j=overflow; j<(frames + overflow); j++) {
0bd0d3
-			dst[0][j] = *(src++);
0bd0d3
-			dst[1][j] = *(src++);
0bd0d3
-		}
0bd0d3
-	} else {
0bd0d3
-		for (j=overflow; j<(frames + overflow); j++) {
0bd0d3
-			for (i=0; i
0bd0d3
-				dst[i][j] = *(src++);
0bd0d3
-			}
0bd0d3
-		}
0bd0d3
-	}
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void reinterleave(int16_t **src, int16_t *dst, unsigned int frames,
0bd0d3
-	unsigned int chans)
0bd0d3
-{
0bd0d3
-	int i, j;
0bd0d3
-
0bd0d3
-	if (chans == 1) {
0bd0d3
-		memcpy(dst, src, frames*sizeof(int16_t));
0bd0d3
-	} else if (chans == 2) {
0bd0d3
-		for (j=0; j
0bd0d3
-			*(dst++) = src[0][j];
0bd0d3
-			*(dst++) = src[1][j];
0bd0d3
-		}
0bd0d3
-	} else {
0bd0d3
-		for (j=0; j
0bd0d3
-			for (i=0; i
0bd0d3
-				*(dst++) = src[i][j];
0bd0d3
-			}
0bd0d3
-		}
0bd0d3
-	}
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void pcm_src_convert_s16(void *obj, int16_t *dst, unsigned int
0bd0d3
-	dst_frames, const int16_t *src, unsigned int src_frames)
0bd0d3
-{
0bd0d3
-	struct rate_src *rate = obj;
0bd0d3
-	int consumed = 0, chans=rate->channels, ret=0, i;
0bd0d3
-	int total_in = rate->stored + src_frames, new_stored;
0bd0d3
-
0bd0d3
-	deinterleave(src, rate->in, src_frames, chans, rate->point);
0bd0d3
-	for (i=0; i
0bd0d3
-		ret = av_resample(rate->context, rate->out[i],
0bd0d3
-				rate->in[i]+rate->point-rate->stored, &consumed,
0bd0d3
-				total_in, dst_frames, i == (chans - 1));
0bd0d3
-		new_stored = total_in-consumed;
0bd0d3
-		memmove(rate->in[i]+rate->point-new_stored,
0bd0d3
-				rate->in[i]+rate->point-rate->stored+consumed,
0bd0d3
-				new_stored*sizeof(int16_t));
0bd0d3
-	}
0bd0d3
-	av_resample_compensate(rate->context,
0bd0d3
-			total_in-src_frames>filter_size?0:1, src_frames);
0bd0d3
-	reinterleave(rate->out, dst, ret, chans);
0bd0d3
-	rate->stored = total_in-consumed;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void pcm_src_close(void *obj)
0bd0d3
-{
0bd0d3
-	pcm_src_free(obj);
0bd0d3
-}
0bd0d3
-
0bd0d3
-#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
-static int get_supported_rates(void *obj, unsigned int *rate_min,
0bd0d3
-			       unsigned int *rate_max)
0bd0d3
-{
0bd0d3
-	*rate_min = *rate_max = 0; /* both unlimited */
0bd0d3
-	return 0;
0bd0d3
-}
0bd0d3
-
0bd0d3
-static void dump(void *obj, snd_output_t *out)
0bd0d3
-{
0bd0d3
-	snd_output_printf(out, "Converter: liblavc\n");
0bd0d3
-}
0bd0d3
-#endif
0bd0d3
-
0bd0d3
-static snd_pcm_rate_ops_t pcm_src_ops = {
0bd0d3
-	.close = pcm_src_close,
0bd0d3
-	.init = pcm_src_init,
0bd0d3
-	.free = pcm_src_free,
0bd0d3
-	.reset = pcm_src_reset,
0bd0d3
-	.adjust_pitch = pcm_src_adjust_pitch,
0bd0d3
-	.convert_s16 = pcm_src_convert_s16,
0bd0d3
-	.input_frames = input_frames,
0bd0d3
-	.output_frames = output_frames,
0bd0d3
-#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
-	.version = SND_PCM_RATE_PLUGIN_VERSION,
0bd0d3
-	.get_supported_rates = get_supported_rates,
0bd0d3
-	.dump = dump,
0bd0d3
-#endif
0bd0d3
-};
0bd0d3
-
0bd0d3
-int pcm_src_open(unsigned int version, void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
-
0bd0d3
-{
0bd0d3
-	struct rate_src *rate;
0bd0d3
-
0bd0d3
-#if SND_PCM_RATE_PLUGIN_VERSION < 0x010002
0bd0d3
-	if (version != SND_PCM_RATE_PLUGIN_VERSION) {
0bd0d3
-		fprintf(stderr, "Invalid rate plugin version %x\n", version);
0bd0d3
-		return -EINVAL;
0bd0d3
-	}
0bd0d3
-#endif
0bd0d3
-	rate = calloc(1, sizeof(*rate));
0bd0d3
-	if (!rate)
0bd0d3
-		return -ENOMEM;
0bd0d3
-
0bd0d3
-	*objp = rate;
0bd0d3
-	rate->context = NULL;
0bd0d3
-#if SND_PCM_RATE_PLUGIN_VERSION >= 0x010002
0bd0d3
-	if (version == 0x010001)
0bd0d3
-		memcpy(ops, &pcm_src_ops, sizeof(snd_pcm_rate_old_ops_t));
0bd0d3
-	else
0bd0d3
-#endif
0bd0d3
-		*ops = pcm_src_ops;
0bd0d3
-	return 0;
0bd0d3
-}
0bd0d3
-
0bd0d3
-int SND_PCM_RATE_PLUGIN_ENTRY(lavcrate)(unsigned int version, void **objp,
0bd0d3
-			snd_pcm_rate_ops_t *ops)
0bd0d3
-{
0bd0d3
-	return pcm_src_open(version, objp, ops);
0bd0d3
-}
0bd0d3
-int SND_PCM_RATE_PLUGIN_ENTRY(lavcrate_higher)(unsigned int version,
0bd0d3
-			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
-{
0bd0d3
-	filter_size = 64;
0bd0d3
-	return pcm_src_open(version, objp, ops);
0bd0d3
-}
0bd0d3
-int SND_PCM_RATE_PLUGIN_ENTRY(lavcrate_high)(unsigned int version,
0bd0d3
-			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
-{
0bd0d3
-	filter_size = 32;
0bd0d3
-	return pcm_src_open(version, objp, ops);
0bd0d3
-}
0bd0d3
-int SND_PCM_RATE_PLUGIN_ENTRY(lavcrate_fast)(unsigned int version,
0bd0d3
-			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
-{
0bd0d3
-	filter_size = 8;
0bd0d3
-	return pcm_src_open(version, objp, ops);
0bd0d3
-}
0bd0d3
-int SND_PCM_RATE_PLUGIN_ENTRY(lavcrate_faster)(unsigned int version,
0bd0d3
-			void **objp, snd_pcm_rate_ops_t *ops)
0bd0d3
-{
0bd0d3
-	filter_size = 4;
0bd0d3
-	return pcm_src_open(version, objp, ops);
0bd0d3
-}
0bd0d3
-
0bd0d3
-
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From 4afd4ab0b276b26b965bae3aadaa31cdb52b1df0 Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Mon, 16 Apr 2018 17:49:36 +0200
0bd0d3
Subject: [PATCH 5/8] configure: change --with-alsaaddondir to
0bd0d3
 --with-alsagconfdir and --with-alsalconfdir
0bd0d3
0bd0d3
The local add-on configuration directory (/etc/alsa/conf.d) contains
0bd0d3
links to the global configuration directory (/usr/share/alsa/alsa.conf.d) now.
0bd0d3
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 a52/Makefile.am        | 14 +++++++++++---
0bd0d3
 arcam-av/Makefile.am   | 14 +++++++++++---
0bd0d3
 configure.ac           | 32 ++++++++++++++++++++++----------
0bd0d3
 install-hooks.am       | 16 ++++++++++++++++
0bd0d3
 jack/Makefile.am       | 14 +++++++++++---
0bd0d3
 maemo/Makefile.am      | 14 +++++++++++---
0bd0d3
 mix/Makefile.am        | 14 +++++++++++---
0bd0d3
 oss/Makefile.am        | 14 +++++++++++---
0bd0d3
 pph/Makefile.am        | 16 ++++++++++++----
0bd0d3
 pulse/Makefile.am      | 17 ++++++++++++++---
0bd0d3
 rate-lav/Makefile.am   | 13 ++++++++++---
0bd0d3
 rate/Makefile.am       | 14 +++++++++++---
0bd0d3
 speex/Makefile.am      | 14 +++++++++++---
0bd0d3
 usb_stream/Makefile.am | 14 +++++++++++---
0bd0d3
 14 files changed, 173 insertions(+), 47 deletions(-)
0bd0d3
 create mode 100644 install-hooks.am
0bd0d3
0bd0d3
diff --git a/a52/Makefile.am b/a52/Makefile.am
0bd0d3
index 4ac8edd..cd5ce45 100644
0bd0d3
--- a/a52/Makefile.am
0bd0d3
+++ b/a52/Makefile.am
0bd0d3
@@ -1,13 +1,21 @@
0bd0d3
-EXTRA_DIST = 60-a52-encoder.conf
0bd0d3
+GCONF_FILES = 60-a52-encoder.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_a52_LTLIBRARIES = libasound_module_pcm_a52.la
0bd0d3
-asound_module_addon_DATA = 60-a52-encoder.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_a52dir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @LIBAV_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
 
0bd0d3
 libasound_module_pcm_a52_la_SOURCES = pcm_a52.c
0bd0d3
 libasound_module_pcm_a52_la_LIBADD = @ALSA_LIBS@ @LIBAV_LIBS@ @LIBAV_CODEC_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/arcam-av/Makefile.am b/arcam-av/Makefile.am
0bd0d3
index 4a54ccd..c16aec0 100644
0bd0d3
--- a/arcam-av/Makefile.am
0bd0d3
+++ b/arcam-av/Makefile.am
0bd0d3
@@ -1,13 +1,21 @@
0bd0d3
-EXTRA_DIST = 50-arcam-av-ctl.conf
0bd0d3
+GCONF_FILES = 50-arcam-av-ctl.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
0bd0d3
-asound_module_addon_DATA = 50-arcam-av-ctl.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
0bd0d3
 
0bd0d3
 libasound_module_ctl_arcam_av_la_SOURCES = ctl_arcam_av.c arcam_av.c arcam_av.h
0bd0d3
 libasound_module_ctl_arcam_av_la_LIBADD = @ALSA_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/configure.ac b/configure.ac
0bd0d3
index cb1ae2d..f49bb6b 100644
0bd0d3
--- a/configure.ac
0bd0d3
+++ b/configure.ac
0bd0d3
@@ -210,17 +210,29 @@ AC_DEFINE_UNQUOTED(ALSA_DATA_DIR, "$alsadatadir", [directory containing ALSA dat
0bd0d3
 ALSA_DATA_DIR="$alsadatadir"
0bd0d3
 AC_SUBST(ALSA_DATA_DIR)
0bd0d3
 
0bd0d3
-dnl ALSA add-on config directory
0bd0d3
-AC_ARG_WITH(alsaaddondir,
0bd0d3
-    AS_HELP_STRING([--with-alsaaddondir=dir],
0bd0d3
-	[path where ALSA add-on config files are stored]),
0bd0d3
-    alsaaddondir="$withval", alsaaddondir="")
0bd0d3
-if test -z "$alsaaddondir"; then
0bd0d3
-    alsaaddondir="/etc/alsa/conf.d"
0bd0d3
+dnl ALSA add-on global config directory
0bd0d3
+AC_ARG_WITH(alsagconfdir,
0bd0d3
+    AS_HELP_STRING([--with-alsagconfdir=dir],
0bd0d3
+	[path where ALSA global add-on config files are stored]),
0bd0d3
+    alsagconfdir="$withval", alsagconfdir="")
0bd0d3
+if test -z "$alsagconfdir"; then
0bd0d3
+    alsagconfdir="$ALSA_DATA_DIR/alsa.conf.d"
0bd0d3
 fi
0bd0d3
-AC_DEFINE_UNQUOTED(ALSA_ADDON_DIR, "$alsaaddondir", [directory containing ALSA add-on config files])
0bd0d3
-ALSA_ADDON_DIR="$alsaaddondir"
0bd0d3
-AC_SUBST(ALSA_ADDON_DIR)
0bd0d3
+AC_DEFINE_UNQUOTED(ALSA_GCONF_DIR, "$alsagconfdir", [directory containing global ALSA add-on config files])
0bd0d3
+ALSA_GCONF_DIR="$alsagconfdir"
0bd0d3
+AC_SUBST(ALSA_GCONF_DIR)
0bd0d3
+
0bd0d3
+dnl ALSA add-on local config directory
0bd0d3
+AC_ARG_WITH(alsalconfdir,
0bd0d3
+    AS_HELP_STRING([--with-alsalconfdir=dir],
0bd0d3
+	[path where ALSA local add-on config files are stored]),
0bd0d3
+    alsalconfdir="$withval", alsalconfdir="")
0bd0d3
+if test -z "$alsalconfdir"; then
0bd0d3
+    alsalconfdir="/etc/alsa/conf.d"
0bd0d3
+fi
0bd0d3
+AC_DEFINE_UNQUOTED(ALSA_LCONF_DIR, "$alsalconfdir", [directory containing local ALSA add-on config files])
0bd0d3
+ALSA_LCONF_DIR="$alsalconfdir"
0bd0d3
+AC_SUBST(ALSA_LCONF_DIR)
0bd0d3
 
0bd0d3
 SAVE_PLUGINS_VERSION
0bd0d3
 
0bd0d3
diff --git a/install-hooks.am b/install-hooks.am
0bd0d3
new file mode 100644
0bd0d3
index 0000000..2d6d383
0bd0d3
--- /dev/null
0bd0d3
+++ b/install-hooks.am
0bd0d3
@@ -0,0 +1,16 @@
0bd0d3
+install-conf-hook:
0bd0d3
+	mkdir -p $(DESTDIR)$(ALSA_LCONF_DIR)
0bd0d3
+	@(echo cd $(DESTDIR)$(ALSA_LCONF_DIR);			\
0bd0d3
+	  cd $(DESTDIR)$(ALSA_LCONF_DIR);			\
0bd0d3
+	  for i in $(GCONF_FILES); do				\
0bd0d3
+	    echo $(RM) $$i";" ln -s $(ALSA_GCONF_DIR)/$$i .;	\
0bd0d3
+	    $(RM) $$i;						\
0bd0d3
+	    ln -s $(ALSA_GCONF_DIR)/$$i .;			\
0bd0d3
+	  done)
0bd0d3
+uninstall-conf-hook:
0bd0d3
+	@(echo cd $(DESTDIR)$(ALSA_LCONF_DIR);			\
0bd0d3
+	  cd $(DESTDIR)$(ALSA_LCONF_DIR);			\
0bd0d3
+	  for i in $(GCONF_FILES); do				\
0bd0d3
+	    echo $(RM) $$i;					\
0bd0d3
+	    $(RM) $$i;						\
0bd0d3
+	  done)
0bd0d3
diff --git a/jack/Makefile.am b/jack/Makefile.am
0bd0d3
index 0a3d6ae..7801194 100644
0bd0d3
--- a/jack/Makefile.am
0bd0d3
+++ b/jack/Makefile.am
0bd0d3
@@ -1,13 +1,21 @@
0bd0d3
-EXTRA_DIST = 50-jack.conf
0bd0d3
+GCONF_FILES = 50-jack.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_jack_LTLIBRARIES = libasound_module_pcm_jack.la
0bd0d3
-asound_module_addon_DATA = 50-jack.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_jackdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @JACK_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
 
0bd0d3
 libasound_module_pcm_jack_la_SOURCES = pcm_jack.c
0bd0d3
 libasound_module_pcm_jack_la_LIBADD = @ALSA_LIBS@ @JACK_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/maemo/Makefile.am b/maemo/Makefile.am
0bd0d3
index aca481d..7749926 100644
0bd0d3
--- a/maemo/Makefile.am
0bd0d3
+++ b/maemo/Makefile.am
0bd0d3
@@ -1,12 +1,14 @@
0bd0d3
-EXTRA_DIST = 98-maemo.conf
0bd0d3
+GCONF_FILES = 98-maemo.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_alsa_dsp_LTLIBRARIES = libasound_module_pcm_alsa_dsp.la
0bd0d3
 asound_module_ctl_dsp_ctl_LTLIBRARIES = libasound_module_ctl_dsp_ctl.la
0bd0d3
-asound_module_addon_DATA = 98-maemo.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_alsa_dspdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctl_dsp_ctldir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -O2 @ALSA_CFLAGS@ $(DBUS_CFLAGS)
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -19,3 +21,9 @@ libasound_module_ctl_dsp_ctl_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread
0bd0d3
 
0bd0d3
 noinst_HEADERS = constants.h debug.h dsp-protocol.h list.h reporting.h \
0bd0d3
 	         types.h
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/mix/Makefile.am b/mix/Makefile.am
0bd0d3
index 710606c..a74c200 100644
0bd0d3
--- a/mix/Makefile.am
0bd0d3
+++ b/mix/Makefile.am
0bd0d3
@@ -1,12 +1,14 @@
0bd0d3
-EXTRA_DIST = 60-upmix.conf 60-vdownmix.conf
0bd0d3
+GCONF_FILES = 60-upmix.conf 60-vdownmix.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_upmix_LTLIBRARIES = libasound_module_pcm_upmix.la
0bd0d3
 asound_module_pcm_vdownmix_LTLIBRARIES = libasound_module_pcm_vdownmix.la
0bd0d3
-asound_module_addon_DATA = 60-upmix.conf 60-vdownmix.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_upmixdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_pcm_vdownmixdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -15,3 +17,9 @@ libasound_module_pcm_upmix_la_SOURCES = pcm_upmix.c
0bd0d3
 libasound_module_pcm_upmix_la_LIBADD = @ALSA_LIBS@
0bd0d3
 libasound_module_pcm_vdownmix_la_SOURCES = pcm_vdownmix.c
0bd0d3
 libasound_module_pcm_vdownmix_la_LIBADD = @ALSA_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/oss/Makefile.am b/oss/Makefile.am
0bd0d3
index df83d20..46dfcac 100644
0bd0d3
--- a/oss/Makefile.am
0bd0d3
+++ b/oss/Makefile.am
0bd0d3
@@ -1,12 +1,14 @@
0bd0d3
-EXTRA_DIST = 50-oss.conf
0bd0d3
+GCONF_FILEs = 50-oss.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_oss_LTLIBRARIES = libasound_module_pcm_oss.la
0bd0d3
 asound_module_ctl_oss_LTLIBRARIES = libasound_module_ctl_oss.la
0bd0d3
-asound_module_addon_DATA = 50-oss.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_ossdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctl_ossdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -16,3 +18,9 @@ libasound_module_pcm_oss_la_LIBADD = @ALSA_LIBS@
0bd0d3
 
0bd0d3
 libasound_module_ctl_oss_la_SOURCES = ctl_oss.c
0bd0d3
 libasound_module_ctl_oss_la_LIBADD = @ALSA_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/pph/Makefile.am b/pph/Makefile.am
0bd0d3
index abb950b..6938b74 100644
0bd0d3
--- a/pph/Makefile.am
0bd0d3
+++ b/pph/Makefile.am
0bd0d3
@@ -1,10 +1,12 @@
0bd0d3
-EXTRA_DIST = 10-speexrate.conf
0bd0d3
+GCONF_FILES = 10-speexrate.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_speexrate_LTLIBRARIES = libasound_module_rate_speexrate.la
0bd0d3
-asound_module_addon_DATA = 10-speexrate.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_speexratedir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -DVAR_ARRAYS -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -20,6 +22,10 @@ libasound_module_rate_speexrate_la_SOURCES += resample.c
0bd0d3
 libasound_module_rate_speexrate_la_LIBADD += -lm
0bd0d3
 endif
0bd0d3
 
0bd0d3
+noinst_HEADERS = speex_resampler.h arch.h fixed_generic.h
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
 install-exec-hook:
0bd0d3
 	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_speexrate_*.so
0bd0d3
 	$(LN_S) libasound_module_rate_speexrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_speexrate_best.so
0bd0d3
@@ -28,4 +34,6 @@ install-exec-hook:
0bd0d3
 uninstall-hook:
0bd0d3
 	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_speexrate_*.so
0bd0d3
 
0bd0d3
-noinst_HEADERS = speex_resampler.h arch.h fixed_generic.h
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/pulse/Makefile.am b/pulse/Makefile.am
0bd0d3
index 835808c..c33e702 100644
0bd0d3
--- a/pulse/Makefile.am
0bd0d3
+++ b/pulse/Makefile.am
0bd0d3
@@ -1,14 +1,19 @@
0bd0d3
-EXTRA_DIST = 50-pulseaudio.conf 99-pulseaudio-default.conf.example
0bd0d3
+GCONF_FILES = 50-pulseaudio.conf
0bd0d3
+LCONF_FILES = 99-pulseaudio-default.conf.example
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES) $(LCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_LTLIBRARIES = libasound_module_pcm_pulse.la
0bd0d3
 asound_module_ctl_LTLIBRARIES = libasound_module_ctl_pulse.la
0bd0d3
 asound_module_conf_LTLIBRARIES = libasound_module_conf_pulse.la
0bd0d3
-asound_module_addon_DATA = 50-pulseaudio.conf 99-pulseaudio-default.conf.example
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
+asound_module_lconf_DATA = $(LCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcmdir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_ctldir = @ALSA_PLUGIN_DIR@
0bd0d3
 asound_module_confdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
+asound_module_lconfdir = @ALSA_LCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(PTHREAD_CFLAGS) $(pulseaudio_CFLAGS) -D_GNU_SOURCE
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -21,3 +26,9 @@ libasound_module_ctl_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_
0bd0d3
 
0bd0d3
 libasound_module_conf_pulse_la_SOURCES = conf_pulse.c
0bd0d3
 libasound_module_conf_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/rate-lav/Makefile.am b/rate-lav/Makefile.am
0bd0d3
index 0f6ecb6..eb672b5 100644
0bd0d3
--- a/rate-lav/Makefile.am
0bd0d3
+++ b/rate-lav/Makefile.am
0bd0d3
@@ -1,10 +1,12 @@
0bd0d3
-EXTRA_DIST = 10-rate-lav.conf
0bd0d3
+GCONF_FILES = 10-rate-lav.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_lavrate_LTLIBRARIES = libasound_module_rate_lavrate.la
0bd0d3
-asound_module_addon_DATA = 10-rate-lav.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_lavratedir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @LIBAV_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -14,6 +16,8 @@ libasound_module_rate_lavrate_la_LIBADD = @ALSA_LIBS@ @LIBAV_LIBS@ @LIBAV_RESAMP
0bd0d3
 
0bd0d3
 noinst_HEADERS = gcd.h
0bd0d3
 
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
 install-exec-hook:
0bd0d3
 	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_*.so
0bd0d3
 	$(LN_S) libasound_module_rate_lavrate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_higher.so
0bd0d3
@@ -23,3 +27,6 @@ install-exec-hook:
0bd0d3
 
0bd0d3
 uninstall-hook:
0bd0d3
 	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_lavrate_*.so
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/rate/Makefile.am b/rate/Makefile.am
0bd0d3
index 25014d8..488c12a 100644
0bd0d3
--- a/rate/Makefile.am
0bd0d3
+++ b/rate/Makefile.am
0bd0d3
@@ -1,10 +1,12 @@
0bd0d3
-EXTRA_DIST = 10-samplerate.conf
0bd0d3
+GCONF_FILES = 10-samplerate.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_samplerate_LTLIBRARIES = libasound_module_rate_samplerate.la
0bd0d3
-asound_module_addon_DATA = 10-samplerate.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_rate_sampleratedir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(samplerate_CFLAGS)
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -12,6 +14,8 @@ AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUN
0bd0d3
 libasound_module_rate_samplerate_la_SOURCES = rate_samplerate.c
0bd0d3
 libasound_module_rate_samplerate_la_LIBADD = @ALSA_LIBS@ @samplerate_LIBS@
0bd0d3
 
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
 install-exec-hook:
0bd0d3
 	rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_samplerate_*.so
0bd0d3
 	$(LN_S) libasound_module_rate_samplerate.so $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_samplerate_best.so
0bd0d3
@@ -21,3 +25,7 @@ install-exec-hook:
0bd0d3
 
0bd0d3
 uninstall-hook:
0bd0d3
 	rm -f $(DESTDIR)$(libdir)/alsa-lib/libasound_module_rate_samplerate_*.so
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/speex/Makefile.am b/speex/Makefile.am
0bd0d3
index 7891954..27c4ea5 100644
0bd0d3
--- a/speex/Makefile.am
0bd0d3
+++ b/speex/Makefile.am
0bd0d3
@@ -1,13 +1,21 @@
0bd0d3
-EXTRA_DIST = 60-speex.conf
0bd0d3
+GCONF_FILES = 60-speex.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_speex_LTLIBRARIES = libasound_module_pcm_speex.la
0bd0d3
-asound_module_addon_DATA = 60-speex.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_speexdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ @speexdsp_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
0bd0d3
 
0bd0d3
 libasound_module_pcm_speex_la_SOURCES = pcm_speex.c
0bd0d3
 libasound_module_pcm_speex_la_LIBADD = @ALSA_LIBS@ @speexdsp_LIBS@
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
diff --git a/usb_stream/Makefile.am b/usb_stream/Makefile.am
0bd0d3
index b606d3d..203618b 100644
0bd0d3
--- a/usb_stream/Makefile.am
0bd0d3
+++ b/usb_stream/Makefile.am
0bd0d3
@@ -1,10 +1,12 @@
0bd0d3
-EXTRA_DIST = 98-usb-stream.conf
0bd0d3
+GCONF_FILES = 98-usb-stream.conf
0bd0d3
+
0bd0d3
+EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_usb_stream_LTLIBRARIES = libasound_module_pcm_usb_stream.la
0bd0d3
-asound_module_addon_DATA = 98-usb-stream.conf
0bd0d3
+asound_module_gconf_DATA = $(GCONF_FILES)
0bd0d3
 
0bd0d3
 asound_module_pcm_usb_streamdir = @ALSA_PLUGIN_DIR@
0bd0d3
-asound_module_addondir = @ALSA_ADDON_DIR@
0bd0d3
+asound_module_gconfdir = @ALSA_GCONF_DIR@
0bd0d3
 
0bd0d3
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic $(LDFLAGS_NOUNDEFINED)
0bd0d3
@@ -13,3 +15,9 @@ libasound_module_pcm_usb_stream_la_SOURCES = pcm_usb_stream.c
0bd0d3
 libasound_module_pcm_usb_stream_la_LIBADD = @ALSA_LIBS@
0bd0d3
 
0bd0d3
 noinst_HEADERS = usb_stream.h
0bd0d3
+
0bd0d3
+include ../install-hooks.am
0bd0d3
+
0bd0d3
+install-data-hook: install-conf-hook
0bd0d3
+
0bd0d3
+uninstall-local: uninstall-conf-hook
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From beb24e58763e3b1d831fcd7ef87a478e6ac74fcc Mon Sep 17 00:00:00 2001
0bd0d3
From: Jaroslav Kysela <perex@perex.cz>
0bd0d3
Date: Mon, 16 Apr 2018 18:14:18 +0200
0bd0d3
Subject: [PATCH 6/8] oss/Makefile.am: fix typo
0bd0d3
0bd0d3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
0bd0d3
---
0bd0d3
 oss/Makefile.am | 2 +-
0bd0d3
 1 file changed, 1 insertion(+), 1 deletion(-)
0bd0d3
0bd0d3
diff --git a/oss/Makefile.am b/oss/Makefile.am
0bd0d3
index 46dfcac..bff4443 100644
0bd0d3
--- a/oss/Makefile.am
0bd0d3
+++ b/oss/Makefile.am
0bd0d3
@@ -1,4 +1,4 @@
0bd0d3
-GCONF_FILEs = 50-oss.conf
0bd0d3
+GCONF_FILES = 50-oss.conf
0bd0d3
 
0bd0d3
 EXTRA_DIST = $(GCONF_FILES)
0bd0d3
 
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From 992b7eb1f1fe95fe7b8b622042aa32c33fffd18d Mon Sep 17 00:00:00 2001
0bd0d3
From: Takashi Iwai <tiwai@suse.de>
0bd0d3
Date: Tue, 22 May 2018 14:13:53 +0200
0bd0d3
Subject: [PATCH 7/8] arcam-av: Add explicit -lpthread to *_LIBADD
0bd0d3
0bd0d3
The pthread library has to be linked for this module.  In some tool
0bd0d3
chains, it results in a build error.
0bd0d3
0bd0d3
Signed-off-by: Takashi Iwai <tiwai@suse.de>
0bd0d3
---
0bd0d3
 arcam-av/Makefile.am | 2 +-
0bd0d3
 1 file changed, 1 insertion(+), 1 deletion(-)
0bd0d3
0bd0d3
diff --git a/arcam-av/Makefile.am b/arcam-av/Makefile.am
0bd0d3
index c16aec0..57d5542 100644
0bd0d3
--- a/arcam-av/Makefile.am
0bd0d3
+++ b/arcam-av/Makefile.am
0bd0d3
@@ -12,7 +12,7 @@ AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
0bd0d3
 
0bd0d3
 libasound_module_ctl_arcam_av_la_SOURCES = ctl_arcam_av.c arcam_av.c arcam_av.h
0bd0d3
-libasound_module_ctl_arcam_av_la_LIBADD = @ALSA_LIBS@
0bd0d3
+libasound_module_ctl_arcam_av_la_LIBADD = @ALSA_LIBS@ -lpthread
0bd0d3
 
0bd0d3
 include ../install-hooks.am
0bd0d3
 
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3
0bd0d3
0bd0d3
From 2d310f84e7af4c5b4bc68a6e45500e874df482f9 Mon Sep 17 00:00:00 2001
0bd0d3
From: Takashi Iwai <tiwai@suse.de>
0bd0d3
Date: Tue, 22 May 2018 14:15:21 +0200
0bd0d3
Subject: [PATCH 8/8] usb_stream: Add explicit -lpthread to *_LIBADD
0bd0d3
0bd0d3
The pthread library has to be linked for this module.  In some tool
0bd0d3
chains, it results in a build error.
0bd0d3
0bd0d3
Signed-off-by: Takashi Iwai <tiwai@suse.de>
0bd0d3
---
0bd0d3
 usb_stream/Makefile.am | 2 +-
0bd0d3
 1 file changed, 1 insertion(+), 1 deletion(-)
0bd0d3
0bd0d3
diff --git a/usb_stream/Makefile.am b/usb_stream/Makefile.am
0bd0d3
index 203618b..fde2455 100644
0bd0d3
--- a/usb_stream/Makefile.am
0bd0d3
+++ b/usb_stream/Makefile.am
0bd0d3
@@ -12,7 +12,7 @@ AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
0bd0d3
 AM_LDFLAGS = -module -avoid-version -export-dynamic $(LDFLAGS_NOUNDEFINED)
0bd0d3
 
0bd0d3
 libasound_module_pcm_usb_stream_la_SOURCES = pcm_usb_stream.c
0bd0d3
-libasound_module_pcm_usb_stream_la_LIBADD = @ALSA_LIBS@
0bd0d3
+libasound_module_pcm_usb_stream_la_LIBADD = @ALSA_LIBS@ -lpthread
0bd0d3
 
0bd0d3
 noinst_HEADERS = usb_stream.h
0bd0d3
 
0bd0d3
-- 
0bd0d3
2.13.6
0bd0d3