aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/dshow.c
diff options
context:
space:
mode:
authorBrad Isbell <brad@audiopump.co>2021-10-03 00:16:05 -0500
committerMichael Niedermayer <michael@niedermayer.cc>2021-11-05 22:58:42 +0100
commitd9a9b4c877b85fea5a5bad74c3d592a756047f79 (patch)
tree02c8d24b25f861935d8c2a45198fab26694e2dfd /libavdevice/dshow.c
parent7370f1f4c98f922a20d9ac3cdc5c74c2885edbe7 (diff)
downloadffmpeg-d9a9b4c877b85fea5a5bad74c3d592a756047f79.tar.gz
avdevice/dshow: Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device capabilities. (Fixes #9420)
Signed-off-by: Brad Isbell <brad@audiopump.co> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavdevice/dshow.c')
-rw-r--r--libavdevice/dshow.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 8d0a6fcc09..5c1e4941f3 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -422,28 +422,20 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
goto next;
}
if (!pformat_set) {
- av_log(avctx, AV_LOG_INFO, " min ch=%lu bits=%lu rate=%6lu max ch=%lu bits=%lu rate=%6lu\n",
- acaps->MinimumChannels, acaps->MinimumBitsPerSample, acaps->MinimumSampleFrequency,
- acaps->MaximumChannels, acaps->MaximumBitsPerSample, acaps->MaximumSampleFrequency);
+ av_log(
+ avctx,
+ AV_LOG_INFO,
+ " ch=%2lu, bits=%2lu, rate=%6lu\n",
+ fx->nChannels, fx->wBitsPerSample, fx->nSamplesPerSec
+ );
continue;
}
- if (ctx->sample_rate) {
- if (ctx->sample_rate > acaps->MaximumSampleFrequency ||
- ctx->sample_rate < acaps->MinimumSampleFrequency)
- goto next;
- fx->nSamplesPerSec = ctx->sample_rate;
- }
- if (ctx->sample_size) {
- if (ctx->sample_size > acaps->MaximumBitsPerSample ||
- ctx->sample_size < acaps->MinimumBitsPerSample)
- goto next;
- fx->wBitsPerSample = ctx->sample_size;
- }
- if (ctx->channels) {
- if (ctx->channels > acaps->MaximumChannels ||
- ctx->channels < acaps->MinimumChannels)
- goto next;
- fx->nChannels = ctx->channels;
+ if (
+ (ctx->sample_rate && ctx->sample_rate != fx->nSamplesPerSec) ||
+ (ctx->sample_size && ctx->sample_size != fx->wBitsPerSample) ||
+ (ctx->channels && ctx->channels != fx->nChannels )
+ ) {
+ goto next;
}
}
if (IAMStreamConfig_SetFormat(config, type) != S_OK)