diff mbox series

[FFmpeg-devel,1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device capabilities. (Fixes #9420)

Message ID CAELR-fB2Fdo27cxF+jnJ0dGLpXf=+kNcqh4HTNkqv=TkcZ99Tg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device capabilities. (Fixes #9420)
Related show

Checks

Context Check Description
andriy/configurex86 warning Failed to apply patch
andriy/configureppc warning Failed to apply patch

Commit Message

Brad Isbell Nov. 4, 2021, 2:09 a.m. UTC
From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
From: Brad Isbell <brad@audiopump.co>
Date: Sun, 3 Oct 2021 00:16:05 -0500
Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing
device
 capabilities.  (Fixes #9420)

Signed-off-by: Brad Isbell <brad@audiopump.co>
---
 libavdevice/dshow.c | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

+                (ctx->channels    && ctx->channels    != fx->nChannels
)
+            ) {
+                goto next;
             }
         }
         if (IAMStreamConfig_SetFormat(config, type) != S_OK)

Comments

Brad Isbell Nov. 4, 2021, 5:20 p.m. UTC | #1
Re-sending with correct line endings.  Thanks!


From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
From: Brad Isbell <brad@audiopump.co>
Date: Sun, 3 Oct 2021 00:16:05 -0500
Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device
 capabilities.  (Fixes #9420)

Signed-off-by: Brad Isbell <brad@audiopump.co>
---
 libavdevice/dshow.c | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 8d0a6fc..5c1e494 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)
--
2.32.0.windows.1

On Wed, Nov 3, 2021 at 9:09 PM Brad Isbell <brad@audiopump.co> wrote:
>
> From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
> From: Brad Isbell <brad@audiopump.co>
> Date: Sun, 3 Oct 2021 00:16:05 -0500
> Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device
>  capabilities.  (Fixes #9420)
>
> Signed-off-by: Brad Isbell <brad@audiopump.co>
> ---
>  libavdevice/dshow.c | 32 ++++++++++++--------------------
>  1 file changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index 8d0a6fc..5c1e494 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)
> --
> 2.32.0.windows.1
>
Brad Isbell Nov. 4, 2021, 6:02 p.m. UTC | #2
On Thu, Nov 4, 2021 at 12:20 PM Brad Isbell <brad@audiopump.co> wrote:
>
> Re-sending with correct line endings.  Thanks!
>
>
> From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
> From: Brad Isbell <brad@audiopump.co>
> Date: Sun, 3 Oct 2021 00:16:05 -0500
> Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device
>  capabilities.  (Fixes #9420)
>
> Signed-off-by: Brad Isbell <brad@audiopump.co>
> ---
>  libavdevice/dshow.c | 32 ++++++++++++--------------------
>  1 file changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> index 8d0a6fc..5c1e494 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)
> --
> 2.32.0.windows.1
>
> On Wed, Nov 3, 2021 at 9:09 PM Brad Isbell <brad@audiopump.co> wrote:
> >
> > From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
> > From: Brad Isbell <brad@audiopump.co>
> > Date: Sun, 3 Oct 2021 00:16:05 -0500
> > Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device
> >  capabilities.  (Fixes #9420)
> >
> > Signed-off-by: Brad Isbell <brad@audiopump.co>
> > ---
> >  libavdevice/dshow.c | 32 ++++++++++++--------------------
> >  1 file changed, 12 insertions(+), 20 deletions(-)
> >
> > diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> > index 8d0a6fc..5c1e494 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)
> > --
> > 2.32.0.windows.1
> >
From fd6bfd237d4d25de04d8179ccb1ff2d2f0aa904f Mon Sep 17 00:00:00 2001
From: Brad Isbell <brad@audiopump.co>
Date: Sun, 3 Oct 2021 00:16:05 -0500
Subject: [PATCH 1/2] Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device
 capabilities.  (Fixes #9420)

Signed-off-by: Brad Isbell <brad@audiopump.co>
---
 libavdevice/dshow.c | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 8d0a6fc..5c1e494 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)
diff mbox series

Patch

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 8d0a6fc..5c1e494 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) ||