diff mbox series

[FFmpeg-devel,v7,05/10] qsv: build audio related code when MFX_VERSION < 2.0

Message ID 20220311081630.21927-6-haihao.xiang@intel.com
State New
Headers show
Series make QSV works with the Intel's oneVPL | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Xiang, Haihao March 11, 2022, 8:16 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
preparation for oneVPL support

[1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
 libavcodec/qsv.c     | 5 +++++
 libavfilter/qsvvpp.c | 6 ++++++
 libavfilter/qsvvpp.h | 2 ++
 3 files changed, 13 insertions(+)

Comments

Anton Khirnov April 5, 2022, 11:50 a.m. UTC | #1
Quoting Xiang, Haihao (2022-03-11 09:16:25)
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> preparation for oneVPL support
> 
> [1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
> [2]: https://github.com/oneapi-src/oneVPL
> ---
>  libavcodec/qsv.c     | 5 +++++
>  libavfilter/qsvvpp.c | 6 ++++++
>  libavfilter/qsvvpp.h | 2 ++
>  3 files changed, 13 insertions(+)

Why not just remove this completely?
None of our QSV code  does anything with audio.
Xiang, Haihao April 6, 2022, 3:38 a.m. UTC | #2
On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > From: Haihao Xiang <haihao.xiang@intel.com>
> > 
> > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> > preparation for oneVPL support
> > 
> > [1]: 
> > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
> > [2]: https://github.com/oneapi-src/oneVPL
> > ---
> >  libavcodec/qsv.c     | 5 +++++
> >  libavfilter/qsvvpp.c | 6 ++++++
> >  libavfilter/qsvvpp.h | 2 ++
> >  3 files changed, 13 insertions(+)
> 
> Why not just remove this completely?
> None of our QSV code  does anything with audio.

It was removed in an older version, however someone objected the removal of
this.  See 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.443304-2-haihao.xiang@intel.com/
 

Thanks
Haihao
Soft Works April 30, 2022, 4:51 p.m. UTC | #3
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Xiang, Haihao
> Sent: Wednesday, April 6, 2022 5:38 AM
> To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> code when MFX_VERSION < 2.0
> 
> On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > From: Haihao Xiang <haihao.xiang@intel.com>
> > >
> > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> > > preparation for oneVPL support
> > >
> > > [1]:
> > >
> https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> l_media_sdk.html#msdk-full-name-feature-removals
> > > [2]: https://github.com/oneapi-src/oneVPL
> > > ---
> > >  libavcodec/qsv.c     | 5 +++++
> > >  libavfilter/qsvvpp.c | 6 ++++++
> > >  libavfilter/qsvvpp.h | 2 ++
> > >  3 files changed, 13 insertions(+)
> >
> > Why not just remove this completely?
> > None of our QSV code  does anything with audio.
> 
> It was removed in an older version, however someone objected the
> removal of
> this.  See
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> 4-2-haihao.xiang@intel.com/

I think this was a misunderstanding. I see not objection. One was 
just asking "why" and the other one had missed the point that audio
has never been functional.

I agree with Anton that the audio stuff should be removed 
completely - ideally even beforehand in a separate patch.

softworkz
Xiang, Haihao May 1, 2022, 2:16 a.m. UTC | #4
On Sat, 2022-04-30 at 16:51 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Xiang, Haihao
> > Sent: Wednesday, April 6, 2022 5:38 AM
> > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> > code when MFX_VERSION < 2.0
> > 
> > On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > 
> > > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> > > > preparation for oneVPL support
> > > > 
> > > > [1]:
> > > > 
> > 
> > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> > l_media_sdk.html#msdk-full-name-feature-removals
> > > > [2]: https://github.com/oneapi-src/oneVPL
> > > > ---
> > > >  libavcodec/qsv.c     | 5 +++++
> > > >  libavfilter/qsvvpp.c | 6 ++++++
> > > >  libavfilter/qsvvpp.h | 2 ++
> > > >  3 files changed, 13 insertions(+)
> > > 
> > > Why not just remove this completely?
> > > None of our QSV code  does anything with audio.
> > 
> > It was removed in an older version, however someone objected the
> > removal of
> > this.  See
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > 4-2-haihao.xiang@intel.com/
> 
> I think this was a misunderstanding. I see not objection. One was 
> just asking "why" and the other one had missed the point that audio
> has never been functional.

Please find the comment below in the original thread

"This seems like a generic translation from the library errors to FF error
codes. So even if we'll never touch the audio functionality of it, I'd prefer
to have that struct complete already"

So my understanding was that the reviewer preferred to keep the audio stuff
unchanged for libmfx.

> 
> I agree with Anton that the audio stuff should be removed 
> completely - ideally even beforehand in a separate patch.

Actually I prefer to remove the audio stuff too. I may submit a separate patch
if no more comments.

Thanks
Haihao
Soft Works May 1, 2022, 3:10 a.m. UTC | #5
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Xiang, Haihao
> Sent: Sunday, May 1, 2022 4:16 AM
> To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> code when MFX_VERSION < 2.0
> 
> On Sat, 2022-04-30 at 16:51 +0000, Soft Works wrote:
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Xiang, Haihao
> > > Sent: Wednesday, April 6, 2022 5:38 AM
> > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> related
> > > code when MFX_VERSION < 2.0
> > >
> > > On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > > > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > >
> > > > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> > > > > preparation for oneVPL support
> > > > >
> > > > > [1]:
> > > > >
> > >
> > >
> https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> > > l_media_sdk.html#msdk-full-name-feature-removals
> > > > > [2]: https://github.com/oneapi-src/oneVPL
> > > > > ---
> > > > >  libavcodec/qsv.c     | 5 +++++
> > > > >  libavfilter/qsvvpp.c | 6 ++++++
> > > > >  libavfilter/qsvvpp.h | 2 ++
> > > > >  3 files changed, 13 insertions(+)
> > > >
> > > > Why not just remove this completely?
> > > > None of our QSV code  does anything with audio.
> > >
> > > It was removed in an older version, however someone objected the
> > > removal of
> > > this.  See
> > >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > > 4-2-haihao.xiang@intel.com/
> >
> > I think this was a misunderstanding. I see not objection. One was
> > just asking "why" and the other one had missed the point that audio
> > has never been functional.
> 
> Please find the comment below in the original thread
> 
> "This seems like a generic translation from the library errors to FF
> error
> codes. So even if we'll never touch the audio functionality of it, I'd
> prefer
> to have that struct complete already"
> 
> So my understanding was that the reviewer preferred to keep the audio
> stuff
> unchanged for libmfx.

Hm, I hadn't see that here:

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.443304-2-haihao.xiang@intel.com/

Considering the text again:

> "This seems like a generic translation from the library errors to FF
> error
> codes. So even if we'll never touch the audio functionality of it, I'd
> prefer
> to have that struct complete already"

I understand the idea. Normally those lines wouldn't hurt. But now, that
we're facing some kind of "#ifdef hell" anyway, I think it would be much 
better to minimize this as much as possible, and there's really no point
in translating audio error codes.
Also, the struct has never been really complete. Instead of retaining
unused audio error codes, we should better add those that are missing 
(like -21, -22 and others) and relevant.

@Thilo - can we get you warm with that? 

As an alternative, we could simply replace the two audio definitions with
plain integer values (MFX_ERR_INVALID_AUDIO_PARAM >> -19)


This is a small bit only, but before adding the oneVPL stuff, I think
we should consolidate the conditional stuff as much as possible.

As discussed before, we also need to settle for a minimum libmfx SDK 
version (compile-time, not runtime!). This will allow to drop quite
an amount of conditional code, and this cleanup should be done before
getting to oneVPL.

Another thing that is a bit unfortunate is that we are duplicating this
error mapping struct in qsv.c and qsvvpp.c.
I don't mean that it should be linked as an external between avfilter
and avcodec, but it should come (be included) from a single file.

Kind regards,
softworkz
Xiang, Haihao May 1, 2022, 4:51 a.m. UTC | #6
On Sun, 2022-05-01 at 03:10 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Xiang, Haihao
> > Sent: Sunday, May 1, 2022 4:16 AM
> > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> > code when MFX_VERSION < 2.0
> > 
> > On Sat, 2022-04-30 at 16:51 +0000, Soft Works wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > > Xiang, Haihao
> > > > Sent: Wednesday, April 6, 2022 5:38 AM
> > > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> > 
> > related
> > > > code when MFX_VERSION < 2.0
> > > > 
> > > > On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > > > > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > > > 
> > > > > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
> > > > > > preparation for oneVPL support
> > > > > > 
> > > > > > [1]:
> > > > > > 
> > > > 
> > > > 
> > 
> > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> > > > l_media_sdk.html#msdk-full-name-feature-removals
> > > > > > [2]: https://github.com/oneapi-src/oneVPL
> > > > > > ---
> > > > > >  libavcodec/qsv.c     | 5 +++++
> > > > > >  libavfilter/qsvvpp.c | 6 ++++++
> > > > > >  libavfilter/qsvvpp.h | 2 ++
> > > > > >  3 files changed, 13 insertions(+)
> > > > > 
> > > > > Why not just remove this completely?
> > > > > None of our QSV code  does anything with audio.
> > > > 
> > > > It was removed in an older version, however someone objected the
> > > > removal of
> > > > this.  See
> > > > 
> > 
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > > > 4-2-haihao.xiang@intel.com/
> > > 
> > > I think this was a misunderstanding. I see not objection. One was
> > > just asking "why" and the other one had missed the point that audio
> > > has never been functional.
> > 
> > Please find the comment below in the original thread
> > 
> > "This seems like a generic translation from the library errors to FF
> > error
> > codes. So even if we'll never touch the audio functionality of it, I'd
> > prefer
> > to have that struct complete already"
> > 
> > So my understanding was that the reviewer preferred to keep the audio
> > stuff
> > unchanged for libmfx.
> 
> Hm, I hadn't see that here:
> 
> 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.443304-2-haihao.xiang@intel.com/
> 
> Considering the text again:
> 
> > "This seems like a generic translation from the library errors to FF
> > error
> > codes. So even if we'll never touch the audio functionality of it, I'd
> > prefer
> > to have that struct complete already"
> 
> I understand the idea. Normally those lines wouldn't hurt. But now, that
> we're facing some kind of "#ifdef hell" anyway, I think it would be much 
> better to minimize this as much as possible, and there's really no point
> in translating audio error codes.
> Also, the struct has never been really complete. Instead of retaining
> unused audio error codes, we should better add those that are missing 
> (like -21, -22 and others) and relevant.
> 
> @Thilo - can we get you warm with that? 
> 
> As an alternative, we could simply replace the two audio definitions with
> plain integer values (MFX_ERR_INVALID_AUDIO_PARAM >> -19)
> 
> 
> This is a small bit only, but before adding the oneVPL stuff, I think
> we should consolidate the conditional stuff as much as possible.
> 
> As discussed before, we also need to settle for a minimum libmfx SDK 
> version (compile-time, not runtime!). This will allow to drop quite
> an amount of conditional code, and this cleanup should be done before
> getting to oneVPL.

Sure, I'll submit a patch for it.

> 
> Another thing that is a bit unfortunate is that we are duplicating this
> error mapping struct in qsv.c and qsvvpp.c.
> I don't mean that it should be linked as an external between avfilter
> and avcodec, but it should come (be included) from a single file.

We moved the static error table to a .h in the past however it resulted in link
error when building FFmpeg with static libraries.

Thanks
Haihao
Soft Works May 1, 2022, 5:13 a.m. UTC | #7
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Xiang, Haihao
> Sent: Sunday, May 1, 2022 6:52 AM
> To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> code when MFX_VERSION < 2.0
> 
> On Sun, 2022-05-01 at 03:10 +0000, Soft Works wrote:
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Xiang, Haihao
> > > Sent: Sunday, May 1, 2022 4:16 AM
> > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> related
> > > code when MFX_VERSION < 2.0
> > >
> > > On Sat, 2022-04-30 at 16:51 +0000, Soft Works wrote:
> > > > > -----Original Message-----
> > > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf
> Of
> > > > > Xiang, Haihao
> > > > > Sent: Wednesday, April 6, 2022 5:38 AM
> > > > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> > >
> > > related
> > > > > code when MFX_VERSION < 2.0
> > > > >
> > > > > On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > > > > > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > > > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > > > >
> > > > > > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This
> is in
> > > > > > > preparation for oneVPL support
> > > > > > >
> > > > > > > [1]:
> > > > > > >
> > > > >
> > > > >
> > >
> > >
> https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> > > > > l_media_sdk.html#msdk-full-name-feature-removals
> > > > > > > [2]: https://github.com/oneapi-src/oneVPL
> > > > > > > ---
> > > > > > >  libavcodec/qsv.c     | 5 +++++
> > > > > > >  libavfilter/qsvvpp.c | 6 ++++++
> > > > > > >  libavfilter/qsvvpp.h | 2 ++
> > > > > > >  3 files changed, 13 insertions(+)
> > > > > >
> > > > > > Why not just remove this completely?
> > > > > > None of our QSV code  does anything with audio.
> > > > >
> > > > > It was removed in an older version, however someone objected
> the
> > > > > removal of
> > > > > this.  See
> > > > >
> > >
> > >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > > > > 4-2-haihao.xiang@intel.com/
> > > >
> > > > I think this was a misunderstanding. I see not objection. One
> was
> > > > just asking "why" and the other one had missed the point that
> audio
> > > > has never been functional.
> > >
> > > Please find the comment below in the original thread
> > >
> > > "This seems like a generic translation from the library errors to
> FF
> > > error
> > > codes. So even if we'll never touch the audio functionality of it,
> I'd
> > > prefer
> > > to have that struct complete already"
> > >
> > > So my understanding was that the reviewer preferred to keep the
> audio
> > > stuff
> > > unchanged for libmfx.
> >
> > Hm, I hadn't see that here:
> >
> >
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> 4-2-haihao.xiang@intel.com/
> >
> > Considering the text again:
> >
> > > "This seems like a generic translation from the library errors to
> FF
> > > error
> > > codes. So even if we'll never touch the audio functionality of it,
> I'd
> > > prefer
> > > to have that struct complete already"
> >
> > I understand the idea. Normally those lines wouldn't hurt. But now,
> that
> > we're facing some kind of "#ifdef hell" anyway, I think it would be
> much
> > better to minimize this as much as possible, and there's really no
> point
> > in translating audio error codes.
> > Also, the struct has never been really complete. Instead of
> retaining
> > unused audio error codes, we should better add those that are
> missing
> > (like -21, -22 and others) and relevant.
> >
> > @Thilo - can we get you warm with that?
> >
> > As an alternative, we could simply replace the two audio definitions
> with
> > plain integer values (MFX_ERR_INVALID_AUDIO_PARAM >> -19)
> >
> >
> > This is a small bit only, but before adding the oneVPL stuff, I
> think
> > we should consolidate the conditional stuff as much as possible.
> >
> > As discussed before, we also need to settle for a minimum libmfx SDK
> > version (compile-time, not runtime!). This will allow to drop quite
> > an amount of conditional code, and this cleanup should be done
> before
> > getting to oneVPL.
> 
> Sure, I'll submit a patch for it.
> 
> >
> > Another thing that is a bit unfortunate is that we are duplicating
> this
> > error mapping struct in qsv.c and qsvvpp.c.
> > I don't mean that it should be linked as an external between
> avfilter
> > and avcodec, but it should come (be included) from a single file.
> 
> We moved the static error table to a .h in the past however it
> resulted in link
> error when building FFmpeg with static libraries.

That's why I said that it doesn't need to be exported - just a
single file that can be included/inlined in both cases where it
is used (lavcodec, lavfilter).

Best,
softworkz
Xiang, Haihao May 31, 2022, 8:58 a.m. UTC | #8
On Sun, 2022-05-01 at 05:13 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Xiang, Haihao
> > Sent: Sunday, May 1, 2022 6:52 AM
> > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related
> > code when MFX_VERSION < 2.0
> > 
> > On Sun, 2022-05-01 at 03:10 +0000, Soft Works wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > > Xiang, Haihao
> > > > Sent: Sunday, May 1, 2022 4:16 AM
> > > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> > 
> > related
> > > > code when MFX_VERSION < 2.0
> > > > 
> > > > On Sat, 2022-04-30 at 16:51 +0000, Soft Works wrote:
> > > > > > -----Original Message-----
> > > > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf
> > 
> > Of
> > > > > > Xiang, Haihao
> > > > > > Sent: Wednesday, April 6, 2022 5:38 AM
> > > > > > To: anton@khirnov.net; ffmpeg-devel@ffmpeg.org
> > > > > > Subject: Re: [FFmpeg-devel] [PATCH v7 05/10] qsv: build audio
> > > > 
> > > > related
> > > > > > code when MFX_VERSION < 2.0
> > > > > > 
> > > > > > On Tue, 2022-04-05 at 13:50 +0200, Anton Khirnov wrote:
> > > > > > > Quoting Xiang, Haihao (2022-03-11 09:16:25)
> > > > > > > > From: Haihao Xiang <haihao.xiang@intel.com>
> > > > > > > > 
> > > > > > > > Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This
> > 
> > is in
> > > > > > > > preparation for oneVPL support
> > > > > > > > 
> > > > > > > > [1]:
> > > > > > > > 
> > > > > > 
> > > > > > 
> > > > 
> > > > 
> > 
> > https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_inte
> > > > > > l_media_sdk.html#msdk-full-name-feature-removals
> > > > > > > > [2]: https://github.com/oneapi-src/oneVPL
> > > > > > > > ---
> > > > > > > >  libavcodec/qsv.c     | 5 +++++
> > > > > > > >  libavfilter/qsvvpp.c | 6 ++++++
> > > > > > > >  libavfilter/qsvvpp.h | 2 ++
> > > > > > > >  3 files changed, 13 insertions(+)
> > > > > > > 
> > > > > > > Why not just remove this completely?
> > > > > > > None of our QSV code  does anything with audio.
> > > > > > 
> > > > > > It was removed in an older version, however someone objected
> > 
> > the
> > > > > > removal of
> > > > > > this.  See
> > > > > > 
> > > > 
> > > > 
> > 
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > > > > > 4-2-haihao.xiang@intel.com/
> > > > > 
> > > > > I think this was a misunderstanding. I see not objection. One
> > 
> > was
> > > > > just asking "why" and the other one had missed the point that
> > 
> > audio
> > > > > has never been functional.
> > > > 
> > > > Please find the comment below in the original thread
> > > > 
> > > > "This seems like a generic translation from the library errors to
> > 
> > FF
> > > > error
> > > > codes. So even if we'll never touch the audio functionality of it,
> > 
> > I'd
> > > > prefer
> > > > to have that struct complete already"
> > > > 
> > > > So my understanding was that the reviewer preferred to keep the
> > 
> > audio
> > > > stuff
> > > > unchanged for libmfx.
> > > 
> > > Hm, I hadn't see that here:
> > > 
> > > 
> > 
> > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200819061023.44330
> > 4-2-haihao.xiang@intel.com/
> > > 
> > > Considering the text again:
> > > 
> > > > "This seems like a generic translation from the library errors to
> > 
> > FF
> > > > error
> > > > codes. So even if we'll never touch the audio functionality of it,
> > 
> > I'd
> > > > prefer
> > > > to have that struct complete already"
> > > 
> > > I understand the idea. Normally those lines wouldn't hurt. But now,
> > 
> > that
> > > we're facing some kind of "#ifdef hell" anyway, I think it would be
> > 
> > much
> > > better to minimize this as much as possible, and there's really no
> > 
> > point
> > > in translating audio error codes.
> > > Also, the struct has never been really complete. Instead of
> > 
> > retaining
> > > unused audio error codes, we should better add those that are
> > 
> > missing
> > > (like -21, -22 and others) and relevant.
> > > 
> > > @Thilo - can we get you warm with that?
> > > 
> > > As an alternative, we could simply replace the two audio definitions
> > 
> > with
> > > plain integer values (MFX_ERR_INVALID_AUDIO_PARAM >> -19)
> > > 
> > > 
> > > This is a small bit only, but before adding the oneVPL stuff, I
> > 
> > think
> > > we should consolidate the conditional stuff as much as possible.
> > > 
> > > As discussed before, we also need to settle for a minimum libmfx SDK
> > > version (compile-time, not runtime!). This will allow to drop quite
> > > an amount of conditional code, and this cleanup should be done
> > 
> > before
> > > getting to oneVPL.
> > 
> > Sure, I'll submit a patch for it.
> > 
> > > 
> > > Another thing that is a bit unfortunate is that we are duplicating
> > 
> > this
> > > error mapping struct in qsv.c and qsvvpp.c.
> > > I don't mean that it should be linked as an external between
> > 
> > avfilter
> > > and avcodec, but it should come (be included) from a single file.
> > 
> > We moved the static error table to a .h in the past however it
> > resulted in link
> > error when building FFmpeg with static libraries.
> 
> That's why I said that it doesn't need to be exported - just a
> single file that can be included/inlined in both cases where it
> is used (lavcodec, lavfilter).

Thanks for your comment, I'll consider to change it later. 
BTW we don't get response from Thilo, I'll keep this patch unchanged in the new
version. I think we may update it in the future if there are more comments.

Thanks
Haihao
diff mbox series

Patch

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 0eb0d83ac0..063d6dfb0a 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -37,6 +37,7 @@ 
 
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 #define QSV_HAVE_USER_PLUGIN    !QSV_ONEVPL
+#define QSV_HAVE_AUDIO          !QSV_ONEVPL
 
 #if QSV_VERSION_ATLEAST(1, 12)
 #include "mfxvp8.h"
@@ -137,8 +138,10 @@  static const struct {
     { MFX_ERR_INVALID_VIDEO_PARAM,      AVERROR(EINVAL), "invalid video parameters"             },
     { MFX_ERR_UNDEFINED_BEHAVIOR,       AVERROR_BUG,     "undefined behavior"                   },
     { MFX_ERR_DEVICE_FAILED,            AVERROR(EIO),    "device failed"                        },
+#if QSV_HAVE_AUDIO
     { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters"        },
     { MFX_ERR_INVALID_AUDIO_PARAM,      AVERROR(EINVAL), "invalid audio parameters"             },
+#endif
 
     { MFX_WRN_IN_EXECUTION,             0,               "operation in execution"               },
     { MFX_WRN_DEVICE_BUSY,              0,               "device busy"                          },
@@ -148,7 +151,9 @@  static const struct {
     { MFX_WRN_VALUE_NOT_CHANGED,        0,               "value is saturated"                   },
     { MFX_WRN_OUT_OF_RANGE,             0,               "value out of range"                   },
     { MFX_WRN_FILTER_SKIPPED,           0,               "filter skipped"                       },
+#if QSV_HAVE_AUDIO
     { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,               "incompatible audio parameters"        },
+#endif
 };
 
 /**
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 954f882637..3647891d13 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -38,6 +38,8 @@ 
 #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
 #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
 
+#define QSV_HAVE_AUDIO         !QSV_ONEVPL
+
 static const AVRational default_tb = { 1, 90000 };
 
 typedef struct QSVAsyncFrame {
@@ -100,8 +102,10 @@  static const struct {
     { MFX_ERR_INVALID_VIDEO_PARAM,      AVERROR(EINVAL), "invalid video parameters"             },
     { MFX_ERR_UNDEFINED_BEHAVIOR,       AVERROR_BUG,     "undefined behavior"                   },
     { MFX_ERR_DEVICE_FAILED,            AVERROR(EIO),    "device failed"                        },
+#if QSV_HAVE_AUDIO
     { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters"        },
     { MFX_ERR_INVALID_AUDIO_PARAM,      AVERROR(EINVAL), "invalid audio parameters"             },
+#endif
 
     { MFX_WRN_IN_EXECUTION,             0,               "operation in execution"               },
     { MFX_WRN_DEVICE_BUSY,              0,               "device busy"                          },
@@ -111,7 +115,9 @@  static const struct {
     { MFX_WRN_VALUE_NOT_CHANGED,        0,               "value is saturated"                   },
     { MFX_WRN_OUT_OF_RANGE,             0,               "value out of range"                   },
     { MFX_WRN_FILTER_SKIPPED,           0,               "filter skipped"                       },
+#if QSV_HAVE_AUDIO
     { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,               "incompatible audio parameters"        },
+#endif
 };
 
 static int qsv_map_error(mfxStatus mfx_err, const char **desc)
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index 543c58a967..802abd987d 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -40,6 +40,8 @@ 
     ((MFX_VERSION.Major > (MAJOR)) ||                           \
     (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
 
+#define QSV_ONEVPL       QSV_VERSION_ATLEAST(2, 0)
+
 typedef struct QSVFrame {
     AVFrame          *frame;
     mfxFrameSurface1 surface;