[libdvdcss-devel] [Git][videolan/libdvdcss][master] Fix build on FreeBSD

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Nov 15 16:15:11 UTC 2025



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdcss


Commits:
0e1e8f38 by Ganael Laplanche at 2025-11-15T14:36:52+01:00
Fix build on FreeBSD

- Check for and use cam/scsi/scsi_sg.h
- Avoid redefining ioctls already defined in sys/dvdio.h

- - - - -


3 changed files:

- meson.build
- src/ioctl.c
- src/ioctl.h


Changes:

=====================================
meson.build
=====================================
@@ -46,6 +46,7 @@ check_headers = [
     'io.h',
     'pwd.h',
     'scsi/sg.h',
+    'cam/scsi/scsi_sg.h',
     'sys/ioctl.h',
     'sys/param.h',
     'sys/stat.h',


=====================================
src/ioctl.c
=====================================
@@ -65,6 +65,10 @@
 #   include <scsi/sg.h>
 #   include <stdlib.h>
 #endif
+#ifdef HAVE_CAM_SCSI_SCSI_SG_H
+#   include <cam/scsi/scsi_sg.h>
+#   include <stdlib.h>
+#endif
 #ifdef DVD_STRUCT_IN_DVD_H
 #   include <dvd.h>
 #endif
@@ -1002,7 +1006,7 @@ int ioctl_ReadCPRMMediaId(int i_fd,int *p_agid, uint8_t *p_buffer)
 {  
     int i_ret;
 
-#if defined( HAVE_LINUX_DVD_STRUCT ) && defined( HAVE_SCSI_SG_H )
+#if (defined( HAVE_LINUX_DVD_STRUCT ) && defined( HAVE_SCSI_SG_H )) || (defined( HAVE_BSD_DVD_STRUCT ) && defined( HAVE_CAM_SCSI_SCSI_SG_H ))
     struct sg_io_hdr io_hdr;
     uint8_t sense[32] = {0};  
     uint8_t cdb[12] = {0};
@@ -1091,7 +1095,7 @@ int ioctl_ReadCPRMMKBPack(int i_fd, int *p_agid, int mkb_pack, uint8_t *p_mkb_pa
 {
     int i_ret;
 
-#if defined( HAVE_LINUX_DVD_STRUCT ) && defined( HAVE_SCSI_SG_H )
+#if (defined( HAVE_LINUX_DVD_STRUCT ) && defined( HAVE_SCSI_SG_H )) || (defined( HAVE_BSD_DVD_STRUCT ) && defined( HAVE_CAM_SCSI_SCSI_SG_H ))
     uint8_t *sptd_buf = malloc( CPRM_MKB_PACK_SIZE + 4 );
     uint8_t cdb[12] = { 0 };
     uint8_t sense[32] = { 0 };


=====================================
src/ioctl.h
=====================================
@@ -106,6 +106,7 @@ typedef union dvd_authinfo dvd_authinfo;
 #define GPCMD_READ_DVD_STRUCTURE 0xad
 #define GPCMD_REPORT_KEY         0xa4
 #define GPCMD_SEND_KEY           0xa3
+#ifndef DVD_STRUCT_IN_SYS_DVDIO_H
  /* DVD struct types */
 #define DVD_STRUCT_PHYSICAL      0x00
 #define DVD_STRUCT_COPYRIGHT     0x01
@@ -122,6 +123,7 @@ typedef union dvd_authinfo dvd_authinfo;
 #define DVD_REPORT_ASF           0x05
 #define DVD_SEND_RPC             0x06
 #define DVD_REPORT_RPC           0x08
+#endif /* ndef DVD_STRUCT_IN_SYS_DVDIO_H */
 #define DVDCSS_INVALIDATE_AGID   0x3f
 
 /*****************************************************************************



View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/0e1e8f38b9062010ece674187fa63e1bf9c86f07

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/0e1e8f38b9062010ece674187fa63e1bf9c86f07
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdcss-devel mailing list