libav: allow to use libavresample >= 1.1.0

This commit is contained in:
Jaroslav Kysela 2014-10-10 10:45:27 +02:00
parent 4e098bd877
commit 39961d489f
2 changed files with 6 additions and 3 deletions

2
configure vendored
View file

@ -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

View 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