diff mbox series

[FFmpeg-devel] avcodec/tableprint_vlc: Fix building with hardcoded tables

Message ID AM7PR03MB66607D271CD9E23F9E48B89C8FE49@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 5be809fed905cc8aebaa20a10548a8341f3d6425
Headers show
Series [FFmpeg-devel] avcodec/tableprint_vlc: Fix building with hardcoded tables
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 22, 2021, 11:38 p.m. UTC
This has been broken in 25c8507818d8559a6654a5b30a0f8aae11a48181,
because the hacks for headers that are incompatible with building
for the host in libavcodec/tableprint_vlc.h have not been adjusted.

Moving AV_INPUT_BUFFER_PADDING_SIZE to defs.h which is valid for
both the target as well as the host allowed to remove some of the hacks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
If we did not have monster headers (with lavu/internal.h forcing one to
include libm.h if all one wants is ff_dlog and avpriv_request_sample()),
one could include the headers normally; but one would still need to
define both of them away, as the underlying functions are not available
for the host.
In particular, mem.h could be ridden of the avutil.h dependency to allow
it to be included (albeit with the allocation functions overriden).

 libavcodec/tableprint_vlc.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

James Almer July 23, 2021, 12:36 p.m. UTC | #1
On 7/22/2021 8:38 PM, Andreas Rheinhardt wrote:
> This has been broken in 25c8507818d8559a6654a5b30a0f8aae11a48181,
> because the hacks for headers that are incompatible with building
> for the host in libavcodec/tableprint_vlc.h have not been adjusted.
> 
> Moving AV_INPUT_BUFFER_PADDING_SIZE to defs.h which is valid for
> both the target as well as the host allowed to remove some of the hacks.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> If we did not have monster headers (with lavu/internal.h forcing one to
> include libm.h if all one wants is ff_dlog and avpriv_request_sample()),
> one could include the headers normally; but one would still need to
> define both of them away, as the underlying functions are not available
> for the host.
> In particular, mem.h could be ridden of the avutil.h dependency to allow
> it to be included (albeit with the allocation functions overriden).
> 
>   libavcodec/tableprint_vlc.h | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libavcodec/tableprint_vlc.h b/libavcodec/tableprint_vlc.h
> index b3ff36562b..0cbd7a9d2b 100644
> --- a/libavcodec/tableprint_vlc.h
> +++ b/libavcodec/tableprint_vlc.h
> @@ -33,9 +33,7 @@
>   #define av_realloc_f(p, o, n) NULL
>   #define av_free(p) while(0)
>   #define av_freep(p) while(0)
> -#define AVCODEC_AVCODEC_H
> -#define AVCODEC_INTERNAL_H
> -#define AV_INPUT_BUFFER_PADDING_SIZE 64 // the value does not matter for this
> +#define AVUTIL_INTERNAL_H
>   #define avpriv_request_sample(...)
>   #include "tableprint.h"
>   #include "get_bits.h"
> 

Should be ok.
diff mbox series

Patch

diff --git a/libavcodec/tableprint_vlc.h b/libavcodec/tableprint_vlc.h
index b3ff36562b..0cbd7a9d2b 100644
--- a/libavcodec/tableprint_vlc.h
+++ b/libavcodec/tableprint_vlc.h
@@ -33,9 +33,7 @@ 
 #define av_realloc_f(p, o, n) NULL
 #define av_free(p) while(0)
 #define av_freep(p) while(0)
-#define AVCODEC_AVCODEC_H
-#define AVCODEC_INTERNAL_H
-#define AV_INPUT_BUFFER_PADDING_SIZE 64 // the value does not matter for this
+#define AVUTIL_INTERNAL_H
 #define avpriv_request_sample(...)
 #include "tableprint.h"
 #include "get_bits.h"