diff mbox

[FFmpeg-devel] af_hdcd: Don't warn if converting from AV_SAMPLE_FMT_S16P

Message ID 1470585011-16894-1-git-send-email-pburt0@gmail.com
State Superseded
Headers show

Commit Message

Burt P Aug. 7, 2016, 3:50 p.m. UTC
Signed-off-by: Burt P <pburt0@gmail.com>
---
 libavfilter/af_hdcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Aug. 7, 2016, 3:53 p.m. UTC | #1
On 8/7/16, Burt P <pburt0@gmail.com> wrote:
> Signed-off-by: Burt P <pburt0@gmail.com>
> ---
>  libavfilter/af_hdcd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
> index e4e37e2..36da409 100644
> --- a/libavfilter/af_hdcd.c
> +++ b/libavfilter/af_hdcd.c
> @@ -1714,7 +1714,9 @@ static int config_input(AVFilterLink *inlink) {
>      AVFilterLink *lk = inlink;
>      while(lk != NULL) {
>          AVFilterContext *nextf = lk->src;
> -        if (lk->format != AV_SAMPLE_FMT_S16 || lk->sample_rate != 44100) {
> +        int sfok = (lk->format == AV_SAMPLE_FMT_S16
> +             || lk->format == AV_SAMPLE_FMT_S16P);
> +        if ( !sfok || lk->sample_rate != 44100) {
>              av_log(ctx, AV_LOG_WARNING, "An input format is %s@%dHz at %s.
> It will truncated/resampled to s16@44100Hz.\n",
>                  av_get_sample_fmt_name(lk->format), lk->sample_rate,
>                  (nextf->name) ? nextf->name : "<unknown>"
> --
> 2.7.4

LGTM
James Almer Aug. 7, 2016, 3:54 p.m. UTC | #2
On 8/7/2016 12:50 PM, Burt P wrote:
> Signed-off-by: Burt P <pburt0@gmail.com>
> ---
>  libavfilter/af_hdcd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
> index e4e37e2..36da409 100644
> --- a/libavfilter/af_hdcd.c
> +++ b/libavfilter/af_hdcd.c
> @@ -1714,7 +1714,9 @@ static int config_input(AVFilterLink *inlink) {
>      AVFilterLink *lk = inlink;
>      while(lk != NULL) {
>          AVFilterContext *nextf = lk->src;
> -        if (lk->format != AV_SAMPLE_FMT_S16 || lk->sample_rate != 44100) {
> +        int sfok = (lk->format == AV_SAMPLE_FMT_S16
> +             || lk->format == AV_SAMPLE_FMT_S16P);

Put the || at the end of the first line, and align the two lines vertically.

> +        if ( !sfok || lk->sample_rate != 44100) {
>              av_log(ctx, AV_LOG_WARNING, "An input format is %s@%dHz at %s. It will truncated/resampled to s16@44100Hz.\n",
>                  av_get_sample_fmt_name(lk->format), lk->sample_rate,
>                  (nextf->name) ? nextf->name : "<unknown>"
>
diff mbox

Patch

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index e4e37e2..36da409 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1714,7 +1714,9 @@  static int config_input(AVFilterLink *inlink) {
     AVFilterLink *lk = inlink;
     while(lk != NULL) {
         AVFilterContext *nextf = lk->src;
-        if (lk->format != AV_SAMPLE_FMT_S16 || lk->sample_rate != 44100) {
+        int sfok = (lk->format == AV_SAMPLE_FMT_S16
+             || lk->format == AV_SAMPLE_FMT_S16P);
+        if ( !sfok || lk->sample_rate != 44100) {
             av_log(ctx, AV_LOG_WARNING, "An input format is %s@%dHz at %s. It will truncated/resampled to s16@44100Hz.\n",
                 av_get_sample_fmt_name(lk->format), lk->sample_rate,
                 (nextf->name) ? nextf->name : "<unknown>"