From c5cd49d75f2ec31695d7cc9debaf7680a7bbd8f0 Mon Sep 17 00:00:00 2001
From: wm4 <wm4@nowhere>
Date: Fri, 23 Jun 2017 15:33:02 +0200
Subject: [PATCH] player/audio: mark some libaf interfacing parts as GPL only

"anders" has not agreed to relicense most of his changes (although he
gave permission for 4943e9c52c and 242aa6ebd4).

Note that commit 3053a8b7f is in part also affected. The commit message
hides this, but it seems some code was based on anders':

http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-October/011773.html

Much of the final commit was by Arpi, but it's still grating that there
was no proper attribution (and in a case that turned out to be so
important).

This means player/audio.c won't even compile (and other parts of the
player also use audio/audio.h, which is still GPL). But whether the end
result compiles doesn't matter for copyright.

Due to the heavy refactoring applied over the year, the boundaries are
rather fuzzy and also somewhat arbitrary, though.

Most of this code will have to be replaced with a new filter chain
later.
---
 player/audio.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/player/audio.c b/player/audio.c
index 51c84afb7a..87faa68efa 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -177,6 +177,7 @@ void audio_update_volume(struct MPContext *mpctx)
     if (opts->softvol_mute == 1)
         gain = 0.0;
 
+#if HAVE_GPL
     if (!af_control_any_rev(ao_c->af, AF_CONTROL_SET_VOLUME, &gain)) {
         if (gain == 1.0)
             return;
@@ -186,6 +187,7 @@ void audio_update_volume(struct MPContext *mpctx)
               && af_control_any_rev(ao_c->af, AF_CONTROL_SET_VOLUME, &gain)))
             MP_ERR(mpctx, "No volume control available.\n");
     }
+#endif
 }
 
 /* NOTE: Currently the balance code is seriously buggy: it always changes
@@ -233,6 +235,7 @@ static int recreate_audio_filters(struct MPContext *mpctx)
 {
     assert(mpctx->ao_chain);
 
+#if HAVE_GPL
     struct af_stream *afs = mpctx->ao_chain->af;
     if (afs->initialized < 1 && af_init(afs) < 0)
         goto fail;
@@ -240,6 +243,7 @@ static int recreate_audio_filters(struct MPContext *mpctx)
     recreate_speed_filters(mpctx);
     if (afs->initialized < 1 && af_init(afs) < 0)
         goto fail;
+#endif
 
     if (mpctx->opts->softvol == SOFTVOL_NO)
         MP_ERR(mpctx, "--softvol=no is not supported anymore.\n");
@@ -407,6 +411,7 @@ static void reinit_audio_filters_and_output(struct MPContext *mpctx)
         }
     }
 
+#if HAVE_GPL
     // filter input format: same as codec's output format:
     afs->input = in_format;
 
@@ -502,6 +507,7 @@ static void reinit_audio_filters_and_output(struct MPContext *mpctx)
 
     if (recreate_audio_filters(mpctx) < 0)
         goto init_error;
+#endif
 
     update_playback_speed(mpctx);
 
@@ -840,6 +846,7 @@ static int decode_new_frame(struct ao_chain *ao_c)
     }
 }
 
+#if HAVE_GPL
 /* Try to get at least minsamples decoded+filtered samples in outbuf
  * (total length including possible existing data).
  * Return 0 on success, or negative AD_* error code.
@@ -909,6 +916,7 @@ static int filter_audio(struct MPContext *mpctx, struct mp_audio_buffer *outbuf,
 
     return res;
 }
+#endif
 
 void reload_audio_output(struct MPContext *mpctx)
 {