]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
libav: allow to use libavresample >= 1.1.0
authorJaroslav Kysela <perex@perex.cz>
Fri, 10 Oct 2014 08:45:27 +0000 (10:45 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 10 Oct 2014 08:45:27 +0000 (10:45 +0200)
configure
src/plumbing/transcoding.c

index 91880e6a80d5420972e9d3294a4785801093e3e6..b4bd5f72988e3b4a483283d85430e007e8c193c9 100755 (executable)
--- a/configure
+++ b/configure
@@ -295,7 +295,7 @@ if enabled_or_auto libav; then
     has_libav=false
   fi
 
-  if $has_libav && ! check_pkg libavresample ">=2.1.0"; then
+  if $has_libav && ! check_pkg libavresample ">=1.1.0"; then
     has_libav=false
   fi
 
index e94b6abf8337b01c10833227965008998bae6960..309b1820dd58d0340e821787538075fb3bcbbdca 100644 (file)
@@ -77,6 +77,7 @@ typedef struct audio_stream {
   AVAudioResampleContext *resample_context;
   AVAudioFifo     *fifo;
   int             resample;
+  int             resample_is_open;
 #endif
 
 } audio_stream_t;
@@ -543,7 +544,7 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt)
   }
 
   if (length < 0) {
-    tvhlog(LOG_ERR, "transcode", "length < 0.\n");
+    tvhlog(LOG_ERR, "transcode", "length < 0 (%i).\n", length);
     ts->ts_index = 0;
     goto cleanup;
   }
@@ -760,6 +761,7 @@ transcoder_stream_audio(transcoder_stream_t *ts, th_pkt_t *pkt)
         ts->ts_index = 0;
         goto cleanup;
       }
+      as->resample_is_open = 1;
 
     }
 
@@ -1467,8 +1469,9 @@ transcoder_destroy_audio(transcoder_stream_t *ts)
     av_free(as->aud_enc_sample);
 
 #if LIBAVCODEC_VERSION_MAJOR > 54 || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR >= 25)
-  if ((as->resample_context) && (avresample_is_open(as->resample_context)) )
+  if ((as->resample_context) && as->resample_is_open )
       avresample_close(as->resample_context);
+  avresample_free(&as->resample_context);
 
   av_audio_fifo_free(as->fifo);
 #endif