[vlc-devel] [PATCH] contrib: crystalhd: fix forward declaration of a struct
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 12 07:06:52 CEST 2019
Clang doesn't like it and warns about setting the callback using this signature.
---
contrib/src/crystalhd/callback_proto.patch | 162 +++++++++++++++++++++
contrib/src/crystalhd/rules.mak | 14 +-
modules/codec/crystalhd.c | 7 +-
3 files changed, 178 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..0b90218087
--- /dev/null
+++ b/contrib/src/crystalhd/callback_proto.patch
@@ -0,0 +1,162 @@
+--- 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
+@@ -4,7 +4,7 @@
+ * Name: bc_dts_defs.h
+ *
+ * Description: Common definitions for all components. Only types is allowed
+- * to be included from this file.
++ * to be included from this file.
+ *
+ *******************************************************************/
+ /********************************************************************
+@@ -19,7 +19,7 @@
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this header. If not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************/
+-
++
+ #ifndef _BC_DTS_DEFS_H_
+ #define _BC_DTS_DEFS_H_
+
+@@ -43,7 +43,7 @@ typedef enum _BC_STATUS{
+ BC_STS_FW_CMD_ERR = 11,
+ BC_STS_DEC_NOT_OPEN = 12,
+ BC_STS_ERR_USAGE = 13,
+- BC_STS_IO_USER_ABORT= 14,
++ BC_STS_IO_USER_ABORT= 14,
+ BC_STS_IO_XFR_ERROR = 15,
+ BC_STS_DEC_NOT_STARTED = 16,
+ BC_STS_FWHEX_NOT_FOUND = 17,
+@@ -68,7 +68,7 @@ typedef enum _BC_STATUS{
+ #define BC_REG_KEY_SEC_OPT "DbgOptions"
+ /*
+ * Options:
+- *
++ *
+ * b[5] = Enable RSA KEY in EEPROM Support
+ * b[6] = Enable Old PIB scheme. ( 0 = Use PIB with video scheme)
+ *
+@@ -329,7 +329,7 @@ enum
+ vdecRESOLUTION_480i = 0x00000001, // 480i
+ vdecRESOLUTION_1080i = 0x00000002, // 1080i (1920x1080, 60i)
+ vdecRESOLUTION_NTSC = 0x00000003, // NTSC (720x483, 60i)
+- vdecRESOLUTION_480p = 0x00000004, // 480p (720x480, 60p)
++ vdecRESOLUTION_480p = 0x00000004, // 480p (720x480, 60p)
+ vdecRESOLUTION_720p = 0x00000005, // 720p (1280x720, 60p)
+ vdecRESOLUTION_PAL1 = 0x00000006, // PAL_1 (720x576, 50i)
+ vdecRESOLUTION_1080i25 = 0x00000007, // 1080i25 (1920x1080, 50i)
+@@ -348,7 +348,7 @@ enum
+ vdecRESOLUTION_1080p30 = 0x00000014, // 1080p30 (1920x1080, 30p)
+ vdecRESOLUTION_1080p24 = 0x00000015, // 1080p24 (1920x1080, 24p)
+ vdecRESOLUTION_1080p25 = 0x00000016, // 1080p25 (1920x1080, 25p)
+- vdecRESOLUTION_720p24 = 0x00000017, // 720p24 (1280x720, 25p)
++ vdecRESOLUTION_720p24 = 0x00000017, // 720p24 (1280x720, 25p)
+ vdecRESOLUTION_720p29_97 = 0x00000018, // 720p29.97 (1280x720, 29.97p)
+ vdecRESOLUTION_480p23_976 = 0x00000019, // 480p23.976 (720*480, 23.976)
+ vdecRESOLUTION_480p29_97 = 0x0000001A, // 480p29.976 (720*480, 29.97p)
+@@ -388,10 +388,10 @@ typedef struct _BC_PIC_INFO_BLOCK {
+ U32 width; /* pixels */
+ U32 height; /* pixels */
+ U32 chroma_format; /* 0x420, 0x422 or 0x444 */
+- U32 pulldown;
+- U32 flags;
+- U32 frame_rate;
+- U32 aspect_ratio;
++ U32 pulldown;
++ U32 flags;
++ U32 frame_rate;
++ U32 aspect_ratio;
+ U32 colour_primaries;
+ U32 picture_meta_payload;
+ U32 sess_num;
+@@ -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 */
+@@ -459,7 +461,7 @@ typedef struct _BC_DTS_PROC_OUT{
+ U32 UVBuffDoneSz; /* Transferred UV data size */
+
+ U32 StrideSz; /* Caller supplied Stride Size */
+- U32 PoutFlags; /* Call IN Flags */
++ U32 PoutFlags; /* Call IN Flags */
+
+ U32 discCnt; /* Picture discontinuity count */
+
+@@ -478,7 +480,7 @@ typedef struct _BC_DTS_PROC_OUT{
+ U8 bRevertScramble;
+ U32 StrideSzUV; /* Caller supplied Stride Size for UV data */
+
+-}BC_DTS_PROC_OUT;
++};
+
+ typedef struct _BC_DTS_STATUS {
+ U8 ReadyListCount; /* Number of frames in ready list (reported by driver) */
+@@ -500,8 +502,8 @@ typedef struct _BC_DTS_STATUS {
+ U32 PIBMissCount; /* Amount of times a PIB is invalid. (reported by DIL) */
+
+ U32 cpbEmptySize; /* Report size of CPB buffer available. Reported by DIL */
+- U64 NextTimeStamp; /* TimeStamp of the next picture that will be returned by
+- a call to ProcOutput. Added for Adobe.
++ U64 NextTimeStamp; /* TimeStamp of the next picture that will be returned by
++ a call to ProcOutput. Added for Adobe.
+ Reported back from the driver */
+ U8 TxBufData;
+
+@@ -568,11 +570,11 @@ typedef struct _BC_SCALING_PARAMS_{
+ typedef enum _BC_MEDIA_SUBTYPE_{
+ BC_MSUBTYPE_INVALID = 0,
+ BC_MSUBTYPE_MPEG1VIDEO,
+- BC_MSUBTYPE_MPEG2VIDEO,
+- BC_MSUBTYPE_H264,
+- BC_MSUBTYPE_WVC1,
+- BC_MSUBTYPE_WMV3,
+- BC_MSUBTYPE_AVC1,
++ BC_MSUBTYPE_MPEG2VIDEO,
++ BC_MSUBTYPE_H264,
++ BC_MSUBTYPE_WVC1,
++ BC_MSUBTYPE_WMV3,
++ BC_MSUBTYPE_AVC1,
+ BC_MSUBTYPE_WMVA,
+ BC_MSUBTYPE_VC1,
+ BC_MSUBTYPE_DIVX,
+@@ -585,20 +587,20 @@ typedef struct _BC_INPUT_FORMAT_
+ BOOL FGTEnable; /*Enable processing of FGT SEI*/
+ BOOL MetaDataEnable; /*Enable retrieval of picture metadata to be sent to video pipeline.*/
+ BOOL Progressive; /* Deprecated and not used */
+- U32 OptFlags; /*In this field bits 0:3 are used pass default frame rate, bits 4:5 are for operation mode
+- (used to indicate Blu-ray mode to the decoder) and bit 6 is for the flag mpcOutPutMaxFRate
+- which when set tells the FW to output at the max rate for the resolution and ignore the
+- frame rate determined from the stream. Bit 7 is set to indicate that this is Adobe mode
++ U32 OptFlags; /*In this field bits 0:3 are used pass default frame rate, bits 4:5 are for operation mode
++ (used to indicate Blu-ray mode to the decoder) and bit 6 is for the flag mpcOutPutMaxFRate
++ which when set tells the FW to output at the max rate for the resolution and ignore the
++ frame rate determined from the stream. Bit 7 is set to indicate that this is Adobe mode
+ and the driver will be peeked to get timestamps ahead of time. Bit 8 is used to enable Gaikai Mode */
+ // NAREN - FIXME - WE SHOULD MAKE THIS ENUMS
+ BC_MEDIA_SUBTYPE mSubtype; /* Video Media Type*/
+- U32 width;
++ U32 width;
+ U32 height;
+ U32 startCodeSz; /*Start code size for H264 clips*/
+ U8 *pMetaData; /*Metadata buffer that is used to pass sequence header*/
+ U32 metaDataSz; /*Metadata size*/
+ U8 bEnableScaling;
+-}BC_INPUT_FORMAT;
++}BC_INPUT_FORMAT;
+
+
+ typedef struct _BC_INFO_CRYSTAL_{
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