[FFmpeg-cvslog] swr: support int32 and float as internal sample formats
Michael Niedermayer
git at videolan.org
Tue Apr 10 13:33:23 CEST 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Apr 10 13:19:29 2012 +0200| [3d9338b1c23f1909527a7a7a8d6c4de9da3e7f8d] | committer: Michael Niedermayer
swr: support int32 and float as internal sample formats
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d9338b1c23f1909527a7a7a8d6c4de9da3e7f8d
---
libswresample/swresample.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 7fd747b..73e88f0 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -119,7 +119,7 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
av_opt_set_int(s, "icl", in_ch_layout, 0);
av_opt_set_int(s, "isf", in_sample_fmt, 0);
av_opt_set_int(s, "isr", in_sample_rate, 0);
- av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_S16, 0);
+ av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE, 0);
av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> in_ch_layout), 0);
av_opt_set_int(s, "och", av_get_channel_layout_nb_channels(s->out_ch_layout), 0);
av_opt_set_int(s, "uch", 0, 0);
@@ -176,25 +176,28 @@ int swr_init(struct SwrContext *s){
return AVERROR(EINVAL);
}
- if( s->int_sample_fmt != AV_SAMPLE_FMT_S16
- &&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){
- av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(s->int_sample_fmt));
- return AVERROR(EINVAL);
- }
-
//FIXME should we allow/support using FLT on material that doesnt need it ?
if(s->in_sample_fmt <= AV_SAMPLE_FMT_S16 || s->int_sample_fmt==AV_SAMPLE_FMT_S16){
s->int_sample_fmt= AV_SAMPLE_FMT_S16;
}else
s->int_sample_fmt= AV_SAMPLE_FMT_FLT;
+ if( s->int_sample_fmt != AV_SAMPLE_FMT_S16
+ &&s->int_sample_fmt != AV_SAMPLE_FMT_S32
+ &&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){
+ av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, S16/S32/FLT is supported\n", av_get_sample_fmt_name(s->int_sample_fmt));
+ return AVERROR(EINVAL);
+ }
if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
s->resample = swri_resample_init(s->resample, s->out_sample_rate, s->in_sample_rate, 16, 10, 0, 0.8, s->int_sample_fmt);
}else
swri_resample_free(&s->resample);
- if(s->int_sample_fmt != AV_SAMPLE_FMT_S16 && s->resample){
- av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16 currently\n"); //FIXME
+ if( s->int_sample_fmt != AV_SAMPLE_FMT_S16
+ && s->int_sample_fmt != AV_SAMPLE_FMT_S32
+ && s->int_sample_fmt != AV_SAMPLE_FMT_FLT
+ && s->resample){
+ av_log(s, AV_LOG_ERROR, "Resampling only supported with internal s16/s32/flt\n");
return -1;
}
More information about the ffmpeg-cvslog
mailing list