Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-17 17:11:43 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-12-17 17:11:51 +0400
commit082dd17bd267c39e5a681a78132a1849db70d478 (patch)
tree8c834c1679ed150d45fae38fe2954abe79ce5ff8 /libavresample
parent8d07bbca6360a938c607dab4dcb333e12f3d915b (diff)
parent0cf3505930913d3584b215f6912de04ff41366e0 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: avresample: use valid log context in mixing functions lavr: remove automatic context close/open for resampling compensation Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavresample')
-rw-r--r--libavresample/audio_mix.c10
-rw-r--r--libavresample/avresample.h9
-rw-r--r--libavresample/resample.c9
-rw-r--r--libavresample/version.h4
4 files changed, 20 insertions, 12 deletions
diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c
index 62f8bd6c6d..2b3d9f1f7a 100644
--- a/libavresample/audio_mix.c
+++ b/libavresample/audio_mix.c
@@ -467,13 +467,13 @@ int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride)
if ( am->in_channels <= 0 || am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
- av_log(am, AV_LOG_ERROR, "Invalid channel counts\n");
+ av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n");
return AVERROR(EINVAL);
}
#define GET_MATRIX_CONVERT(suffix, scale) \
if (!am->matrix_ ## suffix[0]) { \
- av_log(am, AV_LOG_ERROR, "matrix is not set\n"); \
+ av_log(am->avr, AV_LOG_ERROR, "matrix is not set\n"); \
return AVERROR(EINVAL); \
} \
for (o = 0; o < am->out_channels; o++) \
@@ -491,7 +491,7 @@ int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride)
GET_MATRIX_CONVERT(flt, 1.0);
break;
default:
- av_log(am, AV_LOG_ERROR, "Invalid mix coeff type\n");
+ av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
return AVERROR(EINVAL);
}
@@ -504,7 +504,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
if ( am->in_channels <= 0 || am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
- av_log(am, AV_LOG_ERROR, "Invalid channel counts\n");
+ av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n");
return AVERROR(EINVAL);
}
@@ -540,7 +540,7 @@ int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
CONVERT_MATRIX(flt, v)
break;
default:
- av_log(am, AV_LOG_ERROR, "Invalid mix coeff type\n");
+ av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
return AVERROR(EINVAL);
}
diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index a73d6865ac..4841d262c0 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -252,11 +252,10 @@ int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
/**
* Set compensation for resampling.
*
- * This can be called anytime after avresample_open(). If resampling was not
- * being done previously, the AVAudioResampleContext is closed and reopened
- * with resampling enabled. In this case, any samples remaining in the output
- * FIFO and the current channel mixing matrix will be restored after reopening
- * the context.
+ * This can be called anytime after avresample_open(). If resampling is not
+ * automatically enabled because of a sample rate conversion, the
+ * "force_resampling" option must have been set to 1 when opening the context
+ * in order to use resampling compensation.
*
* @param avr audio resample context
* @param sample_delta compensation delta, in samples
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;
diff --git a/libavresample/version.h b/libavresample/version.h
index 53ba802d85..834c942d93 100644
--- a/libavresample/version.h
+++ b/libavresample/version.h
@@ -39,4 +39,8 @@
* the public API and may change, break or disappear at any time.
*/
+#ifndef FF_API_RESAMPLE_CLOSE_OPEN
+#define FF_API_RESAMPLE_CLOSE_OPEN (LIBAVRESAMPLE_VERSION_MAJOR < 2)
+#endif
+
#endif /* AVRESAMPLE_VERSION_H */