$ git clone http://tcclient.ion.nu/tc_client.git
commit 51e993071122a4cf33d17993103a0d30a6cecd0d
Author: Alicia <...>
Date:   Fri Dec 2 14:45:24 2016 +0100

    tc_client-gtk: compatibility with older versions of libavformat.

diff --git a/ChangeLog b/ChangeLog
index 15b7235..251eab3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ tc_client-gtk: rewrote the audio mixer.
 tc_client-gtk: display the channel name in the window title.
 tc_client-gtk: added a setting to control /disablesnapshots and /enablesnapshots.
 tc_client-gtk: added support for integrated youtube videos.
+tc_client-gtk: compatibility with older versions of libavformat.
 dist/appimage.sh: fix audio in appimages by building ffmpeg with support for nellymoser and speex, and depending on the system's libao and libpulse instead of including it in the appimage.
 libcamera(escapi): handle failure to open camera more gracefully.
 irchack: pass along "<user> cammed up" notifications.
diff --git a/configure b/configure
index 8e2ad2e..7616e16 100755
--- a/configure
+++ b/configure
@@ -137,7 +137,10 @@ else
 fi
 
 testpkgconfig libswscale SWSCALE
-testpkgconfig libavformat AVFORMAT
+if testpkgconfig libavformat AVFORMAT && ! testbuild 'avcodec_parameters_to_context' 'void* x=avcodec_parameters_to_context;' 'libavcodec/avcodec.h' "$avcodecflags"; then
+  echo '#define codecpar codec' >> config.h
+  echo '#define avcodec_parameters_to_context(a, b) avcodec_free_context(&a); a=b' >> config.h
+fi
 
 printf 'Checking for libavutil... '
 avutillibs="`pkg-config --libs libavutil 2> /dev/null`"
diff --git a/utilities/gtk/playmedia.c b/utilities/gtk/playmedia.c
index 89ff815..85ed634 100644
--- a/utilities/gtk/playmedia.c
+++ b/utilities/gtk/playmedia.c
@@ -1,10 +1,28 @@
+/*
+    tc_client-gtk, a graphical user interface for tc_client
+    Copyright (C) 2016  alicia@ion.nu
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, version 3 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 #ifdef HAVE_AVFORMAT
 #include <stdio.h>
 #include <unistd.h>
 #include <libavformat/avformat.h>
 #include <libavformat/avio.h>
+#include <libavutil/opt.h>
 #include "media.h"
 #include "main.h"
+#include "config.h"
 #include "playmedia.h"
 
 struct frame
@@ -131,7 +149,7 @@ void* playmedia(void* data)
   cam->samplerate=cam->actx->sample_rate;
   // TODO: Figure out why planar formats don't resample well without pretending they're non-planar (sample case: PXj51mQHz5I)
   //  For now, just pass off the first planar channel as non-planar single-channel
-  enum AVSampleFormat samplefmt=av_get_alt_sample_fmt(cam->actx->sample_fmt, 0);
+  enum AVSampleFormat samplefmt=av_get_packed_sample_fmt(cam->actx->sample_fmt);
   int chanlayout=cam->actx->channel_layout;
   if(samplefmt!=cam->actx->sample_fmt){chanlayout=AV_CH_FRONT_CENTER;}
   #ifdef HAVE_AVRESAMPLE
diff --git a/utilities/gtk/playmedia.h b/utilities/gtk/playmedia.h
index e0607e7..532e5f1 100644
--- a/utilities/gtk/playmedia.h
+++ b/utilities/gtk/playmedia.h
@@ -1,3 +1,19 @@
+/*
+    tc_client-gtk, a graphical user interface for tc_client
+    Copyright (C) 2016  alicia@ion.nu
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, version 3 of the License.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 #ifdef HAVE_AVFORMAT
 extern void* playmedia(void* data);
 extern void media_play(const char* args);