[FFmpeg-devel] [PATCH 04/10] avfiter/af_aresample: when converting DSD->PCM and no output sample rate is specified, reduce output sample rate by swr_dsd2pcm_sr_factor()

Peter Ross pross at xvid.org
Tue May 6 14:38:20 CEST 2014


Signed-off-by: Peter Ross <pross at xvid.org>
---
 libavfilter/af_aresample.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 5f34321..7b752b9 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -100,6 +100,12 @@ static int query_formats(AVFilterContext *ctx)
     if(out_rate > 0) {
         int ratelist[] = { out_rate, -1 };
         out_samplerates = ff_make_format_list(ratelist);
+    } else if (inlink->in_formats && inlink->in_formats->nb_formats && inlink->in_formats->formats[0] == AV_SAMPLE_FMT_DSD &&
+               outlink->out_formats && outlink->out_formats->nb_formats && (outlink->out_formats->formats[0] != AV_SAMPLE_FMT_DSD && outlink->out_formats->formats[0] != AV_SAMPLE_FMT_DSDP) &&
+               !outlink->out_samplerates->nb_formats) {
+        /* when converting DSD->PCM _and_ no output sample rate is specified, limit the sample rate output */
+        int ratelist[] = { inlink->in_samplerates->formats[0] / swr_get_dsd2pcm_sr_factor(aresample->swr), -1};
+        out_samplerates = ff_make_format_list(ratelist);
     } else {
         out_samplerates = ff_all_samplerates();
     }
-- 
1.8.3.2

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140506/c40f6b76/attachment.asc>


More information about the ffmpeg-devel mailing list