summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-02-04 03:00:12 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-02-04 03:05:59 (GMT)
commitbe989f92367839201456c95356f1c4dc13223671 (patch)
tree45b4c7ef7f151df7d8926dda79854e64eb779da1
parent24244cec2fdd3d3ade79a32d5f0b3ccf5eae01ff (diff)
downloadffmpeg-be989f92367839201456c95356f1c4dc13223671.zip
ffmpeg-be989f92367839201456c95356f1c4dc13223671.tar.gz
ffmpeg-be989f92367839201456c95356f1c4dc13223671.tar.bz2
swr: reorder init code to make rematrix status available earlier
This also makes some other fields available earlier which may be usefull one day Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--libswresample/swresample.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index e55f9be..bb2bf05 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -265,6 +265,33 @@ av_cold int swr_init(struct SwrContext *s){
return AVERROR(EINVAL);
}
+ switch(s->engine){
+#if CONFIG_LIBSOXR
+ extern struct Resampler const soxr_resampler;
+ case SWR_ENGINE_SOXR: s->resampler = &soxr_resampler; break;
+#endif
+ case SWR_ENGINE_SWR : s->resampler = &swri_resampler; break;
+ default:
+ av_log(s, AV_LOG_ERROR, "Requested resampling engine is unavailable\n");
+ return AVERROR(EINVAL);
+ }
+
+ if(!s->used_ch_count)
+ s->used_ch_count= s->in.ch_count;
+
+ if(s->used_ch_count && s-> in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s-> in_ch_layout)){
+ av_log(s, AV_LOG_WARNING, "Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
+ s-> in_ch_layout= 0;
+ }
+
+ if(!s-> in_ch_layout)
+ s-> in_ch_layout= av_get_default_channel_layout(s->used_ch_count);
+ if(!s->out_ch_layout)
+ s->out_ch_layout= av_get_default_channel_layout(s->out.ch_count);
+
+ s->rematrix= s->out_ch_layout !=s->in_ch_layout || s->rematrix_volume!=1.0 ||
+ s->rematrix_custom;
+
if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_S16P){
s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
@@ -284,17 +311,6 @@ av_cold int swr_init(struct SwrContext *s){
return AVERROR(EINVAL);
}
- switch(s->engine){
-#if CONFIG_LIBSOXR
- extern struct Resampler const soxr_resampler;
- case SWR_ENGINE_SOXR: s->resampler = &soxr_resampler; break;
-#endif
- case SWR_ENGINE_SWR : s->resampler = &swri_resampler; break;
- default:
- av_log(s, AV_LOG_ERROR, "Requested resampling engine is unavailable\n");
- return AVERROR(EINVAL);
- }
-
set_audiodata_fmt(&s-> in, s-> in_sample_fmt);
set_audiodata_fmt(&s->out, s->out_sample_fmt);
@@ -326,22 +342,6 @@ av_cold int swr_init(struct SwrContext *s){
return -1;
}
- if(!s->used_ch_count)
- s->used_ch_count= s->in.ch_count;
-
- if(s->used_ch_count && s-> in_ch_layout && s->used_ch_count != av_get_channel_layout_nb_channels(s-> in_ch_layout)){
- av_log(s, AV_LOG_WARNING, "Input channel layout has a different number of channels than the number of used channels, ignoring layout\n");
- s-> in_ch_layout= 0;
- }
-
- if(!s-> in_ch_layout)
- s-> in_ch_layout= av_get_default_channel_layout(s->used_ch_count);
- if(!s->out_ch_layout)
- s->out_ch_layout= av_get_default_channel_layout(s->out.ch_count);
-
- s->rematrix= s->out_ch_layout !=s->in_ch_layout || s->rematrix_volume!=1.0 ||
- s->rematrix_custom;
-
#define RSC 1 //FIXME finetune
if(!s-> in.ch_count)
s-> in.ch_count= av_get_channel_layout_nb_channels(s-> in_ch_layout);