[vlc-devel] [PATCH] contrib: crystalhd: fix forward declaration of a struct

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 12 07:13:05 CEST 2019


Clang doesn't like it and warns about setting the callback using this signature.
---
 contrib/src/crystalhd/callback_proto.patch | 20 ++++++++++++++++++++
 contrib/src/crystalhd/rules.mak            | 14 ++++++++++----
 modules/codec/crystalhd.c                  |  7 ++++++-
 3 files changed, 36 insertions(+), 5 deletions(-)
 create mode 100644 contrib/src/crystalhd/callback_proto.patch

diff --git a/contrib/src/crystalhd/callback_proto.patch b/contrib/src/crystalhd/callback_proto.patch
new file mode 100644
index 0000000000..153b009593
--- /dev/null
+++ b/contrib/src/crystalhd/callback_proto.patch
@@ -0,0 +1,20 @@
+--- libcrystalhd/bc_dts_defs.h.orig	2019-07-12 07:02:21.393012000 +0200
++++ libcrystalhd/bc_dts_defs.h	2019-07-12 07:01:48.787781100 +0200
+@@ -439,6 +439,8 @@ enum DECODER_CAP_FLAGS
+ 	BC_DEC_FLAGS_M4P2		= 0x08,	//MPEG-4 Part 2: Divx, Xvid etc.
+ };
+ 
++typedef struct _BC_DTS_PROC_OUT BC_DTS_PROC_OUT;
++
+ #if defined(__KERNEL__) || defined(__LINUX_USER__)
+ typedef BC_STATUS (*dts_pout_callback)(void  *shnd, U32	width,U32 height, U32 stride, void *pOut);
+ #else
+@@ -449,7 +451,7 @@ typedef BC_STATUS (*dts_pout_callback)(v
+ //User Data
+ #define MAX_UD_SIZE		1792	//1920 - 128
+ 
+-typedef struct _BC_DTS_PROC_OUT{
++struct _BC_DTS_PROC_OUT{
+ 	U8		*Ybuff;			/* Caller Supplied buffer for Y data */
+ 	U32		YbuffSz;		/* Caller Supplied Y buffer size */
+ 	U32		YBuffDoneSz;	/* Transferred Y datasize */
diff --git a/contrib/src/crystalhd/rules.mak b/contrib/src/crystalhd/rules.mak
index a697ac85ae..0227dfe34d 100644
--- a/contrib/src/crystalhd/rules.mak
+++ b/contrib/src/crystalhd/rules.mak
@@ -13,10 +13,16 @@ CRYSTAL_SOURCES := crystalhd_lgpl_includes_v1.zip
 
 .sum-crystalhd: $(CRYSTAL_SOURCES)
 
-.crystalhd: $(CRYSTAL_SOURCES) .sum-crystalhd
-	mkdir -p -- "$(PREFIX)/include/libcrystalhd"
-	unzip -o $< -d "$(PREFIX)/include/libcrystalhd"
+libcrystalhd: $(CRYSTAL_SOURCES) .sum-crystalhd
+	$(RM) -R $(UNPACK_DIR) && unzip -o $< -d $(UNPACK_DIR)
+	chmod -R u+w $(UNPACK_DIR)
+	$(APPLY) $(SRC)/crystalhd/callback_proto.patch
 ifdef HAVE_WIN32 # we want dlopening on win32
-	rm -rf $(PREFIX)/include/libcrystalhd/bc_drv_if.h
+	rm -rf $(UNPACK_DIR)/bc_drv_if.h
 endif
+	$(MOVE)
+
+.crystalhd: libcrystalhd
+	rm -Rf "$(PREFIX)/include/libcrystalhd"
+	cp -R $< "$(PREFIX)/include"
 	touch $@
diff --git a/modules/codec/crystalhd.c b/modules/codec/crystalhd.c
index 98526e175c..691d37c5f2 100644
--- a/modules/codec/crystalhd.c
+++ b/modules/codec/crystalhd.c
@@ -387,14 +387,19 @@ error:
     free( p_sys );
 }
 
+#if defined(__KERNEL__) || defined(__LINUX_USER__)
 static BC_STATUS ourCallback(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut)
 {
+    BC_DTS_PROC_OUT *proc_in  = (BC_DTS_PROC_OUT*)pOut;
+#else
+static BC_STATUS ourCallback(void *shnd, uint32_t width, uint32_t height, uint32_t stride, BC_DTS_PROC_OUT *proc_in)
+{
+#endif
     VLC_UNUSED(width); VLC_UNUSED(height); VLC_UNUSED(stride);
 
     decoder_t *p_dec          = (decoder_t *)shnd;
     decoder_sys_t *p_sys      = p_dec->p_sys;
     BC_DTS_PROC_OUT *proc_out = p_sys->proc_out;
-    BC_DTS_PROC_OUT *proc_in  = (BC_DTS_PROC_OUT*)pOut;
 
     /* Direct Rendering */
     /* Do not allocate for the second-field in the pair, in interlaced */
-- 
2.17.1



More information about the vlc-devel mailing list