[FFmpeg-devel] all: avoid data imports across DLL boundaries

Submitted by wm4 on Aug. 21, 2017, 5:51 p.m.

Details

Message ID 20170821175156.30235-1-nfxjfg@googlemail.com
State New
Headers show

Commit Message

wm4 Aug. 21, 2017, 5:51 p.m.
From: Pedro Pombeiro <pedropombeiro@gmail.com>

DLL data imports cause problems on Windows. They normally require
each variable to be correctly marked with dllimport/dllexport
declspecs. For MSVC, we define av_export to dllimport declspec. This
is not entirely correct - depending on which sub-lib is built, they
should be marked to dllexport instead. It happens to work with MSVC,
because it supports exports incorrectly marked as imports. Trying to
use this breaks on MinGW and results in linker errors.

On MinGW, not using any import/export specifiers happens to work,
because binutils and the MinGW runtime provide "pseudo relocations",
which manually fix these imports at load time. This does not work with
MinGW WinRT builds: the relocations cannot be performed because this
would require writing to the code section, which is not allowed.

Get rid of all these issues by not using data exports/imports. The
public API is already free of them, but avpriv_ symbols make extensive
use of them. Replace them all with getters.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
---
 libavcodec/aacadtsdec.c                |  4 +--
 libavcodec/aacenc.c                    |  4 +--
 libavcodec/ac3_parser.c                |  2 +-
 libavcodec/ac3dec.c                    |  2 +-
 libavcodec/ac3tab.c                    |  7 ++++-
 libavcodec/ac3tab.h                    |  2 +-
 libavcodec/ansi.c                      | 12 ++++-----
 libavcodec/bintext.c                   |  4 +--
 libavcodec/dca.c                       |  9 +++++--
 libavcodec/dca.h                       |  2 +-
 libavcodec/dca_core.c                  |  2 +-
 libavcodec/dca_parser.c                |  2 +-
 libavcodec/g2meet.c                    | 16 +++++------
 libavcodec/jpegtables.c                | 49 +++++++++++++++++++++++++++++-----
 libavcodec/jpegtables.h                | 14 +++++-----
 libavcodec/ljpegenc.c                  |  8 +++---
 libavcodec/mjpeg2jpeg_bsf.c            | 12 ++++-----
 libavcodec/mjpegdec.c                  | 24 ++++++++---------
 libavcodec/mjpegenc.c                  | 16 +++++------
 libavcodec/mjpegenc_common.c           | 18 ++++++-------
 libavcodec/mp3_header_decompress_bsf.c |  4 +--
 libavcodec/mpeg4audio.c                | 14 ++++++++--
 libavcodec/mpeg4audio.h                |  4 ++-
 libavcodec/mpegaudiodata.c             | 19 +++++++++++--
 libavcodec/mpegaudiodata.h             |  6 +++--
 libavcodec/mpegaudiodecheader.c        |  6 ++---
 libavcodec/mpegaudioenc_template.c     | 10 +++----
 libavcodec/raw.c                       | 10 +++++++
 libavcodec/raw.h                       |  4 +--
 libavcodec/rawdec.c                    |  6 ++---
 libavcodec/tmv.c                       |  2 +-
 libavcodec/vaapi_encode_mjpeg.c        | 16 +++++------
 libavfilter/avf_showcqt.c              |  3 ++-
 libavfilter/avf_showspectrum.c         |  2 +-
 libavfilter/avf_showvolume.c           |  2 +-
 libavfilter/f_ebur128.c                |  4 +--
 libavfilter/vf_datascope.c             |  2 +-
 libavfilter/vf_vectorscope.c           |  4 +--
 libavfilter/vf_waveform.c              |  8 +++---
 libavfilter/vsrc_testsrc.c             |  2 +-
 libavformat/avienc.c                   |  2 +-
 libavformat/isom.c                     |  4 +--
 libavformat/matroskadec.c              |  4 +--
 libavformat/mov.c                      |  4 +--
 libavformat/movenc.c                   |  2 +-
 libavformat/mp3enc.c                   |  8 +++---
 libavformat/nutenc.c                   |  4 +--
 libavformat/rtpdec_jpeg.c              | 16 +++++------
 libavformat/rtpenc_jpeg.c              | 16 +++++------
 libavformat/sdp.c                      |  4 +--
 libavformat/spdifenc.c                 |  2 +-
 libavutil/internal.h                   |  6 -----
 libavutil/xga_font_data.c              | 14 ++++++++--
 libavutil/xga_font_data.h              |  4 +--
 54 files changed, 258 insertions(+), 169 deletions(-)

Comments

wm4 Aug. 23, 2017, 9:12 a.m.
On Mon, 21 Aug 2017 19:51:56 +0200
wm4 <nfxjfg@googlemail.com> wrote:

> From: Pedro Pombeiro <pedropombeiro@gmail.com>
> 
> DLL data imports cause problems on Windows. They normally require
> each variable to be correctly marked with dllimport/dllexport
> declspecs. For MSVC, we define av_export to dllimport declspec. This
> is not entirely correct - depending on which sub-lib is built, they
> should be marked to dllexport instead. It happens to work with MSVC,
> because it supports exports incorrectly marked as imports. Trying to
> use this breaks on MinGW and results in linker errors.
> 
> On MinGW, not using any import/export specifiers happens to work,
> because binutils and the MinGW runtime provide "pseudo relocations",
> which manually fix these imports at load time. This does not work with
> MinGW WinRT builds: the relocations cannot be performed because this
> would require writing to the code section, which is not allowed.
> 
> Get rid of all these issues by not using data exports/imports. The
> public API is already free of them, but avpriv_ symbols make extensive
> use of them. Replace them all with getters.
> 
> Signed-off-by: wm4 <nfxjfg@googlemail.com>
> ---

Ping. This is a pretty big change.
James Almer Aug. 23, 2017, 10:23 p.m.
On 8/21/2017 2:51 PM, wm4 wrote:
> From: Pedro Pombeiro <pedropombeiro@gmail.com>
> 
> DLL data imports cause problems on Windows. They normally require
> each variable to be correctly marked with dllimport/dllexport
> declspecs. For MSVC, we define av_export to dllimport declspec. This
> is not entirely correct - depending on which sub-lib is built, they
> should be marked to dllexport instead. It happens to work with MSVC,
> because it supports exports incorrectly marked as imports. Trying to
> use this breaks on MinGW and results in linker errors.
> 
> On MinGW, not using any import/export specifiers happens to work,
> because binutils and the MinGW runtime provide "pseudo relocations",
> which manually fix these imports at load time. This does not work with
> MinGW WinRT builds: the relocations cannot be performed because this
> would require writing to the code section, which is not allowed.
> 
> Get rid of all these issues by not using data exports/imports. The
> public API is already free of them, but avpriv_ symbols make extensive
> use of them. Replace them all with getters.

Should be good i think, but it can't be applied as is until the next
major bump as it breaks ABI (Tons of avpriv_ symbols are removed).

Speaking of which, do you or anyone else want to help with applying the
bump right now instead of waiting until the merges are resumed?
Finding what deprecated APIs are two years or older, removing them and
seeing if any further changes are needed to ensure compilation after the
bump (I bet a lot will require changes since deprecations imported from
libav aren't given much attention here outside of making sure warnings
are silenced).
ABI changes, like moving fields around within a struct or into an opaque
internal struct, removing/modifying avpriv_ functions, etc, are things
that can be done during several weeks after the bump and not necessarily
as preparation for it.

Certain deprecated APIs that are two years or older could be kept in
place if removing them takes too much work at the moment, but the bump
is pretty overdue by now due to the amount of crap some structs are
currently dealing with (public vs private fields, offsets, etc).
We've had enough ABI breakages with this set of major versions so it
would be great if we can move on from it before a new release is tagged.
wm4 Aug. 24, 2017, 8:52 a.m.
On Wed, 23 Aug 2017 19:23:12 -0300
James Almer <jamrial@gmail.com> wrote:

> On 8/21/2017 2:51 PM, wm4 wrote:
> > From: Pedro Pombeiro <pedropombeiro@gmail.com>
> > 
> > DLL data imports cause problems on Windows. They normally require
> > each variable to be correctly marked with dllimport/dllexport
> > declspecs. For MSVC, we define av_export to dllimport declspec. This
> > is not entirely correct - depending on which sub-lib is built, they
> > should be marked to dllexport instead. It happens to work with MSVC,
> > because it supports exports incorrectly marked as imports. Trying to
> > use this breaks on MinGW and results in linker errors.
> > 
> > On MinGW, not using any import/export specifiers happens to work,
> > because binutils and the MinGW runtime provide "pseudo relocations",
> > which manually fix these imports at load time. This does not work with
> > MinGW WinRT builds: the relocations cannot be performed because this
> > would require writing to the code section, which is not allowed.
> > 
> > Get rid of all these issues by not using data exports/imports. The
> > public API is already free of them, but avpriv_ symbols make extensive
> > use of them. Replace them all with getters.  
> 
> Should be good i think, but it can't be applied as is until the next
> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).

Well, I call bullshit. We've never taken ABI compatibility between
FFmpeg libs seriously, especially not if it was about avpriv functions.

And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
authored and committed by you, and changes an avpriv function in an
incompatible way, without even minor version bumps.

> Speaking of which, do you or anyone else want to help with applying the
> bump right now instead of waiting until the merges are resumed?
> Finding what deprecated APIs are two years or older, removing them and
> seeing if any further changes are needed to ensure compilation after the
> bump (I bet a lot will require changes since deprecations imported from
> libav aren't given much attention here outside of making sure warnings
> are silenced).
> ABI changes, like moving fields around within a struct or into an opaque
> internal struct, removing/modifying avpriv_ functions, etc, are things
> that can be done during several weeks after the bump and not necessarily
> as preparation for it.
> 
> Certain deprecated APIs that are two years or older could be kept in
> place if removing them takes too much work at the moment, but the bump
> is pretty overdue by now due to the amount of crap some structs are
> currently dealing with (public vs private fields, offsets, etc).
> We've had enough ABI breakages with this set of major versions so it
> would be great if we can move on from it before a new release is tagged.

That sounds good, but I don't think I want to fight this fight (because
it's going to be a fight). Libav already bumped recently.
Michael Niedermayer Aug. 24, 2017, 9:20 a.m.
On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
> On Wed, 23 Aug 2017 19:23:12 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
> > On 8/21/2017 2:51 PM, wm4 wrote:
> > > From: Pedro Pombeiro <pedropombeiro@gmail.com>
> > > 
> > > DLL data imports cause problems on Windows. They normally require
> > > each variable to be correctly marked with dllimport/dllexport
> > > declspecs. For MSVC, we define av_export to dllimport declspec. This
> > > is not entirely correct - depending on which sub-lib is built, they
> > > should be marked to dllexport instead. It happens to work with MSVC,
> > > because it supports exports incorrectly marked as imports. Trying to
> > > use this breaks on MinGW and results in linker errors.
> > > 
> > > On MinGW, not using any import/export specifiers happens to work,
> > > because binutils and the MinGW runtime provide "pseudo relocations",
> > > which manually fix these imports at load time. This does not work with
> > > MinGW WinRT builds: the relocations cannot be performed because this
> > > would require writing to the code section, which is not allowed.
> > > 
> > > Get rid of all these issues by not using data exports/imports. The
> > > public API is already free of them, but avpriv_ symbols make extensive
> > > use of them. Replace them all with getters.  
> > 
> > Should be good i think, but it can't be applied as is until the next
> > major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
> 
> Well, I call bullshit. We've never taken ABI compatibility between
> FFmpeg libs seriously, especially not if it was about avpriv functions.

We did take ABI compatibility between FFmpeg libs serious.
And we must to be shiped by distributions that package the libs based
on our ABI versions.


>
> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
> authored and committed by you, and changes an avpriv function in an
> incompatible way, without even minor version bumps.

This commit did not break ABI
no release contains the removed symbol:

 git grep avpriv_dca_parse_core_frame_header release/3.3
 git grep avpriv_dca_parse_core_frame_header release/3.2
 git grep avpriv_dca_parse_core_frame_header release/3.1
 git grep avpriv_dca_parse_core_frame_header release/3.0
 git grep avpriv_dca_parse_core_frame_header release/2.4
 git grep avpriv_dca_parse_core_frame_header release/2.8

The symbol was added 9 days before it was removed, it was in no
release

commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
Author: James Almer <jamrial@gmail.com>
Date:   Wed Jul 19 01:53:22 2017 -0300

    avcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()

commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
Author: foo86 <foobaz86@gmail.com>
Date:   Mon Jul 10 17:11:33 2017 +0300

    avcodec: add avpriv_dca_parse_core_frame_header()
[...]
Hendrik Leppkes Aug. 24, 2017, 9:23 a.m.
On Thu, Aug 24, 2017 at 10:52 AM, wm4 <nfxjfg@googlemail.com> wrote:
> On Wed, 23 Aug 2017 19:23:12 -0300
> James Almer <jamrial@gmail.com> wrote:
>
>> On 8/21/2017 2:51 PM, wm4 wrote:
>> > From: Pedro Pombeiro <pedropombeiro@gmail.com>
>> >
>> > DLL data imports cause problems on Windows. They normally require
>> > each variable to be correctly marked with dllimport/dllexport
>> > declspecs. For MSVC, we define av_export to dllimport declspec. This
>> > is not entirely correct - depending on which sub-lib is built, they
>> > should be marked to dllexport instead. It happens to work with MSVC,
>> > because it supports exports incorrectly marked as imports. Trying to
>> > use this breaks on MinGW and results in linker errors.
>> >
>> > On MinGW, not using any import/export specifiers happens to work,
>> > because binutils and the MinGW runtime provide "pseudo relocations",
>> > which manually fix these imports at load time. This does not work with
>> > MinGW WinRT builds: the relocations cannot be performed because this
>> > would require writing to the code section, which is not allowed.
>> >
>> > Get rid of all these issues by not using data exports/imports. The
>> > public API is already free of them, but avpriv_ symbols make extensive
>> > use of them. Replace them all with getters.
>>
>> Should be good i think, but it can't be applied as is until the next
>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
>
> Well, I call bullshit. We've never taken ABI compatibility between
> FFmpeg libs seriously, especially not if it was about avpriv functions.
>
> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
> authored and committed by you, and changes an avpriv function in an
> incompatible way, without even minor version bumps.
>

That function was added 2 days earlier, clearly still falling into the
grace period of new functions. If you try to find cheap excuses, at
least put some effort into it. :p

avpriv is part of the public ABI and as such cannot be blindly removed.

- Hendrik
James Almer Aug. 24, 2017, 2:31 p.m.
On 8/24/2017 5:52 AM, wm4 wrote:
> On Wed, 23 Aug 2017 19:23:12 -0300
> James Almer <jamrial@gmail.com> wrote:
> 
>> On 8/21/2017 2:51 PM, wm4 wrote:
>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>
>>> DLL data imports cause problems on Windows. They normally require
>>> each variable to be correctly marked with dllimport/dllexport
>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>> is not entirely correct - depending on which sub-lib is built, they
>>> should be marked to dllexport instead. It happens to work with MSVC,
>>> because it supports exports incorrectly marked as imports. Trying to
>>> use this breaks on MinGW and results in linker errors.
>>>
>>> On MinGW, not using any import/export specifiers happens to work,
>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>> which manually fix these imports at load time. This does not work with
>>> MinGW WinRT builds: the relocations cannot be performed because this
>>> would require writing to the code section, which is not allowed.
>>>
>>> Get rid of all these issues by not using data exports/imports. The
>>> public API is already free of them, but avpriv_ symbols make extensive
>>> use of them. Replace them all with getters.  
>>
>> Should be good i think, but it can't be applied as is until the next
>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
> 
> Well, I call bullshit. We've never taken ABI compatibility between
> FFmpeg libs seriously, especially not if it was about avpriv functions.

This is not true. I even mentioned how the current set of major versions
had to deal with a bunch of accidental breakages between releases
(mostly in avcodec and avfilter back in the 3.0 and 3.1 days), all
related to ABI.
We had to compromise and release a point version to put fields back in
their original offset.

> 
> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
> authored and committed by you, and changes an avpriv function in an
> incompatible way, without even minor version bumps.

Michael and Hendrik already explained why this is not a good example.

> 
>> Speaking of which, do you or anyone else want to help with applying the
>> bump right now instead of waiting until the merges are resumed?
>> Finding what deprecated APIs are two years or older, removing them and
>> seeing if any further changes are needed to ensure compilation after the
>> bump (I bet a lot will require changes since deprecations imported from
>> libav aren't given much attention here outside of making sure warnings
>> are silenced).
>> ABI changes, like moving fields around within a struct or into an opaque
>> internal struct, removing/modifying avpriv_ functions, etc, are things
>> that can be done during several weeks after the bump and not necessarily
>> as preparation for it.
>>
>> Certain deprecated APIs that are two years or older could be kept in
>> place if removing them takes too much work at the moment, but the bump
>> is pretty overdue by now due to the amount of crap some structs are
>> currently dealing with (public vs private fields, offsets, etc).
>> We've had enough ABI breakages with this set of major versions so it
>> would be great if we can move on from it before a new release is tagged.
> 
> That sounds good, but I don't think I want to fight this fight (because
> it's going to be a fight). Libav already bumped recently.

Not sure why you call it a fight, but that's the point. The merges are
currently on hold, and I don't know when they will resume (Clément was
waiting for someone to answer about some dash merges, i think), so just
like how we're cherry picking certain commits in the queue I'd very much
like to do the same with the bump related commits.

We're already in the three digit minor version with some libraries,
there are four releases using this set of major version, and a lot of
ABI crap that needs to be cleaned asap. All the "public until this
point, private from this point until this one where things are public
again" crap in some headers, old avpriv_ symbols using GetBitContext
like the one i fixed in 7c9d2ad45f, oversized tables, the ABI part of
the side data split stuff, etc.
Not to mention the deprecated APIs like the old resampler in avcodec.
wm4 Aug. 24, 2017, 3:01 p.m.
On Thu, 24 Aug 2017 11:20:17 +0200
Michael Niedermayer <michael@niedermayer.cc> wrote:

> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
> > On Wed, 23 Aug 2017 19:23:12 -0300
> > James Almer <jamrial@gmail.com> wrote:
> >   
> > > On 8/21/2017 2:51 PM, wm4 wrote:  
> > > > From: Pedro Pombeiro <pedropombeiro@gmail.com>
> > > > 
> > > > DLL data imports cause problems on Windows. They normally require
> > > > each variable to be correctly marked with dllimport/dllexport
> > > > declspecs. For MSVC, we define av_export to dllimport declspec. This
> > > > is not entirely correct - depending on which sub-lib is built, they
> > > > should be marked to dllexport instead. It happens to work with MSVC,
> > > > because it supports exports incorrectly marked as imports. Trying to
> > > > use this breaks on MinGW and results in linker errors.
> > > > 
> > > > On MinGW, not using any import/export specifiers happens to work,
> > > > because binutils and the MinGW runtime provide "pseudo relocations",
> > > > which manually fix these imports at load time. This does not work with
> > > > MinGW WinRT builds: the relocations cannot be performed because this
> > > > would require writing to the code section, which is not allowed.
> > > > 
> > > > Get rid of all these issues by not using data exports/imports. The
> > > > public API is already free of them, but avpriv_ symbols make extensive
> > > > use of them. Replace them all with getters.    
> > > 
> > > Should be good i think, but it can't be applied as is until the next
> > > major bump as it breaks ABI (Tons of avpriv_ symbols are removed).  
> > 
> > Well, I call bullshit. We've never taken ABI compatibility between
> > FFmpeg libs seriously, especially not if it was about avpriv functions.  
> 
> We did take ABI compatibility between FFmpeg libs serious.
> And we must to be shiped by distributions that package the libs based
> on our ABI versions.
> 
> 
> >
> > And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
> > authored and committed by you, and changes an avpriv function in an
> > incompatible way, without even minor version bumps.  
> 
> This commit did not break ABI
> no release contains the removed symbol:
> 
>  git grep avpriv_dca_parse_core_frame_header release/3.3
>  git grep avpriv_dca_parse_core_frame_header release/3.2
>  git grep avpriv_dca_parse_core_frame_header release/3.1
>  git grep avpriv_dca_parse_core_frame_header release/3.0
>  git grep avpriv_dca_parse_core_frame_header release/2.4
>  git grep avpriv_dca_parse_core_frame_header release/2.8
> 
> The symbol was added 9 days before it was removed, it was in no
> release
> 
> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
> Author: James Almer <jamrial@gmail.com>
> Date:   Wed Jul 19 01:53:22 2017 -0300
> 
>     avcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()
> 
> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
> Author: foo86 <foobaz86@gmail.com>
> Date:   Mon Jul 10 17:11:33 2017 +0300
> 
>     avcodec: add avpriv_dca_parse_core_frame_header()
> [...]

We keep ABI stability even within git master, not just within releases.
Otherwise, our lives would be so much easier whenever ABI problems come
up.
James Almer Aug. 24, 2017, 3:11 p.m.
On 8/24/2017 12:01 PM, wm4 wrote:
> On Thu, 24 Aug 2017 11:20:17 +0200
> Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
>> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
>>> On Wed, 23 Aug 2017 19:23:12 -0300
>>> James Almer <jamrial@gmail.com> wrote:
>>>   
>>>> On 8/21/2017 2:51 PM, wm4 wrote:  
>>>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>>>
>>>>> DLL data imports cause problems on Windows. They normally require
>>>>> each variable to be correctly marked with dllimport/dllexport
>>>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>>>> is not entirely correct - depending on which sub-lib is built, they
>>>>> should be marked to dllexport instead. It happens to work with MSVC,
>>>>> because it supports exports incorrectly marked as imports. Trying to
>>>>> use this breaks on MinGW and results in linker errors.
>>>>>
>>>>> On MinGW, not using any import/export specifiers happens to work,
>>>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>>>> which manually fix these imports at load time. This does not work with
>>>>> MinGW WinRT builds: the relocations cannot be performed because this
>>>>> would require writing to the code section, which is not allowed.
>>>>>
>>>>> Get rid of all these issues by not using data exports/imports. The
>>>>> public API is already free of them, but avpriv_ symbols make extensive
>>>>> use of them. Replace them all with getters.    
>>>>
>>>> Should be good i think, but it can't be applied as is until the next
>>>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).  
>>>
>>> Well, I call bullshit. We've never taken ABI compatibility between
>>> FFmpeg libs seriously, especially not if it was about avpriv functions.  
>>
>> We did take ABI compatibility between FFmpeg libs serious.
>> And we must to be shiped by distributions that package the libs based
>> on our ABI versions.
>>
>>
>>>
>>> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
>>> authored and committed by you, and changes an avpriv function in an
>>> incompatible way, without even minor version bumps.  
>>
>> This commit did not break ABI
>> no release contains the removed symbol:
>>
>>  git grep avpriv_dca_parse_core_frame_header release/3.3
>>  git grep avpriv_dca_parse_core_frame_header release/3.2
>>  git grep avpriv_dca_parse_core_frame_header release/3.1
>>  git grep avpriv_dca_parse_core_frame_header release/3.0
>>  git grep avpriv_dca_parse_core_frame_header release/2.4
>>  git grep avpriv_dca_parse_core_frame_header release/2.8
>>
>> The symbol was added 9 days before it was removed, it was in no
>> release
>>
>> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
>> Author: James Almer <jamrial@gmail.com>
>> Date:   Wed Jul 19 01:53:22 2017 -0300
>>
>>     avcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()
>>
>> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
>> Author: foo86 <foobaz86@gmail.com>
>> Date:   Mon Jul 10 17:11:33 2017 +0300
>>
>>     avcodec: add avpriv_dca_parse_core_frame_header()
>> [...]
> 
> We keep ABI stability even within git master, not just within releases.
> Otherwise, our lives would be so much easier whenever ABI problems come
> up.

Yes, that's why the fix was committed two or three days after the symbol
was introduced, and not weeks after (Ignore the above dates, those are
authoring dates).

It was in any case a change that could have waited until the major bump.
I hurried to replace it because i thought it was becoming the only
GetBitContext usage in a libavcodec exported function, thus effectively
making it part of the ABI, something that plays against any attempt to
replace it with the new bitstream reader.
Turns out that no, there were other avpriv_ symbols alredy using it, so
a major bump is nonetheless required to fix GetBitContext's ABI
dependency in other existing avpriv_ symbols.
Ivan Kalvachev Aug. 24, 2017, 11:26 p.m.
On 8/24/17, James Almer <jamrial@gmail.com> wrote:
> On 8/24/2017 12:01 PM, wm4 wrote:
>> On Thu, 24 Aug 2017 11:20:17 +0200
>> Michael Niedermayer <michael@niedermayer.cc> wrote:
>>
>>> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
>>>> On Wed, 23 Aug 2017 19:23:12 -0300
>>>> James Almer <jamrial@gmail.com> wrote:
>>>>
>>>>> On 8/21/2017 2:51 PM, wm4 wrote:
>>>>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>>>>
>>>>>> DLL data imports cause problems on Windows. They normally require
>>>>>> each variable to be correctly marked with dllimport/dllexport
>>>>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>>>>> is not entirely correct - depending on which sub-lib is built, they
>>>>>> should be marked to dllexport instead. It happens to work with MSVC,
>>>>>> because it supports exports incorrectly marked as imports. Trying to
>>>>>> use this breaks on MinGW and results in linker errors.
>>>>>>
>>>>>> On MinGW, not using any import/export specifiers happens to work,
>>>>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>>>>> which manually fix these imports at load time. This does not work with
>>>>>> MinGW WinRT builds: the relocations cannot be performed because this
>>>>>> would require writing to the code section, which is not allowed.
>>>>>>
>>>>>> Get rid of all these issues by not using data exports/imports. The
>>>>>> public API is already free of them, but avpriv_ symbols make extensive
>>>>>> use of them. Replace them all with getters.
>>>>>
>>>>> Should be good i think, but it can't be applied as is until the next
>>>>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
>>>>
>>>> Well, I call bullshit. We've never taken ABI compatibility between
>>>> FFmpeg libs seriously, especially not if it was about avpriv functions.
>>>>
>>>
>>> We did take ABI compatibility between FFmpeg libs serious.
>>> And we must to be shiped by distributions that package the libs based
>>> on our ABI versions.
>>>
>>>
>>>>
>>>> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
>>>> authored and committed by you, and changes an avpriv function in an
>>>> incompatible way, without even minor version bumps.
>>>
>>> This commit did not break ABI
>>> no release contains the removed symbol:
>>>
>>>  git grep avpriv_dca_parse_core_frame_header release/3.3
>>>  git grep avpriv_dca_parse_core_frame_header release/3.2
>>>  git grep avpriv_dca_parse_core_frame_header release/3.1
>>>  git grep avpriv_dca_parse_core_frame_header release/3.0
>>>  git grep avpriv_dca_parse_core_frame_header release/2.4
>>>  git grep avpriv_dca_parse_core_frame_header release/2.8
>>>
>>> The symbol was added 9 days before it was removed, it was in no
>>> release
>>>
>>> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
>>> Author: James Almer <jamrial@gmail.com>
>>> Date:   Wed Jul 19 01:53:22 2017 -0300
>>>
>>>     avcodec/dca: remove GetBitContext usage from
>>> avpriv_dca_parse_core_frame_header()
>>>
>>> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
>>> Author: foo86 <foobaz86@gmail.com>
>>> Date:   Mon Jul 10 17:11:33 2017 +0300
>>>
>>>     avcodec: add avpriv_dca_parse_core_frame_header()
>>> [...]
>>
>> We keep ABI stability even within git master, not just within releases.
>> Otherwise, our lives would be so much easier whenever ABI problems come
>> up.
>
> Yes, that's why the fix was committed two or three days after the symbol
> was introduced, and not weeks after (Ignore the above dates, those are
> authoring dates).
>
> It was in any case a change that could have waited until the major bump.
> I hurried to replace it because i thought it was becoming the only
> GetBitContext usage in a libavcodec exported function, thus effectively
> making it part of the ABI, something that plays against any attempt to
> replace it with the new bitstream reader.
> Turns out that no, there were other avpriv_ symbols alredy using it, so
> a major bump is nonetheless required to fix GetBitContext's ABI
> dependency in other existing avpriv_ symbols.

Digging the past won't help with the current issues.

Can we keep the avpriv_* export of constants, (aka not remove them)
but still apply the portion where avpriv_get_*() are used?

This should keep the ABI and should not cause problems
unless libraries from different builds are mixed.

Probably a minor version bump for the getters
and major for removing the exports.

Since the symbols to constants would no longer be used
by the ffmpeg libraries, the mingw linking problem should
be solved.

Best Regards.
James Almer Aug. 24, 2017, 11:39 p.m.
On 8/24/2017 8:26 PM, Ivan Kalvachev wrote:
> On 8/24/17, James Almer <jamrial@gmail.com> wrote:
>> On 8/24/2017 12:01 PM, wm4 wrote:
>>> On Thu, 24 Aug 2017 11:20:17 +0200
>>> Michael Niedermayer <michael@niedermayer.cc> wrote:
>>>
>>>> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
>>>>> On Wed, 23 Aug 2017 19:23:12 -0300
>>>>> James Almer <jamrial@gmail.com> wrote:
>>>>>
>>>>>> On 8/21/2017 2:51 PM, wm4 wrote:
>>>>>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>>>>>
>>>>>>> DLL data imports cause problems on Windows. They normally require
>>>>>>> each variable to be correctly marked with dllimport/dllexport
>>>>>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>>>>>> is not entirely correct - depending on which sub-lib is built, they
>>>>>>> should be marked to dllexport instead. It happens to work with MSVC,
>>>>>>> because it supports exports incorrectly marked as imports. Trying to
>>>>>>> use this breaks on MinGW and results in linker errors.
>>>>>>>
>>>>>>> On MinGW, not using any import/export specifiers happens to work,
>>>>>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>>>>>> which manually fix these imports at load time. This does not work with
>>>>>>> MinGW WinRT builds: the relocations cannot be performed because this
>>>>>>> would require writing to the code section, which is not allowed.
>>>>>>>
>>>>>>> Get rid of all these issues by not using data exports/imports. The
>>>>>>> public API is already free of them, but avpriv_ symbols make extensive
>>>>>>> use of them. Replace them all with getters.
>>>>>>
>>>>>> Should be good i think, but it can't be applied as is until the next
>>>>>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
>>>>>
>>>>> Well, I call bullshit. We've never taken ABI compatibility between
>>>>> FFmpeg libs seriously, especially not if it was about avpriv functions.
>>>>>
>>>>
>>>> We did take ABI compatibility between FFmpeg libs serious.
>>>> And we must to be shiped by distributions that package the libs based
>>>> on our ABI versions.
>>>>
>>>>
>>>>>
>>>>> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
>>>>> authored and committed by you, and changes an avpriv function in an
>>>>> incompatible way, without even minor version bumps.
>>>>
>>>> This commit did not break ABI
>>>> no release contains the removed symbol:
>>>>
>>>>  git grep avpriv_dca_parse_core_frame_header release/3.3
>>>>  git grep avpriv_dca_parse_core_frame_header release/3.2
>>>>  git grep avpriv_dca_parse_core_frame_header release/3.1
>>>>  git grep avpriv_dca_parse_core_frame_header release/3.0
>>>>  git grep avpriv_dca_parse_core_frame_header release/2.4
>>>>  git grep avpriv_dca_parse_core_frame_header release/2.8
>>>>
>>>> The symbol was added 9 days before it was removed, it was in no
>>>> release
>>>>
>>>> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
>>>> Author: James Almer <jamrial@gmail.com>
>>>> Date:   Wed Jul 19 01:53:22 2017 -0300
>>>>
>>>>     avcodec/dca: remove GetBitContext usage from
>>>> avpriv_dca_parse_core_frame_header()
>>>>
>>>> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
>>>> Author: foo86 <foobaz86@gmail.com>
>>>> Date:   Mon Jul 10 17:11:33 2017 +0300
>>>>
>>>>     avcodec: add avpriv_dca_parse_core_frame_header()
>>>> [...]
>>>
>>> We keep ABI stability even within git master, not just within releases.
>>> Otherwise, our lives would be so much easier whenever ABI problems come
>>> up.
>>
>> Yes, that's why the fix was committed two or three days after the symbol
>> was introduced, and not weeks after (Ignore the above dates, those are
>> authoring dates).
>>
>> It was in any case a change that could have waited until the major bump.
>> I hurried to replace it because i thought it was becoming the only
>> GetBitContext usage in a libavcodec exported function, thus effectively
>> making it part of the ABI, something that plays against any attempt to
>> replace it with the new bitstream reader.
>> Turns out that no, there were other avpriv_ symbols alredy using it, so
>> a major bump is nonetheless required to fix GetBitContext's ABI
>> dependency in other existing avpriv_ symbols.
> 
> Digging the past won't help with the current issues.
> 
> Can we keep the avpriv_* export of constants, (aka not remove them)
> but still apply the portion where avpriv_get_*() are used?
> 
> This should keep the ABI and should not cause problems
> unless libraries from different builds are mixed.
> 
> Probably a minor version bump for the getters
> and major for removing the exports.
> 
> Since the symbols to constants would no longer be used
> by the ffmpeg libraries, the mingw linking problem should
> be solved.
> 
> Best Regards.

Martin sent a patchset that deals with wm4's issue in a different way,
so this patch might not be necessary after all.
Ivan Kalvachev Aug. 25, 2017, 12:36 a.m.
On 8/25/17, James Almer <jamrial@gmail.com> wrote:
> On 8/24/2017 8:26 PM, Ivan Kalvachev wrote:
>> On 8/24/17, James Almer <jamrial@gmail.com> wrote:
>>> On 8/24/2017 12:01 PM, wm4 wrote:
>>>> On Thu, 24 Aug 2017 11:20:17 +0200
>>>> Michael Niedermayer <michael@niedermayer.cc> wrote:
>>>>
>>>>> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
>>>>>> On Wed, 23 Aug 2017 19:23:12 -0300
>>>>>> James Almer <jamrial@gmail.com> wrote:
>>>>>>
>>>>>>> On 8/21/2017 2:51 PM, wm4 wrote:
>>>>>>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>>>>>>
>>>>>>>> DLL data imports cause problems on Windows. They normally require
>>>>>>>> each variable to be correctly marked with dllimport/dllexport
>>>>>>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>>>>>>> is not entirely correct - depending on which sub-lib is built, they
>>>>>>>> should be marked to dllexport instead. It happens to work with MSVC,
>>>>>>>> because it supports exports incorrectly marked as imports. Trying to
>>>>>>>> use this breaks on MinGW and results in linker errors.
>>>>>>>>
>>>>>>>> On MinGW, not using any import/export specifiers happens to work,
>>>>>>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>>>>>>> which manually fix these imports at load time. This does not work
>>>>>>>> with
>>>>>>>> MinGW WinRT builds: the relocations cannot be performed because this
>>>>>>>> would require writing to the code section, which is not allowed.
>>>>>>>>
>>>>>>>> Get rid of all these issues by not using data exports/imports. The
>>>>>>>> public API is already free of them, but avpriv_ symbols make
>>>>>>>> extensive
>>>>>>>> use of them. Replace them all with getters.
>>>>>>>
>>>>>>> Should be good i think, but it can't be applied as is until the next
>>>>>>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
>>>>>>
>>>>>> Well, I call bullshit. We've never taken ABI compatibility between
>>>>>> FFmpeg libs seriously, especially not if it was about avpriv
>>>>>> functions.
>>>>>>
>>>>>
>>>>> We did take ABI compatibility between FFmpeg libs serious.
>>>>> And we must to be shiped by distributions that package the libs based
>>>>> on our ABI versions.
>>>>>
>>>>>
>>>>>>
>>>>>> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
>>>>>> authored and committed by you, and changes an avpriv function in an
>>>>>> incompatible way, without even minor version bumps.
>>>>>
>>>>> This commit did not break ABI
>>>>> no release contains the removed symbol:
>>>>>
>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.3
>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.2
>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.1
>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.0
>>>>>  git grep avpriv_dca_parse_core_frame_header release/2.4
>>>>>  git grep avpriv_dca_parse_core_frame_header release/2.8
>>>>>
>>>>> The symbol was added 9 days before it was removed, it was in no
>>>>> release
>>>>>
>>>>> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
>>>>> Author: James Almer <jamrial@gmail.com>
>>>>> Date:   Wed Jul 19 01:53:22 2017 -0300
>>>>>
>>>>>     avcodec/dca: remove GetBitContext usage from
>>>>> avpriv_dca_parse_core_frame_header()
>>>>>
>>>>> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
>>>>> Author: foo86 <foobaz86@gmail.com>
>>>>> Date:   Mon Jul 10 17:11:33 2017 +0300
>>>>>
>>>>>     avcodec: add avpriv_dca_parse_core_frame_header()
>>>>> [...]
>>>>
>>>> We keep ABI stability even within git master, not just within releases.
>>>> Otherwise, our lives would be so much easier whenever ABI problems come
>>>> up.
>>>
>>> Yes, that's why the fix was committed two or three days after the symbol
>>> was introduced, and not weeks after (Ignore the above dates, those are
>>> authoring dates).
>>>
>>> It was in any case a change that could have waited until the major bump.
>>> I hurried to replace it because i thought it was becoming the only
>>> GetBitContext usage in a libavcodec exported function, thus effectively
>>> making it part of the ABI, something that plays against any attempt to
>>> replace it with the new bitstream reader.
>>> Turns out that no, there were other avpriv_ symbols alredy using it, so
>>> a major bump is nonetheless required to fix GetBitContext's ABI
>>> dependency in other existing avpriv_ symbols.
>>
>> Digging the past won't help with the current issues.
>>
>> Can we keep the avpriv_* export of constants, (aka not remove them)
>> but still apply the portion where avpriv_get_*() are used?
>>
>> This should keep the ABI and should not cause problems
>> unless libraries from different builds are mixed.
>>
>> Probably a minor version bump for the getters
>> and major for removing the exports.
>>
>> Since the symbols to constants would no longer be used
>> by the ffmpeg libraries, the mingw linking problem should
>> be solved.
>>
>> Best Regards.
>
> Martin sent a patchset that deals with wm4's issue in a different way,
> so this patch might not be necessary after all.

I don't see it on the maillist.
James Almer Aug. 25, 2017, 1:28 a.m.
On 8/24/2017 9:36 PM, Ivan Kalvachev wrote:
> On 8/25/17, James Almer <jamrial@gmail.com> wrote:
>> On 8/24/2017 8:26 PM, Ivan Kalvachev wrote:
>>> On 8/24/17, James Almer <jamrial@gmail.com> wrote:
>>>> On 8/24/2017 12:01 PM, wm4 wrote:
>>>>> On Thu, 24 Aug 2017 11:20:17 +0200
>>>>> Michael Niedermayer <michael@niedermayer.cc> wrote:
>>>>>
>>>>>> On Thu, Aug 24, 2017 at 10:52:55AM +0200, wm4 wrote:
>>>>>>> On Wed, 23 Aug 2017 19:23:12 -0300
>>>>>>> James Almer <jamrial@gmail.com> wrote:
>>>>>>>
>>>>>>>> On 8/21/2017 2:51 PM, wm4 wrote:
>>>>>>>>> From: Pedro Pombeiro <pedropombeiro@gmail.com>
>>>>>>>>>
>>>>>>>>> DLL data imports cause problems on Windows. They normally require
>>>>>>>>> each variable to be correctly marked with dllimport/dllexport
>>>>>>>>> declspecs. For MSVC, we define av_export to dllimport declspec. This
>>>>>>>>> is not entirely correct - depending on which sub-lib is built, they
>>>>>>>>> should be marked to dllexport instead. It happens to work with MSVC,
>>>>>>>>> because it supports exports incorrectly marked as imports. Trying to
>>>>>>>>> use this breaks on MinGW and results in linker errors.
>>>>>>>>>
>>>>>>>>> On MinGW, not using any import/export specifiers happens to work,
>>>>>>>>> because binutils and the MinGW runtime provide "pseudo relocations",
>>>>>>>>> which manually fix these imports at load time. This does not work
>>>>>>>>> with
>>>>>>>>> MinGW WinRT builds: the relocations cannot be performed because this
>>>>>>>>> would require writing to the code section, which is not allowed.
>>>>>>>>>
>>>>>>>>> Get rid of all these issues by not using data exports/imports. The
>>>>>>>>> public API is already free of them, but avpriv_ symbols make
>>>>>>>>> extensive
>>>>>>>>> use of them. Replace them all with getters.
>>>>>>>>
>>>>>>>> Should be good i think, but it can't be applied as is until the next
>>>>>>>> major bump as it breaks ABI (Tons of avpriv_ symbols are removed).
>>>>>>>
>>>>>>> Well, I call bullshit. We've never taken ABI compatibility between
>>>>>>> FFmpeg libs seriously, especially not if it was about avpriv
>>>>>>> functions.
>>>>>>>
>>>>>>
>>>>>> We did take ABI compatibility between FFmpeg libs serious.
>>>>>> And we must to be shiped by distributions that package the libs based
>>>>>> on our ABI versions.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> And guess what? You didn't either. Commit 7c9d2ad45f4e46ad2c3b2 is
>>>>>>> authored and committed by you, and changes an avpriv function in an
>>>>>>> incompatible way, without even minor version bumps.
>>>>>>
>>>>>> This commit did not break ABI
>>>>>> no release contains the removed symbol:
>>>>>>
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.3
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.2
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.1
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/3.0
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/2.4
>>>>>>  git grep avpriv_dca_parse_core_frame_header release/2.8
>>>>>>
>>>>>> The symbol was added 9 days before it was removed, it was in no
>>>>>> release
>>>>>>
>>>>>> commit 7c9d2ad45f4e46ad2c3b2e93051efbe1e0d0529e
>>>>>> Author: James Almer <jamrial@gmail.com>
>>>>>> Date:   Wed Jul 19 01:53:22 2017 -0300
>>>>>>
>>>>>>     avcodec/dca: remove GetBitContext usage from
>>>>>> avpriv_dca_parse_core_frame_header()
>>>>>>
>>>>>> commit 2123ddb4251bf39bde8b38a1307a0f6154d260e6
>>>>>> Author: foo86 <foobaz86@gmail.com>
>>>>>> Date:   Mon Jul 10 17:11:33 2017 +0300
>>>>>>
>>>>>>     avcodec: add avpriv_dca_parse_core_frame_header()
>>>>>> [...]
>>>>>
>>>>> We keep ABI stability even within git master, not just within releases.
>>>>> Otherwise, our lives would be so much easier whenever ABI problems come
>>>>> up.
>>>>
>>>> Yes, that's why the fix was committed two or three days after the symbol
>>>> was introduced, and not weeks after (Ignore the above dates, those are
>>>> authoring dates).
>>>>
>>>> It was in any case a change that could have waited until the major bump.
>>>> I hurried to replace it because i thought it was becoming the only
>>>> GetBitContext usage in a libavcodec exported function, thus effectively
>>>> making it part of the ABI, something that plays against any attempt to
>>>> replace it with the new bitstream reader.
>>>> Turns out that no, there were other avpriv_ symbols alredy using it, so
>>>> a major bump is nonetheless required to fix GetBitContext's ABI
>>>> dependency in other existing avpriv_ symbols.
>>>
>>> Digging the past won't help with the current issues.
>>>
>>> Can we keep the avpriv_* export of constants, (aka not remove them)
>>> but still apply the portion where avpriv_get_*() are used?
>>>
>>> This should keep the ABI and should not cause problems
>>> unless libraries from different builds are mixed.
>>>
>>> Probably a minor version bump for the getters
>>> and major for removing the exports.
>>>
>>> Since the symbols to constants would no longer be used
>>> by the ffmpeg libraries, the mingw linking problem should
>>> be solved.
>>>
>>> Best Regards.
>>
>> Martin sent a patchset that deals with wm4's issue in a different way,
>> so this patch might not be necessary after all.
> 
> I don't see it on the maillist.

It's of course on the libav devel mailing list. And the point is, since
there's an alternative solution for this issue with dll boundaries, wm4
as the author of this patch will probably (for the time being) keep it
on hold and until that solution is confirmed to work or not.

If it works, then he'll probably cherry pick it and send it here.

Patch hide | download patch | download mbox

diff --git a/libavcodec/aacadtsdec.c b/libavcodec/aacadtsdec.c
index d0814ac27e..9a6b5d8784 100644
--- a/libavcodec/aacadtsdec.c
+++ b/libavcodec/aacadtsdec.c
@@ -39,7 +39,7 @@  int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
     crc_abs = get_bits1(gbc);    /* protection_absent */
     aot     = get_bits(gbc, 2);  /* profile_objecttype */
     sr      = get_bits(gbc, 4);  /* sample_frequency_index */
-    if (!avpriv_mpeg4audio_sample_rates[sr])
+    if (!avpriv_get_mpeg4audio_sample_rate(sr))
         return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
     skip_bits1(gbc);             /* private_bit */
     ch = get_bits(gbc, 3);       /* channel_configuration */
@@ -62,7 +62,7 @@  int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
     hdr->crc_absent     = crc_abs;
     hdr->num_aac_frames = rdb + 1;
     hdr->sampling_index = sr;
-    hdr->sample_rate    = avpriv_mpeg4audio_sample_rates[sr];
+    hdr->sample_rate    = avpriv_get_mpeg4audio_sample_rate(sr);
     hdr->samples        = (rdb + 1) * 1024;
     hdr->bit_rate       = size * 8 * hdr->sample_rate / hdr->samples;
 
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 11da260742..dbec945994 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -939,8 +939,8 @@  static av_cold int aac_encode_init(AVCodecContext *avctx)
     }
 
     /* Samplerate */
-    for (i = 0; i < 16; i++)
-        if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
+    for (i = 0; i < avpriv_get_mpeg4audio_sample_rate_count(); i++)
+        if (avctx->sample_rate == avpriv_get_mpeg4audio_sample_rate(i))
             break;
     s->samplerate_index = i;
     ERROR_IF(s->samplerate_index == 16 ||
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 83dd90ff67..0de7605ae8 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -144,7 +144,7 @@  int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo **phdr)
                         (hdr->num_blocks * 256);
         hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
     }
-    hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode];
+    hdr->channel_layout = avpriv_get_ac3_channel_layout(hdr->channel_mode);
     if (hdr->lfe_on)
         hdr->channel_layout |= AV_CH_LOW_FREQUENCY;
 
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index c393076aec..52aed93f99 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1585,7 +1585,7 @@  static int ac3_decode_frame(AVCodecContext * avctx, void *data,
         return AVERROR_INVALIDDATA;
     }
     avctx->channels = s->out_channels;
-    avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON];
+    avctx->channel_layout = avpriv_get_ac3_channel_layout(s->output_mode & ~AC3_OUTPUT_LFEON);
     if (s->output_mode & AC3_OUTPUT_LFEON)
         avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
 
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index d62d8bfbf5..eb2ae55631 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -86,7 +86,7 @@  const uint8_t ff_ac3_channels_tab[8] = {
 /**
  * Map audio coding mode (acmod) to channel layout mask.
  */
-const uint16_t avpriv_ac3_channel_layout_tab[8] = {
+static const uint16_t ff_ac3_channel_layout_tab[8] = {
     AV_CH_LAYOUT_STEREO,
     AV_CH_LAYOUT_MONO,
     AV_CH_LAYOUT_STEREO,
@@ -97,6 +97,11 @@  const uint16_t avpriv_ac3_channel_layout_tab[8] = {
     AV_CH_LAYOUT_5POINT0
 };
 
+const uint16_t avpriv_get_ac3_channel_layout(int acmod)
+{
+    return ff_ac3_channel_layout_tab[acmod];
+}
+
 #define COMMON_CHANNEL_MAP \
     { { 0, 1,          }, { 0, 1, 2,         } },\
     { { 0,             }, { 0, 1,            } },\
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index f529fc8077..94ae2c73d0 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -29,7 +29,7 @@ 
 
 extern const uint16_t ff_ac3_frame_size_tab[38][3];
 extern const uint8_t  ff_ac3_channels_tab[8];
-extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8];
+const uint16_t avpriv_get_ac3_channel_layout(int index);
 extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
 extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
 extern const uint16_t ff_ac3_sample_rate_tab[3];
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index f1fafab771..df3e16039c 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -81,7 +81,7 @@  static av_cold int decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = AV_PIX_FMT_PAL8;
 
     /* defaults */
-    s->font        = avpriv_vga16_font;
+    s->font        = avpriv_get_vga16_font();
     s->font_height = 16;
     s->fg          = DEFAULT_FG_COLOR;
     s->bg          = DEFAULT_BG_COLOR;
@@ -216,19 +216,19 @@  static int execute_code(AVCodecContext * avctx, int c)
             s->args[0] = DEFAULT_SCREEN_MODE;
         switch(s->args[0]) {
         case 0: case 1: case 4: case 5: case 13: case 19: //320x200 (25 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_get_cga_font();
             s->font_height = 8;
             width  = 40<<3;
             height = 25<<3;
             break;
         case 2: case 3: //640x400 (25 rows)
-            s->font = avpriv_vga16_font;
+            s->font = avpriv_get_vga16_font();
             s->font_height = 16;
             width  = 80<<3;
             height = 25<<4;
             break;
         case 6: case 14: //640x200 (25 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_get_cga_font();
             s->font_height = 8;
             width  = 80<<3;
             height = 25<<3;
@@ -236,13 +236,13 @@  static int execute_code(AVCodecContext * avctx, int c)
         case 7: //set line wrapping
             break;
         case 15: case 16: //640x350 (43 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_get_cga_font();
             s->font_height = 8;
             width  = 80<<3;
             height = 43<<3;
             break;
         case 17: case 18: //640x480 (60 rows)
-            s->font = avpriv_cga_font;
+            s->font = avpriv_get_cga_font();
             s->font_height = 8;
             width  = 80<<3;
             height = 60<<4;
diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c
index 90bbe67b59..40a18b112d 100644
--- a/libavcodec/bintext.c
+++ b/libavcodec/bintext.c
@@ -84,10 +84,10 @@  static av_cold int decode_init(AVCodecContext *avctx)
             av_log(avctx, AV_LOG_WARNING, "font height %i not supported\n", s->font_height);
             s->font_height = 8;
         case 8:
-            s->font = avpriv_cga_font;
+            s->font = avpriv_get_cga_font();
             break;
         case 16:
-            s->font = avpriv_vga16_font;
+            s->font = avpriv_get_vga16_font();
             break;
         }
     }
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 307b21471e..3f24d331e9 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -33,7 +33,7 @@ 
 #include "get_bits.h"
 #include "put_bits.h"
 
-const uint32_t avpriv_dca_sample_rates[16] = {
+static const uint32_t ff_dca_sample_rates[16] = {
     0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
     12000, 24000, 48000, 96000, 192000
 };
@@ -51,6 +51,11 @@  const uint8_t ff_dca_bits_per_sample[8] = {
     16, 16, 20, 20, 0, 24, 24, 0
 };
 
+uint32_t avpriv_get_dca_sample_rate(int index)
+{
+    return ff_dca_sample_rates[index];
+}
+
 int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
                              int max_size)
 {
@@ -112,7 +117,7 @@  int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb)
         return DCA_PARSE_ERROR_AMODE;
 
     h->sr_code = get_bits(gb, 4);
-    if (!avpriv_dca_sample_rates[h->sr_code])
+    if (!ff_dca_sample_rates[h->sr_code])
         return DCA_PARSE_ERROR_SAMPLE_RATE;
 
     h->br_code = get_bits(gb, 5);
diff --git a/libavcodec/dca.h b/libavcodec/dca.h
index 172c965b3b..6b1fc82d24 100644
--- a/libavcodec/dca.h
+++ b/libavcodec/dca.h
@@ -196,7 +196,7 @@  enum DCADownMixType {
     DCA_DMIX_TYPE_COUNT
 };
 
-extern av_export const uint32_t avpriv_dca_sample_rates[16];
+uint32_t avpriv_get_dca_sample_rate(int index);
 
 extern const uint32_t ff_dca_sampling_freqs[16];
 extern const uint8_t ff_dca_freq_ranges[16];
diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 6cb1f30a3c..dd2bb232cb 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -128,7 +128,7 @@  static int parse_frame_header(DCACoreDecoder *s)
     s->npcmblocks           = h.npcmblocks;
     s->frame_size           = h.frame_size;
     s->audio_mode           = h.audio_mode;
-    s->sample_rate          = avpriv_dca_sample_rates[h.sr_code];
+    s->sample_rate          = avpriv_get_dca_sample_rate(h.sr_code);
     s->bit_rate             = ff_dca_bit_rates[h.br_code];
     s->drc_present          = h.drc_present;
     s->ts_present           = h.ts_present;
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 11ddb8f188..24680fac80 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -267,7 +267,7 @@  static int dca_parse_params(DCAParseContext *pc1, const uint8_t *buf,
         return AVERROR_INVALIDDATA;
 
     *duration = h.npcmblocks * DCA_PCMBLOCK_SAMPLES;
-    *sample_rate = avpriv_dca_sample_rates[h.sr_code];
+    *sample_rate = avpriv_get_dca_sample_rate(h.sr_code);
     if (*profile != FF_PROFILE_UNKNOWN)
         return 0;
 
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 10b6808f81..3c9bc0ef1e 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -182,20 +182,20 @@  static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
 {
     int ret;
 
-    ret = build_vlc(&c->dc_vlc[0], avpriv_mjpeg_bits_dc_luminance,
-                    avpriv_mjpeg_val_dc, 12, 0);
+    ret = build_vlc(&c->dc_vlc[0], avpriv_get_mjpeg_bits_dc_luminance(),
+                    avpriv_get_mjpeg_val_dc(), 12, 0);
     if (ret)
         return ret;
-    ret = build_vlc(&c->dc_vlc[1], avpriv_mjpeg_bits_dc_chrominance,
-                    avpriv_mjpeg_val_dc, 12, 0);
+    ret = build_vlc(&c->dc_vlc[1], avpriv_get_mjpeg_bits_dc_chrominance(),
+                    avpriv_get_mjpeg_val_dc(), 12, 0);
     if (ret)
         return ret;
-    ret = build_vlc(&c->ac_vlc[0], avpriv_mjpeg_bits_ac_luminance,
-                    avpriv_mjpeg_val_ac_luminance, 251, 1);
+    ret = build_vlc(&c->ac_vlc[0], avpriv_get_mjpeg_bits_ac_luminance(),
+                    avpriv_get_mjpeg_val_ac_luminance(), 251, 1);
     if (ret)
         return ret;
-    ret = build_vlc(&c->ac_vlc[1], avpriv_mjpeg_bits_ac_chrominance,
-                    avpriv_mjpeg_val_ac_chrominance, 251, 1);
+    ret = build_vlc(&c->ac_vlc[1], avpriv_get_mjpeg_bits_ac_chrominance(),
+                    avpriv_get_mjpeg_val_ac_chrominance(), 251, 1);
     if (ret)
         return ret;
 
diff --git a/libavcodec/jpegtables.c b/libavcodec/jpegtables.c
index cbe5523cb4..f13f612a57 100644
--- a/libavcodec/jpegtables.c
+++ b/libavcodec/jpegtables.c
@@ -62,17 +62,17 @@  static const unsigned char std_chrominance_quant_tbl[64] = {
 
 /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
 /* IMPORTANT: these are only valid for 8-bit data precision! */
-const uint8_t avpriv_mjpeg_bits_dc_luminance[17] =
+static const uint8_t ff_mjpeg_bits_dc_luminance[17] =
 { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
-const uint8_t avpriv_mjpeg_val_dc[12] =
+static const uint8_t ff_mjpeg_val_dc[12] =
 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
 
-const uint8_t avpriv_mjpeg_bits_dc_chrominance[17] =
+static const uint8_t ff_mjpeg_bits_dc_chrominance[17] =
 { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
 
-const uint8_t avpriv_mjpeg_bits_ac_luminance[17] =
+static const uint8_t ff_mjpeg_bits_ac_luminance[17] =
 { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
-const uint8_t avpriv_mjpeg_val_ac_luminance[] =
+static const uint8_t ff_mjpeg_val_ac_luminance[] =
 { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
   0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
   0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
@@ -96,10 +96,10 @@  const uint8_t avpriv_mjpeg_val_ac_luminance[] =
   0xf9, 0xfa
 };
 
-const uint8_t avpriv_mjpeg_bits_ac_chrominance[17] =
+static const uint8_t ff_mjpeg_bits_ac_chrominance[17] =
 { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
 
-const uint8_t avpriv_mjpeg_val_ac_chrominance[] =
+static const uint8_t ff_mjpeg_val_ac_chrominance[] =
 { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
   0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
   0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
@@ -143,3 +143,38 @@  void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
         code <<= 1;
     }
 }
+
+uint8_t *avpriv_get_mjpeg_bits_dc_luminance(void)
+{
+    return ff_mjpeg_bits_dc_luminance;
+}
+
+uint8_t *avpriv_get_mjpeg_val_dc(void)
+{
+    return ff_mjpeg_val_dc;
+}
+
+uint8_t *avpriv_get_mjpeg_bits_dc_chrominance(void)
+{
+    return ff_mjpeg_bits_dc_chrominance;
+}
+
+uint8_t *avpriv_get_mjpeg_bits_ac_luminance(void)
+{
+    return ff_mjpeg_bits_ac_luminance;
+}
+
+uint8_t *avpriv_get_mjpeg_val_ac_luminance(void)
+{
+    return ff_mjpeg_val_ac_luminance;
+}
+
+uint8_t *avpriv_get_mjpeg_bits_ac_chrominance(void)
+{
+    return ff_mjpeg_bits_ac_chrominance;
+}
+
+uint8_t *avpriv_get_mjpeg_val_ac_chrominance(void)
+{
+    return ff_mjpeg_val_ac_chrominance;
+}
diff --git a/libavcodec/jpegtables.h b/libavcodec/jpegtables.h
index 6833b4b166..7f38f7fa46 100644
--- a/libavcodec/jpegtables.h
+++ b/libavcodec/jpegtables.h
@@ -25,16 +25,16 @@ 
 
 #include "libavutil/internal.h"
 
-extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[];
-extern av_export const uint8_t avpriv_mjpeg_val_dc[];
+uint8_t *avpriv_get_mjpeg_bits_dc_luminance(void);
+uint8_t *avpriv_get_mjpeg_val_dc(void);
 
-extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[];
+uint8_t *avpriv_get_mjpeg_bits_dc_chrominance(void);
 
-extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[];
-extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[];
+uint8_t *avpriv_get_mjpeg_bits_ac_luminance(void);
+uint8_t *avpriv_get_mjpeg_val_ac_luminance(void);
 
-extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[];
-extern av_export const uint8_t avpriv_mjpeg_val_ac_chrominance[];
+uint8_t *avpriv_get_mjpeg_bits_ac_chrominance(void);
+uint8_t *avpriv_get_mjpeg_val_ac_chrominance(void);
 
 void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
                                   const uint8_t *bits_table,
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 924d2e2fff..9138a9da8f 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -319,12 +319,12 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
     ff_mjpeg_build_huffman_codes(s->huff_size_dc_luminance,
                                  s->huff_code_dc_luminance,
-                                 avpriv_mjpeg_bits_dc_luminance,
-                                 avpriv_mjpeg_val_dc);
+                                 avpriv_get_mjpeg_bits_dc_luminance(),
+                                 avpriv_get_mjpeg_val_dc());
     ff_mjpeg_build_huffman_codes(s->huff_size_dc_chrominance,
                                  s->huff_code_dc_chrominance,
-                                 avpriv_mjpeg_bits_dc_chrominance,
-                                 avpriv_mjpeg_val_dc);
+                                 avpriv_get_mjpeg_bits_dc_chrominance(),
+                                 avpriv_get_mjpeg_val_dc());
 
     return 0;
 fail:
diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c
index 6f02bc033c..c3ed0a0ccf 100644
--- a/libavcodec/mjpeg2jpeg_bsf.c
+++ b/libavcodec/mjpeg2jpeg_bsf.c
@@ -66,15 +66,15 @@  static uint8_t *append(uint8_t *buf, const uint8_t *src, int size)
 static uint8_t *append_dht_segment(uint8_t *buf)
 {
     buf = append(buf, dht_segment_head, sizeof(dht_segment_head));
-    buf = append(buf, avpriv_mjpeg_bits_dc_luminance + 1, 16);
+    buf = append(buf, avpriv_get_mjpeg_bits_dc_luminance() + 1, 16);
     buf = append(buf, dht_segment_frag, sizeof(dht_segment_frag));
-    buf = append(buf, avpriv_mjpeg_val_dc, 12);
+    buf = append(buf, avpriv_get_mjpeg_val_dc(), 12);
     *(buf++) = 0x10;
-    buf = append(buf, avpriv_mjpeg_bits_ac_luminance + 1, 16);
-    buf = append(buf, avpriv_mjpeg_val_ac_luminance, 162);
+    buf = append(buf, avpriv_get_mjpeg_bits_ac_luminance() + 1, 16);
+    buf = append(buf, avpriv_get_mjpeg_val_ac_luminance(), 162);
     *(buf++) = 0x11;
-    buf = append(buf, avpriv_mjpeg_bits_ac_chrominance + 1, 16);
-    buf = append(buf, avpriv_mjpeg_val_ac_chrominance, 162);
+    buf = append(buf, avpriv_get_mjpeg_bits_ac_chrominance() + 1, 16);
+    buf = append(buf, avpriv_get_mjpeg_val_ac_chrominance(), 162);
     return buf;
 }
 
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 387ceadf55..bc68d2746c 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -75,28 +75,28 @@  static int build_basic_mjpeg_vlc(MJpegDecodeContext *s)
 {
     int ret;
 
-    if ((ret = build_vlc(&s->vlcs[0][0], avpriv_mjpeg_bits_dc_luminance,
-                         avpriv_mjpeg_val_dc, 12, 0, 0)) < 0)
+    if ((ret = build_vlc(&s->vlcs[0][0], avpriv_get_mjpeg_bits_dc_luminance(),
+                         avpriv_get_mjpeg_val_dc(), 12, 0, 0)) < 0)
         return ret;
 
-    if ((ret = build_vlc(&s->vlcs[0][1], avpriv_mjpeg_bits_dc_chrominance,
-                         avpriv_mjpeg_val_dc, 12, 0, 0)) < 0)
+    if ((ret = build_vlc(&s->vlcs[0][1], avpriv_get_mjpeg_bits_dc_chrominance(),
+                         avpriv_get_mjpeg_val_dc(), 12, 0, 0)) < 0)
         return ret;
 
-    if ((ret = build_vlc(&s->vlcs[1][0], avpriv_mjpeg_bits_ac_luminance,
-                         avpriv_mjpeg_val_ac_luminance, 251, 0, 1)) < 0)
+    if ((ret = build_vlc(&s->vlcs[1][0], avpriv_get_mjpeg_bits_ac_luminance(),
+                         avpriv_get_mjpeg_val_ac_luminance(), 251, 0, 1)) < 0)
         return ret;
 
-    if ((ret = build_vlc(&s->vlcs[1][1], avpriv_mjpeg_bits_ac_chrominance,
-                         avpriv_mjpeg_val_ac_chrominance, 251, 0, 1)) < 0)
+    if ((ret = build_vlc(&s->vlcs[1][1], avpriv_get_mjpeg_bits_ac_chrominance(),
+                         avpriv_get_mjpeg_val_ac_chrominance(), 251, 0, 1)) < 0)
         return ret;
 
-    if ((ret = build_vlc(&s->vlcs[2][0], avpriv_mjpeg_bits_ac_luminance,
-                         avpriv_mjpeg_val_ac_luminance, 251, 0, 0)) < 0)
+    if ((ret = build_vlc(&s->vlcs[2][0], avpriv_get_mjpeg_bits_ac_luminance(),
+                         avpriv_get_mjpeg_val_ac_luminance(), 251, 0, 0)) < 0)
         return ret;
 
-    if ((ret = build_vlc(&s->vlcs[2][1], avpriv_mjpeg_bits_ac_chrominance,
-                         avpriv_mjpeg_val_ac_chrominance, 251, 0, 0)) < 0)
+    if ((ret = build_vlc(&s->vlcs[2][1], avpriv_get_mjpeg_bits_ac_chrominance(),
+                         avpriv_get_mjpeg_val_ac_chrominance(), 251, 0, 0)) < 0)
         return ret;
 
 
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index e6cdaf6376..c213ff3f20 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -90,20 +90,20 @@  av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
     // they are needed at least right now for some processes like trellis.
     ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,
                                  m->huff_code_dc_luminance,
-                                 avpriv_mjpeg_bits_dc_luminance,
-                                 avpriv_mjpeg_val_dc);
+                                 avpriv_get_mjpeg_bits_dc_luminance(),
+                                 avpriv_get_mjpeg_val_dc());
     ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,
                                  m->huff_code_dc_chrominance,
-                                 avpriv_mjpeg_bits_dc_chrominance,
-                                 avpriv_mjpeg_val_dc);
+                                 avpriv_get_mjpeg_bits_dc_chrominance(),
+                                 avpriv_get_mjpeg_val_dc());
     ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,
                                  m->huff_code_ac_luminance,
-                                 avpriv_mjpeg_bits_ac_luminance,
-                                 avpriv_mjpeg_val_ac_luminance);
+                                 avpriv_get_mjpeg_bits_ac_luminance(),
+                                 avpriv_get_mjpeg_val_ac_luminance());
     ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance,
                                  m->huff_code_ac_chrominance,
-                                 avpriv_mjpeg_bits_ac_chrominance,
-                                 avpriv_mjpeg_val_ac_chrominance);
+                                 avpriv_get_mjpeg_bits_ac_chrominance(),
+                                 avpriv_get_mjpeg_val_ac_chrominance());
 
     ff_init_uni_ac_vlc(m->huff_size_ac_luminance,   m->uni_ac_vlc_len);
     ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len);
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 31868c9bed..69d8c192a9 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -149,15 +149,15 @@  static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
         size += put_huffman_table(p, 1, 1, s->mjpeg_ctx->bits_ac_chrominance,
                                   s->mjpeg_ctx->val_ac_chrominance);
     } else {
-        size += put_huffman_table(p, 0, 0, avpriv_mjpeg_bits_dc_luminance,
-                                  avpriv_mjpeg_val_dc);
-        size += put_huffman_table(p, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
-                                  avpriv_mjpeg_val_dc);
-
-        size += put_huffman_table(p, 1, 0, avpriv_mjpeg_bits_ac_luminance,
-                                  avpriv_mjpeg_val_ac_luminance);
-        size += put_huffman_table(p, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
-                                  avpriv_mjpeg_val_ac_chrominance);
+        size += put_huffman_table(p, 0, 0, avpriv_get_mjpeg_bits_dc_luminance(),
+                                  avpriv_get_mjpeg_val_dc());
+        size += put_huffman_table(p, 0, 1, avpriv_get_mjpeg_bits_dc_chrominance(),
+                                  avpriv_get_mjpeg_val_dc());
+
+        size += put_huffman_table(p, 1, 0, avpriv_get_mjpeg_bits_ac_luminance(),
+                                  avpriv_get_mjpeg_val_ac_luminance());
+        size += put_huffman_table(p, 1, 1, avpriv_get_mjpeg_bits_ac_chrominance(),
+                                  avpriv_get_mjpeg_val_ac_chrominance());
     }
     AV_WB16(ptr, size);
 }
diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c
index 22c1ef0220..987562731f 100644
--- a/libavcodec/mp3_header_decompress_bsf.c
+++ b/libavcodec/mp3_header_decompress_bsf.c
@@ -62,10 +62,10 @@  static int mp3_header_decompress(AVBSFContext *ctx, AVPacket *out)
     lsf     = sample_rate < (24000+32000)/2;
     mpeg25  = sample_rate < (12000+16000)/2;
     sample_rate_index= (header>>10)&3;
-    sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
+    sample_rate= avpriv_get_mpa_freq(sample_rate_index) >> (lsf + mpeg25); //in case sample rate is a little off
 
     for(bitrate_index=2; bitrate_index<30; bitrate_index++){
-        frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
+        frame_size = avpriv_get_mpa_bitrate(lsf, 2, bitrate_index>>1);
         frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
         if(frame_size == buf_size + 4)
             break;
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index b6bb323440..1cb0c3d249 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -59,11 +59,21 @@  static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c)
 
 /* XXX: make sure to update the copies in the different encoders if you change
  * this table */
-const int avpriv_mpeg4audio_sample_rates[16] = {
+static const int ff_mpeg4audio_sample_rates[16] = {
     96000, 88200, 64000, 48000, 44100, 32000,
     24000, 22050, 16000, 12000, 11025, 8000, 7350
 };
 
+int avpriv_get_mpeg4audio_sample_rate_count(void)
+{
+    return FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates);
+}
+
+int avpriv_get_mpeg4audio_sample_rate(int index)
+{
+    return ff_mpeg4audio_sample_rates[index];
+}
+
 const uint8_t ff_mpeg4audio_channels[8] = {
     0, 1, 2, 3, 4, 5, 6, 8
 };
@@ -80,7 +90,7 @@  static inline int get_sample_rate(GetBitContext *gb, int *index)
 {
     *index = get_bits(gb, 4);
     return *index == 0x0f ? get_bits(gb, 24) :
-        avpriv_mpeg4audio_sample_rates[*index];
+        avpriv_get_mpeg4audio_sample_rate(*index);
 }
 
 int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb,
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index 8fd32f96b3..76546f15b1 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -41,7 +41,9 @@  typedef struct MPEG4AudioConfig {
     int frame_length_short;
 } MPEG4AudioConfig;
 
-extern av_export const int avpriv_mpeg4audio_sample_rates[16];
+int avpriv_get_mpeg4audio_sample_rate_count(void);
+int avpriv_get_mpeg4audio_sample_rate(int index);
+
 extern const uint8_t ff_mpeg4audio_channels[8];
 
 /**
diff --git a/libavcodec/mpegaudiodata.c b/libavcodec/mpegaudiodata.c
index 0569281109..f3a9526fa8 100644
--- a/libavcodec/mpegaudiodata.c
+++ b/libavcodec/mpegaudiodata.c
@@ -27,7 +27,7 @@ 
 #include "mpegaudiodata.h"
 
 
-const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
+static const uint16_t ff_mpa_bitrate_tab[2][3][15] = {
     { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
       {0, 32, 48, 56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320, 384 },
       {0, 32, 40, 48,  56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320 } },
@@ -37,7 +37,22 @@  const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
     }
 };
 
-const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
+uint16_t avpriv_get_mpa_bitrate(int lsf, int b, int bitrate_index)
+{
+    return ff_mpa_bitrate_tab[lsf][b][bitrate_index];
+}
+
+static const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 };
+
+uint16_t avpriv_get_mpa_freq_count(void)
+{
+    return FF_ARRAY_ELEMS(ff_mpa_freq_tab);
+}
+
+uint16_t avpriv_get_mpa_freq(int index)
+{
+    return ff_mpa_freq_tab[index];
+}
 
 /*******************************************************/
 /* layer 2 tables */
diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h
index 29a26588b2..a4471e04f6 100644
--- a/libavcodec/mpegaudiodata.h
+++ b/libavcodec/mpegaudiodata.h
@@ -34,8 +34,10 @@ 
 #define MODE_EXT_MS_STEREO 2
 #define MODE_EXT_I_STEREO  1
 
-extern av_export const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
-extern av_export const uint16_t avpriv_mpa_freq_tab[3];
+uint16_t avpriv_get_mpa_bitrate(int a, int b, int c);
+uint16_t avpriv_get_mpa_freq_count(void);
+uint16_t avpriv_get_mpa_freq(int index);
+
 extern const int ff_mpa_sblimit_table[5];
 extern const int ff_mpa_quant_steps[17];
 extern const int ff_mpa_quant_bits[17];
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index ae86b087f3..9c8efd0295 100644
--- a/libavcodec/mpegaudiodecheader.c
+++ b/libavcodec/mpegaudiodecheader.c
@@ -54,9 +54,9 @@  int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
     s->layer = 4 - ((header >> 17) & 3);
     /* extract frequency */
     sample_rate_index = (header >> 10) & 3;
-    if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab))
+    if (sample_rate_index >= avpriv_get_mpa_freq_count())
         sample_rate_index = 0;
-    sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
+    sample_rate = avpriv_get_mpa_freq(sample_rate_index) >> (s->lsf + mpeg25);
     sample_rate_index += 3 * (s->lsf + mpeg25);
     s->sample_rate_index = sample_rate_index;
     s->error_protection = ((header >> 16) & 1) ^ 1;
@@ -77,7 +77,7 @@  int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
         s->nb_channels = 2;
 
     if (bitrate_index != 0) {
-        frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
+        frame_size = avpriv_get_mpa_bitrate(s->lsf, s->layer - 1, bitrate_index);
         s->bit_rate = frame_size * 1000;
         switch(s->layer) {
         case 1:
diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 93363fe1d2..4a6ab6126b 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -93,10 +93,10 @@  static av_cold int MPA_encode_init(AVCodecContext *avctx)
 
     /* encoding freq */
     s->lsf = 0;
-    for(i=0;i<3;i++) {
-        if (avpriv_mpa_freq_tab[i] == freq)
+    for(i=0;i<avpriv_get_mpa_freq_count();i++) {
+        if (avpriv_get_mpa_freq(i) == freq)
             break;
-        if ((avpriv_mpa_freq_tab[i] / 2) == freq) {
+        if ((avpriv_get_mpa_freq(i) / 2) == freq) {
             s->lsf = 1;
             break;
         }
@@ -109,12 +109,12 @@  static av_cold int MPA_encode_init(AVCodecContext *avctx)
 
     /* encoding bitrate & frequency */
     for(i=1;i<15;i++) {
-        if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
+        if (avpriv_get_mpa_bitrate(s->lsf, 1, i) == bitrate)
             break;
     }
     if (i == 15 && !avctx->bit_rate) {
         i = 14;
-        bitrate = avpriv_mpa_bitrate_tab[s->lsf][1][i];
+        bitrate = avpriv_get_mpa_bitrate(s->lsf, 1, i);
         avctx->bit_rate = bitrate * 1000;
     }
     if (i == 15){
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 8da2a9735e..004a5f8a71 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -330,3 +330,13 @@  const PixelFormatTag avpriv_pix_fmt_bps_mov[] = {
     { AV_PIX_FMT_PAL8,     33 },
     { AV_PIX_FMT_NONE,      0 },
 };
+
+const struct PixelFormatTag *avpriv_get_pix_fmt_bps_avi(void)
+{
+    return avpriv_pix_fmt_bps_avi;
+}
+
+const struct PixelFormatTag *avpriv_get_pix_fmt_bps_mov(void)
+{
+    return avpriv_pix_fmt_bps_mov;
+}
diff --git a/libavcodec/raw.h b/libavcodec/raw.h
index 24bf4cc55a..bb153c9764 100644
--- a/libavcodec/raw.h
+++ b/libavcodec/raw.h
@@ -41,7 +41,7 @@  const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void);
 
 enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc);
 
-extern av_export const PixelFormatTag avpriv_pix_fmt_bps_avi[];
-extern av_export const PixelFormatTag avpriv_pix_fmt_bps_mov[];
+const struct PixelFormatTag *avpriv_get_pix_fmt_bps_avi(void);
+const struct PixelFormatTag *avpriv_get_pix_fmt_bps_mov(void);
 
 #endif /* AVCODEC_RAW_H */
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1893b26444..4471af8c33 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -75,15 +75,15 @@  static av_cold int raw_init_decoder(AVCodecContext *avctx)
 
     if (   avctx->codec_tag == MKTAG('r','a','w',' ')
         || avctx->codec_tag == MKTAG('N','O','1','6'))
-        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov,
+        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_get_pix_fmt_bps_mov(),
                                       avctx->bits_per_coded_sample);
     else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W'))
-        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
+        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_get_pix_fmt_bps_avi(),
                                       avctx->bits_per_coded_sample);
     else if (avctx->codec_tag && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0))
         avctx->pix_fmt = avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
     else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample)
-        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
+        avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_get_pix_fmt_bps_avi(),
                                       avctx->bits_per_coded_sample);
 
     desc = av_pix_fmt_desc_get(avctx->pix_fmt);
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
index b738fcb103..ef69a3b071 100644
--- a/libavcodec/tmv.c
+++ b/libavcodec/tmv.c
@@ -70,7 +70,7 @@  static int tmv_decode_frame(AVCodecContext *avctx, void *data,
             bg = *src  >> 4;
             fg = *src++ & 0xF;
             ff_draw_pc_font(dst + x * 8, frame->linesize[0],
-                            avpriv_cga_font, 8, c, fg, bg);
+                            avpriv_get_cga_font(), 8, c, fg, bg);
         }
         dst += frame->linesize[0] * 8;
     }
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index 3afce28a10..87dca1a21c 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -102,23 +102,23 @@  static av_cold void vaapi_encode_mjpeg_init_tables(AVCodecContext *avctx)
     huff->load_huffman_table[0] = 1;
     vaapi_encode_mjpeg_copy_huffman(huff->huffman_table[0].num_dc_codes,
                                     huff->huffman_table[0].dc_values,
-                                    avpriv_mjpeg_bits_dc_luminance,
-                                    avpriv_mjpeg_val_dc);
+                                    avpriv_get_mjpeg_bits_dc_luminance(),
+                                    avpriv_get_mjpeg_val_dc());
     vaapi_encode_mjpeg_copy_huffman(huff->huffman_table[0].num_ac_codes,
                                     huff->huffman_table[0].ac_values,
-                                    avpriv_mjpeg_bits_ac_luminance,
-                                    avpriv_mjpeg_val_ac_luminance);
+                                    avpriv_get_mjpeg_bits_ac_luminance(),
+                                    avpriv_get_mjpeg_val_ac_luminance());
     memset(huff->huffman_table[0].pad, 0, sizeof(huff->huffman_table[0].pad));
 
     huff->load_huffman_table[1] = 1;
     vaapi_encode_mjpeg_copy_huffman(huff->huffman_table[1].num_dc_codes,
                                     huff->huffman_table[1].dc_values,
-                                    avpriv_mjpeg_bits_dc_chrominance,
-                                    avpriv_mjpeg_val_dc);
+                                    avpriv_get_mjpeg_bits_dc_chrominance(),
+                                    avpriv_get_mjpeg_val_dc());
     vaapi_encode_mjpeg_copy_huffman(huff->huffman_table[1].num_ac_codes,
                                     huff->huffman_table[1].ac_values,
-                                    avpriv_mjpeg_bits_ac_chrominance,
-                                    avpriv_mjpeg_val_ac_chrominance);
+                                    avpriv_get_mjpeg_bits_ac_chrominance(),
+                                    avpriv_get_mjpeg_val_ac_chrominance());
     memset(huff->huffman_table[1].pad, 0, sizeof(huff->huffman_table[1].pad));
 }
 
diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 875ba48cee..4723a868e7 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -657,6 +657,7 @@  static int render_default_font(AVFrame *tmp)
     uint8_t *data = tmp->data[0];
     int linesize = tmp->linesize[0];
     int width = 1920/2, height = 16;
+    const uint8_t *font = avpriv_get_vga16_font();
 
     for (x = 0; x < width; x += width/10) {
         uint8_t *startptr = data + 4 * x;
@@ -664,7 +665,7 @@  static int render_default_font(AVFrame *tmp)
             for (v = 0; v < height; v++) {
                 uint8_t *p = startptr + v * linesize + height/2 * 4 * u;
                 for (mask = 0x80; mask; mask >>= 1, p += 4) {
-                    if (mask & avpriv_vga16_font[str[u] * 16 + v])
+                    if (mask & font[str[u] * 16 + v])
                         p[3] = 255;
                     else
                         p[3] = 0;
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 4317161d79..992674360c 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -992,7 +992,7 @@  static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
     int font_height;
     int i;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (i = 0; txt[i]; i++) {
         int char_y, mask;
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index 897e5709b8..9910c53c0e 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -178,7 +178,7 @@  static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o)
     int font_height;
     int i;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (i = 0; txt[i]; i++) {
         int char_y, mask;
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index 1e8b90fa2f..0e2b7d23c9 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -217,8 +217,8 @@  static void drawtext(AVFrame *pic, int x, int y, int ftid, const uint8_t *color,
     int font_height;
     va_list vl;
 
-    if      (ftid == FONT16) font = avpriv_vga16_font, font_height = 16;
-    else if (ftid == FONT8)  font = avpriv_cga_font,   font_height =  8;
+    if      (ftid == FONT16) font = avpriv_get_vga16_font(), font_height = 16;
+    else if (ftid == FONT8)  font = avpriv_get_cga_font(),   font_height =  8;
     else return;
 
     va_start(vl, fmt);
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 7a1dc4de01..f66858832c 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -89,7 +89,7 @@  static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color,
         }
         ff_blend_mask(draw, color, frame->data, frame->linesize,
                       frame->width, frame->height,
-                      avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0);
+                      avpriv_get_cga_font() + *text * 8, 1, 8, 8, 0, 0, x, y0);
         if (vertical) {
             x = x0;
             y0 += 8;
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index e3e00797d0..2c3482be39 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -903,7 +903,7 @@  static void draw_htext(AVFrame *out, int x, int y, float o1, float o2, const cha
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
@@ -929,7 +929,7 @@  static void draw_htext16(AVFrame *out, int x, int y, float o1, float o2, const c
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 0c574742a0..6113627ec3 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -2199,7 +2199,7 @@  static void draw_htext(AVFrame *out, int x, int y, float o1, float o2, const cha
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
@@ -2225,7 +2225,7 @@  static void draw_htext16(AVFrame *out, int x, int y, int mult, float o1, float o
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
@@ -2251,7 +2251,7 @@  static void draw_vtext(AVFrame *out, int x, int y, float o1, float o2, const cha
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
@@ -2276,7 +2276,7 @@  static void draw_vtext16(AVFrame *out, int x, int y, int mult, float o1, float o
     int font_height;
     int i, plane;
 
-    font = avpriv_cga_font,   font_height =  8;
+    font = avpriv_get_cga_font(),   font_height =  8;
 
     for (plane = 0; plane < 4 && out->data[plane]; plane++) {
         for (i = 0; txt[i]; i++) {
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index fe0d50aa41..7fd641a884 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -730,7 +730,7 @@  static void draw_text(TestSourceContext *s, AVFrame *frame, FFDrawColor *color,
         }
         ff_blend_mask(&s->draw, color, frame->data, frame->linesize,
                       frame->width, frame->height,
-                      avpriv_vga16_font + *text * 16, 1, 8, 16, 0, 0, x, y0);
+                      avpriv_get_vga16_font() + *text * 16, 1, 8, 16, 0, 0, x, y0);
         x += 8;
     }
 }
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 483f5b54b1..62ac148e64 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -451,7 +451,7 @@  static int avi_write_header(AVFormatContext *s)
                     par->bits_per_coded_sample = 16;
                 avist->pal_offset = avio_tell(pb) + 40;
                 ff_put_bmp_header(pb, par, 0, 0);
-                pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
+                pix_fmt = avpriv_find_pix_fmt(avpriv_get_pix_fmt_bps_avi(),
                                               par->bits_per_coded_sample);
                 if (   !par->codec_tag
                     && par->codec_id == AV_CODEC_ID_RAWVIDEO
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 0ae8450469..d96172e461 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -533,8 +533,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
             if (ret < 0)
                 return ret;
             st->codecpar->channels = cfg.channels;
-            if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
-                st->codecpar->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index];
+            if (cfg.object_type == 29 && cfg.sampling_index < avpriv_get_mpa_freq_count()) // old mp3on4
+                st->codecpar->sample_rate = avpriv_get_mpa_freq(cfg.sampling_index);
             else if (cfg.ext_sample_rate)
                 st->codecpar->sample_rate = cfg.ext_sample_rate;
             else
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 94a56ebfa7..9b4bb5ddf7 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1714,8 +1714,8 @@  static int matroska_aac_sri(int samplerate)
 {
     int sri;
 
-    for (sri = 0; sri < FF_ARRAY_ELEMS(avpriv_mpeg4audio_sample_rates); sri++)
-        if (avpriv_mpeg4audio_sample_rates[sri] == samplerate)
+    for (sri = 0; sri < avpriv_get_mpeg4audio_sample_rate_count(); sri++)
+        if (avpriv_get_mpeg4audio_sample_rate(sri) == samplerate)
             break;
     return sri;
 }
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 522ce60c2d..fb94b57204 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -812,7 +812,7 @@  static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     acmod = (ac3info >> 11) & 0x7;
     lfeon = (ac3info >> 10) & 0x1;
     st->codecpar->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
-    st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
+    st->codecpar->channel_layout = avpriv_get_ac3_channel_layout(acmod);
     if (lfeon)
         st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
     *ast = bsmod;
@@ -851,7 +851,7 @@  static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     bsmod = (eac3info >> 12) & 0x1f;
     acmod = (eac3info >>  9) & 0x7;
     lfeon = (eac3info >>  8) & 0x1;
-    st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
+    st->codecpar->channel_layout = avpriv_get_ac3_channel_layout(acmod);
     if (lfeon)
         st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY;
     st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 10b959ad02..1351bf6cb8 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1448,7 +1448,7 @@  static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
         }
     }
 
-    pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov,
+    pix_fmt = avpriv_find_pix_fmt(avpriv_get_pix_fmt_bps_mov(),
                                   track->par->bits_per_coded_sample);
     if (tag == MKTAG('r','a','w',' ') &&
         track->par->format != pix_fmt &&
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 3cbf7bd137..2a9690f790 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -147,8 +147,8 @@  static int mp3_write_xing(AVFormatContext *s)
     if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) || !mp3->write_xing)
         return 0;
 
-    for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) {
-        const uint16_t base_freq = avpriv_mpa_freq_tab[i];
+    for (i = 0; i < avpriv_get_mpa_freq_count(); i++) {
+        const uint16_t base_freq = avpriv_get_mpa_freq(i);
 
         if      (par->sample_rate == base_freq)     ver = 0x3; // MPEG 1
         else if (par->sample_rate == base_freq / 2) ver = 0x2; // MPEG 2
@@ -158,7 +158,7 @@  static int mp3_write_xing(AVFormatContext *s)
         srate_idx = i;
         break;
     }
-    if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
+    if (i == avpriv_get_mpa_freq_count()) {
         av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing header.\n");
         return -1;
     }
@@ -178,7 +178,7 @@  static int mp3_write_xing(AVFormatContext *s)
     header |= channels << 6;
 
     for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) {
-        int bit_rate = 1000 * avpriv_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx];
+        int bit_rate = 1000 * avpriv_get_mpa_bitrate(ver != 3, 3 - 1, bitrate_idx);
         int error    = FFABS(bit_rate - par->bit_rate);
 
         if (error < best_bitrate_error) {
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index a92ff55c01..8efe52c91a 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -70,11 +70,11 @@  static int find_expected_header(AVCodecParameters *p, int size, int key_frame,
         else if (sample_rate < (44100 + 48000) / 2) sample_rate_index = 0;
         else                                        sample_rate_index = 1;
 
-        sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
+        sample_rate = avpriv_get_mpa_freq(sample_rate_index) >> (lsf + mpeg25);
 
         for (bitrate_index = 2; bitrate_index < 30; bitrate_index++) {
             frame_size =
-                avpriv_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1];
+                avpriv_get_mpa_bitrate(lsf, layer - 1, bitrate_index >> 1);
             frame_size = (frame_size * 144000) / (sample_rate << lsf) +
                 (bitrate_index & 1);
 
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 465d9bc292..075ee49c44 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -144,14 +144,14 @@  static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w,
     bytestream2_put_be16(&pbc, 0);
 
     dht_size  = 2;
-    dht_size += jpeg_create_huffman_table(&pbc, 0, 0,avpriv_mjpeg_bits_dc_luminance,
-                                          avpriv_mjpeg_val_dc);
-    dht_size += jpeg_create_huffman_table(&pbc, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
-                                          avpriv_mjpeg_val_dc);
-    dht_size += jpeg_create_huffman_table(&pbc, 1, 0, avpriv_mjpeg_bits_ac_luminance,
-                                          avpriv_mjpeg_val_ac_luminance);
-    dht_size += jpeg_create_huffman_table(&pbc, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
-                                          avpriv_mjpeg_val_ac_chrominance);
+    dht_size += jpeg_create_huffman_table(&pbc, 0, 0,avpriv_get_mjpeg_bits_dc_luminance(),
+                                          avpriv_get_mjpeg_val_dc());
+    dht_size += jpeg_create_huffman_table(&pbc, 0, 1, avpriv_get_mjpeg_bits_dc_chrominance(),
+                                          avpriv_get_mjpeg_val_dc());
+    dht_size += jpeg_create_huffman_table(&pbc, 1, 0, avpriv_get_mjpeg_bits_ac_luminance(),
+                                          avpriv_get_mjpeg_val_ac_luminance());
+    dht_size += jpeg_create_huffman_table(&pbc, 1, 1, avpriv_get_mjpeg_bits_ac_chrominance(),
+                                          avpriv_get_mjpeg_val_ac_chrominance());
     AV_WB16(dht_size_ptr, dht_size);
 
     /* SOF0 */
diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 38eb2e68eb..ae38b73d5f 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -101,8 +101,8 @@  void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
                 switch (buf[i + 1]) {
                 case 0x00:
                     if (   dht_size >= 29
-                        && !memcmp(buf + i +  2, avpriv_mjpeg_bits_dc_luminance + 1, 16)
-                        && !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+                        && !memcmp(buf + i +  2, avpriv_get_mjpeg_bits_dc_luminance() + 1, 16)
+                        && !memcmp(buf + i + 18, avpriv_get_mjpeg_val_dc(), 12)) {
                         default_huffman_tables |= 1;
                         i += 29;
                         dht_size -= 29;
@@ -113,8 +113,8 @@  void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
                     break;
                 case 0x01:
                     if (   dht_size >= 29
-                        && !memcmp(buf + i +  2, avpriv_mjpeg_bits_dc_chrominance + 1, 16)
-                        && !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) {
+                        && !memcmp(buf + i +  2, avpriv_get_mjpeg_bits_dc_chrominance() + 1, 16)
+                        && !memcmp(buf + i + 18, avpriv_get_mjpeg_val_dc(), 12)) {
                         default_huffman_tables |= 1 << 1;
                         i += 29;
                         dht_size -= 29;
@@ -125,8 +125,8 @@  void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
                     break;
                 case 0x10:
                     if (   dht_size >= 179
-                        && !memcmp(buf + i +  2, avpriv_mjpeg_bits_ac_luminance   + 1, 16)
-                        && !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_luminance, 162)) {
+                        && !memcmp(buf + i +  2, avpriv_get_mjpeg_bits_ac_luminance()   + 1, 16)
+                        && !memcmp(buf + i + 18, avpriv_get_mjpeg_val_ac_luminance(), 162)) {
                         default_huffman_tables |= 1 << 2;
                         i += 179;
                         dht_size -= 179;
@@ -137,8 +137,8 @@  void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
                     break;
                 case 0x11:
                     if (   dht_size >= 179
-                        && !memcmp(buf + i +  2, avpriv_mjpeg_bits_ac_chrominance + 1, 16)
-                        && !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_chrominance, 162)) {
+                        && !memcmp(buf + i +  2, avpriv_get_mjpeg_bits_ac_chrominance() + 1, 16)
+                        && !memcmp(buf + i + 18, avpriv_get_mjpeg_val_ac_chrominance(), 162)) {
                         default_huffman_tables |= 1 << 3;
                         i += 179;
                         dht_size -= 179;
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 4e37f65b09..16a8c882e7 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -453,8 +453,8 @@  static char *latm_context2config(AVFormatContext *s, AVCodecParameters *par)
     int rate_index;
     char *config;
 
-    for (rate_index = 0; rate_index < 16; rate_index++)
-        if (avpriv_mpeg4audio_sample_rates[rate_index] == par->sample_rate)
+    for (rate_index = 0; rate_index < avpriv_get_mpeg4audio_sample_rate_count(); rate_index++)
+        if (avpriv_get_mpeg4audio_sample_rate(rate_index) == par->sample_rate)
             break;
     if (rate_index == 16) {
         av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n");
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index b47ec123e8..6821ec8c1c 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -255,7 +255,7 @@  static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
     case DCA_SYNCWORD_CORE_BE:
         blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
         core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1;
-        sample_rate = avpriv_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
+        sample_rate = avpriv_get_dca_sample_rate((pkt->data[8] >> 2) & 0x0f);
         break;
     case DCA_SYNCWORD_CORE_LE:
         blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;
diff --git a/libavutil/internal.h b/libavutil/internal.h
index a2d73e3cc6..b74716107b 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -62,12 +62,6 @@ 
 #endif
 #endif
 
-#if defined(_MSC_VER) && CONFIG_SHARED
-#    define av_export __declspec(dllimport)
-#else
-#    define av_export
-#endif
-
 #if HAVE_PRAGMA_DEPRECATED
 #    if defined(__ICL) || defined (__INTEL_COMPILER)
 #        define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
diff --git a/libavutil/xga_font_data.c b/libavutil/xga_font_data.c
index 3aed3142cf..1574123236 100644
--- a/libavutil/xga_font_data.c
+++ b/libavutil/xga_font_data.c
@@ -26,7 +26,7 @@ 
 #include <stdint.h>
 #include "xga_font_data.h"
 
-const uint8_t avpriv_cga_font[2048] = {
+static const uint8_t ff_cga_font[2048] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
  0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00,
  0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c,
@@ -157,7 +157,7 @@  const uint8_t avpriv_cga_font[2048] = {
  0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 
-const uint8_t avpriv_vga16_font[4096] = {
+static const uint8_t ff_vga16_font[4096] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
@@ -415,3 +415,13 @@  const uint8_t avpriv_vga16_font[4096] = {
  0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
+
+const uint8_t* avpriv_get_cga_font(void)
+{
+    return ff_cga_font;
+}
+
+const uint8_t* avpriv_get_vga16_font(void)
+{
+    return ff_vga16_font;
+}
diff --git a/libavutil/xga_font_data.h b/libavutil/xga_font_data.h
index 5e40f542e4..1e2bc17a8e 100644
--- a/libavutil/xga_font_data.h
+++ b/libavutil/xga_font_data.h
@@ -29,7 +29,7 @@ 
 #include <stdint.h>
 #include "internal.h"
 
-extern av_export const uint8_t avpriv_cga_font[2048];
-extern av_export const uint8_t avpriv_vga16_font[4096];
+const uint8_t* avpriv_get_cga_font(void);
+const uint8_t* avpriv_get_vga16_font(void);
 
 #endif /* AVUTIL_XGA_FONT_DATA_H */