aboutsummaryrefslogtreecommitdiff
path: root/audio/audio_template.h
diff options
context:
space:
mode:
authorKővágó, Zoltán <dirty.ice.hu@gmail.com>2019-10-13 21:57:59 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-10-18 08:14:05 +0200
commit1930616b98c3669de2df0b271a98a308d6f85083 (patch)
treef7cf6e32ffd101684db324bb2cdbebfe4a303304 /audio/audio_template.h
parent8efac073a58ff135b805f895325463166eafdc48 (diff)
audio: make mixeng optional
Implementation of the previously added mixing-engine option. Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com> Message-id: c05bc258889ed289e8ee1bdbcc5e84174ec221e7.1570996490.git.DirtY.iCE.hu@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio_template.h')
-rw-r--r--audio/audio_template.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 1006d6b1eb..3287d7075e 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -78,13 +78,17 @@ static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
static void glue(audio_pcm_hw_alloc_resources_, TYPE)(HW *hw)
{
- size_t samples = hw->samples;
- if (audio_bug(__func__, samples == 0)) {
- dolog("Attempted to allocate empty buffer\n");
- }
+ if (glue(audio_get_pdo_, TYPE)(hw->s->dev)->mixing_engine) {
+ size_t samples = hw->samples;
+ if (audio_bug(__func__, samples == 0)) {
+ dolog("Attempted to allocate empty buffer\n");
+ }
- HWBUF = g_malloc0(sizeof(STSampleBuffer) + sizeof(st_sample) * samples);
- HWBUF->size = samples;
+ HWBUF = g_malloc0(sizeof(STSampleBuffer) + sizeof(st_sample) * samples);
+ HWBUF->size = samples;
+ } else {
+ HWBUF = NULL;
+ }
}
static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw)
@@ -103,6 +107,10 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
{
int samples;
+ if (!glue(audio_get_pdo_, TYPE)(sw->s->dev)->mixing_engine) {
+ return 0;
+ }
+
samples = ((int64_t) sw->HWBUF->size << 32) / sw->ratio;
sw->buf = audio_calloc(__func__, samples, sizeof(struct st_sample));
@@ -328,9 +336,9 @@ static HW *glue(audio_pcm_hw_add_, TYPE)(AudioState *s, struct audsettings *as)
HW *hw;
AudiodevPerDirectionOptions *pdo = glue(audio_get_pdo_, TYPE)(s->dev);
- if (pdo->fixed_settings) {
+ if (!pdo->mixing_engine || pdo->fixed_settings) {
hw = glue(audio_pcm_hw_add_new_, TYPE)(s, as);
- if (hw) {
+ if (!pdo->mixing_engine || hw) {
return hw;
}
}