[FFmpeg-devel] [PATCH 02/19] swscale: rename SwsContext to SwsInternal

Michael Niedermayer michael at niedermayer.cc
Sun Oct 13 20:31:05 EEST 2024


On Fri, Oct 11, 2024 at 12:26:49AM +0200, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> And preserve the public SwsContext as separate name. The motivation here
> is that I want to turn SwsContext into a public struct, while keeping the
> internal implementation hidden. Additionally, I also want to be able to
> use multiple internal implementations, e.g. for GPU devices.
> 
> This commit does not include any functional changes. For the most part, it is
> a simple rename. The only complications arise from the public facing API
> functions, which preserve their current type (and hence require an additional
> unwrapping step internally), and the checkasm test framework, which directly
> accesses SwsInternal.
> 
> For consistency, the affected functions that need to maintain a distionction
> have generally been changed to refer to the SwsContext as *sws, and the
> SwsInternal as *c.
> 
> In an upcoming commit, I will provide a backing definition for the public
> SwsContext, and update `sws_internal()` to dereference the internal struct
> instead of merely casting it.
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas <git at haasn.dev>

breaks build on mingw64

CC	libswscale/x86/w64xmmtest.o
In file included from src/libswscale/x86/w64xmmtest.c:22:
src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      |                       ^~~~~~~~~~~
src/libavutil/x86/w64xmmtest.h:74:16: note: in definition of macro ‘wrap’
   74 | int __real_ ## func;    \
      |                ^~~~
src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      |                       ^~~~~~~~~~~
src/libavutil/x86/w64xmmtest.h:75:16: note: in definition of macro ‘wrap’
   75 | int __wrap_ ## func;    \
      |                ^~~~
src/libswscale/x86/w64xmmtest.c:25:23: warning: ‘struct SwsInternal’ declared inside parameter list will not be visible outside of this definition or declaration
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      |                       ^~~~~~~~~~~
src/libavutil/x86/w64xmmtest.h:76:16: note: in definition of macro ‘wrap’
   76 | int __wrap_ ## func
      |                ^~~~
src/libavutil/x86/w64xmmtest.h:76:5: error: conflicting types for ‘__wrap_sws_scale’
   76 | int __wrap_ ## func
      |     ^~~~~~~
src/libswscale/x86/w64xmmtest.c:25:1: note: in expansion of macro ‘wrap’
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      | ^~~~
src/libavutil/x86/w64xmmtest.h:75:5: note: previous declaration of ‘__wrap_sws_scale’ was here
   75 | int __wrap_ ## func;    \
      |     ^~~~~~~
src/libswscale/x86/w64xmmtest.c:25:1: note: in expansion of macro ‘wrap’
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      | ^~~~
src/libswscale/x86/w64xmmtest.c: In function ‘__wrap_sws_scale’:
src/libswscale/x86/w64xmmtest.c:29:32: warning: passing argument 1 of ‘__real_sws_scale’ from incompatible pointer type [-Wincompatible-pointer-types]
   29 |     testxmmclobbers(sws_scale, c, srcSlice, srcStride, srcSliceY,
      |                                ^
      |                                |
      |                                struct SwsInternal *
src/libavutil/x86/w64xmmtest.h:51:27: note: in definition of macro ‘testxmmclobbers’
   51 |     ret = __real_ ## func(ctx, __VA_ARGS__);                    \
      |                           ^~~
src/libswscale/x86/w64xmmtest.c:25:36: note: expected ‘struct SwsInternal *’ but argument is of type ‘struct SwsInternal *’
   25 | wrap(sws_scale(struct SwsInternal *c, const uint8_t *const srcSlice[],
      |                ~~~~~~~~~~~~~~~~~~~~^
src/libavutil/x86/w64xmmtest.h:74:16: note: in definition of macro ‘wrap’
   74 | int __real_ ## func;    \
      |                ^~~~
make: *** [ffbuild/common.mak:81: libswscale/x86/w64xmmtest.o] Error 1
make: Target 'all' not remade because of errors.

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241013/ab608cbc/attachment.sig>


More information about the ffmpeg-devel mailing list