aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample/swresample.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-02 00:51:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-02 01:12:16 +0200
commit33f7033452ad59c86d1b34fd57c30f2c693bf04a (patch)
treeca111970ee7fc09514a7175ef6073f042462992f /libswresample/swresample.c
parentf2e799a3d08b4a0ff2d2821f58e69cd40cda0a53 (diff)
downloadffmpeg-33f7033452ad59c86d1b34fd57c30f2c693bf04a.tar.gz
swr: automatically choose s16/flt/dbl to preserve input precision unless user overrides.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample.c')
-rw-r--r--libswresample/swresample.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 87a885be1a..6566199624 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -208,11 +208,16 @@ int swr_init(struct SwrContext *s){
return AVERROR(EINVAL);
}
- //FIXME should we allow/support using FLT on material that doesnt need it ?
- if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_S16P || s->int_sample_fmt==AV_SAMPLE_FMT_S16P){
- s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
- }else
- s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
+ 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;
+ }else if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_FLTP){
+ s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
+ }else{
+ av_log(s, AV_LOG_DEBUG, "Using double precission mode\n");
+ s->int_sample_fmt= AV_SAMPLE_FMT_DBLP;
+ }
+ }
if( s->int_sample_fmt != AV_SAMPLE_FMT_S16P
&&s->int_sample_fmt != AV_SAMPLE_FMT_S32P