summaryrefslogtreecommitdiff
path: root/libavresample/resample.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-11-29 20:58:05 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-12-16 19:26:17 -0500
commitf1c2915ce1ea36782e0aebd108cd48db53b03c8b (patch)
tree2f731aabde61773143ca83c12872b4b7482451af /libavresample/resample.c
parentf322b2073581119de5da74f92a03309a36891cfa (diff)
lavr: remove automatic context close/open for resampling compensation
It adds unnecessary complication for insignificant usability improvement. The user really should know if they'll need resampling compensation before opening the context. Note that only the documentation has changed. The current functionality will still work until the next major bump.
Diffstat (limited to 'libavresample/resample.c')
-rw-r--r--libavresample/resample.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavresample/resample.c b/libavresample/resample.c
index 15eaa50e23..dc121fe56d 100644
--- a/libavresample/resample.c
+++ b/libavresample/resample.c
@@ -255,9 +255,10 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
if (!compensation_distance && sample_delta)
return AVERROR(EINVAL);
- /* if resampling was not enabled previously, re-initialize the
- AVAudioResampleContext and force resampling */
if (!avr->resample_needed) {
+#if FF_API_RESAMPLE_CLOSE_OPEN
+ /* if resampling was not enabled previously, re-initialize the
+ AVAudioResampleContext and force resampling */
int fifo_samples;
int restore_matrix = 0;
double matrix[AVRESAMPLE_MAX_CHANNELS * AVRESAMPLE_MAX_CHANNELS] = { 0 };
@@ -307,6 +308,10 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
goto reinit_fail;
ff_audio_data_free(&fifo_buf);
}
+#else
+ av_log(avr, AV_LOG_ERROR, "Unable to set resampling compensation\n");
+ return AVERROR(EINVAL);
+#endif
}
c = avr->resample;
c->compensation_distance = compensation_distance;