Thanks and improvements...

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
carlaix
New Cone
New Cone
Posts: 2
Joined: 07 Jan 2006 23:14
Location: Italy

Thanks and improvements...

Postby carlaix » 07 Jan 2006 23:27

Hello,
I searched for long time a good free DVD player.
Now my research is finished, thanks to VLC.
It's a really impressive work, it plays lot of media, not only DVDs, great job!

I wrote here not only for writing "thank you" to the authors.
I downloaded some sources and I think I did some improvements to libdvdread.
So, I'm posting my changes here.
If libdvdcss is statically compiled to libdvdread, in my opinion there is no need to call dvdcss_* throught the wrapper functions.
I hope that the attached patch file could be useful.

Sincerely,

Carlo Bramini






diff -urN libdvdread-20041028/dvdread/bswap.h libdvdread-20060107/dvdread/bswap.h
--- libdvdread-20041028/dvdread/bswap.h Wed Jun 18 13:35:04 2003
+++ libdvdread-20060107/dvdread/bswap.h Sat Jan 7 20:53:26 2006
@@ -84,6 +84,18 @@
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
+
+#ifdef __GNUC__
+#define B2N_64(x) \
+ x = ((((x) & 0xff00000000000000LL) >> 56) | \
+ (((x) & 0x00ff000000000000LL) >> 40) | \
+ (((x) & 0x0000ff0000000000LL) >> 24) | \
+ (((x) & 0x000000ff00000000LL) >> 8) | \
+ (((x) & 0x00000000ff000000LL) << 8) | \
+ (((x) & 0x0000000000ff0000LL) << 24) | \
+ (((x) & 0x000000000000ff00LL) << 40) | \
+ (((x) & 0x00000000000000ffLL) << 56))
+#else
#define B2N_64(x) \
x = ((((x) & 0xff00000000000000) >> 56) | \
(((x) & 0x00ff000000000000) >> 40) | \
@@ -93,6 +105,7 @@
(((x) & 0x0000000000ff0000) << 24) | \
(((x) & 0x000000000000ff00) << 40) | \
(((x) & 0x00000000000000ff) << 56))
+#endif

#else

diff -urN libdvdread-20041028/dvdread/cmd_print.c libdvdread-20060107/dvdread/cmd_print.c
--- libdvdread-20041028/dvdread/cmd_print.c Wed Jun 18 13:00:44 2003
+++ libdvdread-20060107/dvdread/cmd_print.c Sat Jan 7 20:38:08 2006
@@ -19,6 +19,7 @@
#include "config.h"

#include <stdio.h>
+#include <ctype.h>

#if defined(HAVE_INTTYPES_H)
#include <inttypes.h>
diff -urN libdvdread-20041028/dvdread/dvd_input.c libdvdread-20060107/dvdread/dvd_input.c
--- libdvdread-20041028/dvdread/dvd_input.c Thu Oct 28 14:09:02 2004
+++ libdvdread-20060107/dvdread/dvd_input.c Sat Jan 7 20:41:16 2006
@@ -27,6 +27,11 @@
#include "dvd_reader.h"
#include "dvd_input.h"

+#ifndef HAVE_DVDCSS_DVDCSS_H
+
+/* dlopening libdvdcss */
+#include <dlfcn.h>
+
/* The function pointers that is the exported interface of this file. */
dvd_input_t (*dvdinput_open) (const char *);
int (*dvdinput_close) (dvd_input_t);
@@ -35,18 +40,6 @@
int (*dvdinput_read) (dvd_input_t, void *, int, int);
char * (*dvdinput_error) (dvd_input_t);

-#ifdef HAVE_DVDCSS_DVDCSS_H
-/* linking to libdvdcss */
-#include <dvdcss/dvdcss.h>
-#define DVDcss_open(a) dvdcss_open((char*)(a))
-#define DVDcss_close dvdcss_close
-#define DVDcss_seek dvdcss_seek
-#define DVDcss_title dvdcss_title
-#define DVDcss_read dvdcss_read
-#define DVDcss_error dvdcss_error
-#else
-/* dlopening libdvdcss */
-#include <dlfcn.h>
typedef struct dvdcss_s *dvdcss_handle;
static dvdcss_handle (*DVDcss_open) (const char *);
static int (*DVDcss_close) (dvdcss_handle);
@@ -54,7 +47,6 @@
static int (*DVDcss_title) (dvdcss_handle, int);
static int (*DVDcss_read) (dvdcss_handle, void *, int, int);
static char * (*DVDcss_error) (dvdcss_handle);
-#endif

/* The DVDinput handle, add stuff here for new input methods. */
struct dvd_input_s {
@@ -260,23 +252,22 @@

return 0;
}
-
+#endif

/**
* Setup read functions with either libdvdcss or minimal DVD access.
*/
int dvdinput_setup(void)
{
- void *dvdcss_library = NULL;
- char **dvdcss_version = NULL;
-
#ifdef HAVE_DVDCSS_DVDCSS_H
/* linking to libdvdcss */
- dvdcss_library = &dvdcss_library; /* Give it some value != NULL */
- /* the DVDcss_* functions have been #defined at the top */
- dvdcss_version = &dvdcss_interface_2;
-
+ fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
+ dvdcss_interface_2);
+ return 1;
#else
+ void *dvdcss_library = NULL;
+ char **dvdcss_version = NULL;
+
/* dlopening libdvdcss */
dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY);

@@ -315,7 +306,6 @@
dlclose(dvdcss_library);
}
}
-#endif /* HAVE_DVDCSS_DVDCSS_H */

if(dvdcss_library != NULL) {
/*
@@ -348,4 +338,5 @@
dvdinput_error = file_error;
return 0;
}
+#endif /* HAVE_DVDCSS_DVDCSS_H */
}
diff -urN libdvdread-20041028/dvdread/dvd_input.h libdvdread-20060107/dvdread/dvd_input.h
--- libdvdread-20041028/dvdread/dvd_input.h Thu Feb 13 22:06:56 2003
+++ libdvdread-20060107/dvdread/dvd_input.h Sat Jan 7 20:27:42 2006
@@ -27,6 +27,21 @@

#define DVDINPUT_READ_DECRYPT (1 << 0)

+#ifdef HAVE_DVDCSS_DVDCSS_H
+
+/* linking to libdvdcss */
+#include <dvdcss/dvdcss.h>
+
+#define dvd_input_t dvdcss_t
+
+#define dvdinput_open(_a) dvdcss_open(_a)
+#define dvdinput_close(_a) dvdcss_close(_a)
+#define dvdinput_seek(_a, _b) dvdcss_seek(_a,_b,DVDINPUT_NOFLAGS)
+#define dvdinput_title(_a, _b) dvdcss_title(_a,_b)
+#define dvdinput_read(_a,_b,_c,_d) dvdcss_read(_a,_b,_c,_d)
+#define dvdinput_error(_a) dvdcss_error(_a)
+
+#else
typedef struct dvd_input_s *dvd_input_t;

/**
@@ -38,6 +53,7 @@
extern int (*dvdinput_title) (dvd_input_t, int);
extern int (*dvdinput_read) (dvd_input_t, void *, int, int);
extern char * (*dvdinput_error) (dvd_input_t);
+#endif

/**
* Setup function accessed by dvd_reader.c. Returns 1 if there is CSS support.
diff -urN libdvdread-20041028/dvdread/dvd_reader.c libdvdread-20060107/dvdread/dvd_reader.c
--- libdvdread-20041028/dvdread/dvd_reader.c Tue Aug 5 12:44:12 2003
+++ libdvdread-20060107/dvdread/dvd_reader.c Sat Jan 7 20:45:36 2006
@@ -1031,7 +1031,7 @@
bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
if( bytes_read != file_size ) {
fprintf( stderr, "libdvdread: DVDDiscId read returned %d bytes"
- ", wanted %d\n", bytes_read, file_size );
+ ", wanted %d\n", (int)bytes_read, file_size );
DVDCloseFile( dvd_file );
return -1;
}

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 09 Jan 2006 22:01

Hello, i just forwarded your patch to libdvdread developers. Thanks for the help.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 23 guests