Commit b08376be authored by Stéphane Borel's avatar Stéphane Borel

*Merged hh patch in libdvdcss from main tree.

*Updated local libdvdread, so that it does not depend on libdvdcss
(ala dummy_dvdcss) and modified configure to reflect changes.
parent b7ee1eea
This diff is collapsed.
...@@ -767,6 +767,7 @@ AC_ARG_WITH(dvdcss, ...@@ -767,6 +767,7 @@ AC_ARG_WITH(dvdcss,
CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}"
fi fi
;; ;;
...@@ -779,6 +780,7 @@ AC_ARG_WITH(dvdcss, ...@@ -779,6 +780,7 @@ AC_ARG_WITH(dvdcss,
CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
LIB_DVD="${LIB_DVD} -Llib -ldvdcss" LIB_DVD="${LIB_DVD} -Llib -ldvdcss"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -L../../lib -ldvdcss" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -L../../lib -ldvdcss"
LIB_DVDREAD="${LIB_DVD} -Llib -ldvdread -ldvdcss"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -L../../lib -ldvdcss" LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -L../../lib -ldvdcss"
fi fi
;; ;;
...@@ -791,6 +793,7 @@ AC_ARG_WITH(dvdcss, ...@@ -791,6 +793,7 @@ AC_ARG_WITH(dvdcss,
CFLAGS_DVD="${CFLAGS_DVD} -DLIBDVDCSS_VERSION=\"${LIBDVDCSS_VERSION}\"" CFLAGS_DVD="${CFLAGS_DVD} -DLIBDVDCSS_VERSION=\"${LIBDVDCSS_VERSION}\""
LIB_DVD="${LIB_DVD} -ldl" LIB_DVD="${LIB_DVD} -ldl"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a -ldl"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldl" LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldl"
;; ;;
*) *)
...@@ -804,7 +807,8 @@ AC_ARG_WITH(dvdcss, ...@@ -804,7 +807,8 @@ AC_ARG_WITH(dvdcss,
fi fi
LIB_DVD="${LIB_DVD} -ldvdcss" LIB_DVD="${LIB_DVD} -ldvdcss"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldvdcss" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldvdcss"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldvdcss" LIB_DVDREAD="${LIB_DVDREAD} -ldvdread -ldvdcss"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldvdread -ldvdcss"
esac ], esac ],
# user didn't decide, we choose to use local libdvdcss and link statically # user didn't decide, we choose to use local libdvdcss and link statically
# if libdvdcss is in the archive, or to use the dummy replacement otherwise. # if libdvdcss is in the archive, or to use the dummy replacement otherwise.
...@@ -816,7 +820,8 @@ AC_ARG_WITH(dvdcss, ...@@ -816,7 +820,8 @@ AC_ARG_WITH(dvdcss,
CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss" CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}" LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a ${LIB_LIBDVDCSS}"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} ../../lib/libdvdread.a ../../lib/libdvdcss.a ${LIB_LIBDVDCSS}"
else else
# XXX: no check for libdl is done, don't try this at home ! # XXX: no check for libdl is done, don't try this at home !
DUMMY_LIBDVDCSS=1 DUMMY_LIBDVDCSS=1
...@@ -825,6 +830,7 @@ AC_ARG_WITH(dvdcss, ...@@ -825,6 +830,7 @@ AC_ARG_WITH(dvdcss,
CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA" CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
LIB_DVD="${LIB_DVD} -ldl" LIB_DVD="${LIB_DVD} -ldl"
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a -ldl"
LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldl" LIB_DVDREAD_PLUGIN="${LIB_DVDREAD_PLUGIN} -ldl"
fi ]) fi ])
...@@ -835,11 +841,8 @@ AC_ARG_ENABLE(dvdread, ...@@ -835,11 +841,8 @@ AC_ARG_ENABLE(dvdread,
[ --enable-dvdread Enable dvdread support (default disabled)], [ --enable-dvdread Enable dvdread support (default disabled)],
[ if test x$enableval = xyes [ if test x$enableval = xyes
then then
NEED_LIBDVDCSS=1
STATIC_LIBDVDCSS=1
BUILTINS="${BUILTINS} dvdread" BUILTINS="${BUILTINS} dvdread"
CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread" CFLAGS_DVDREAD="${CFLAGS_DVD} ${CFLAGS_DVDREAD} -I../../extras/libdvdread"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a"
fi ]) fi ])
dnl dnl
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* css.h: Structures for DVD authentification and unscrambling * css.h: Structures for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: css.h,v 1.7 2002/01/14 22:06:57 stef Exp $ * $Id: css.h,v 1.8 2002/01/23 03:15:31 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -30,16 +30,6 @@ ...@@ -30,16 +30,6 @@
typedef u8 dvd_key_t[KEY_SIZE]; typedef u8 dvd_key_t[KEY_SIZE];
typedef struct disc_s
{
u8 p_challenge[2*KEY_SIZE];
dvd_key_t p_key1;
dvd_key_t p_key2;
dvd_key_t p_key_check;
u8 i_varient;
u8 p_disc_key[2048];
} disc_t;
typedef struct dvd_title_s typedef struct dvd_title_s
{ {
int i_startlb; int i_startlb;
...@@ -49,10 +39,11 @@ typedef struct dvd_title_s ...@@ -49,10 +39,11 @@ typedef struct dvd_title_s
typedef struct css_s typedef struct css_s
{ {
int i_agid; int i_agid; /* Current Authenication Grant ID. */
disc_t disc; dvd_key_t p_bus_key; /* Current session key. */
dvd_key_t p_unenc_key; /* title key before decryption */ dvd_key_t p_disc_key; /* This DVD disc's key. */
dvd_key_t p_title_key; /* title key after decryption */ dvd_key_t p_unenc_key; /* Current title key before decryption. */
dvd_key_t p_title_key; /* Current title key. */
} css_t; } css_t;
/***************************************************************************** /*****************************************************************************
...@@ -61,7 +52,6 @@ typedef struct css_s ...@@ -61,7 +52,6 @@ typedef struct css_s
struct css_s; struct css_s;
int CSSTest ( dvdcss_handle ); int CSSTest ( dvdcss_handle );
int CSSAuth ( dvdcss_handle );
int CSSGetDiscKey ( dvdcss_handle ); int CSSGetDiscKey ( dvdcss_handle );
int CSSGetTitleKey ( dvdcss_handle, int ); int CSSGetTitleKey ( dvdcss_handle, int );
int CSSDescrambleSector ( u8 * , u8 * ); int CSSDescrambleSector ( u8 * , u8 * );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libdvdcss.c: DVD reading library. * libdvdcss.c: DVD reading library.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: libdvdcss.c,v 1.29 2002/01/21 07:00:21 gbazin Exp $ * $Id: libdvdcss.c,v 1.30 2002/01/23 03:15:31 stef Exp $
* *
* Authors: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -191,7 +191,6 @@ extern dvdcss_handle dvdcss_open ( char *psz_target ) ...@@ -191,7 +191,6 @@ extern dvdcss_handle dvdcss_open ( char *psz_target )
dvdcss->i_method = DVDCSS_METHOD_TITLE; dvdcss->i_method = DVDCSS_METHOD_TITLE;
dvdcss->b_ioctls = 0; dvdcss->b_ioctls = 0;
dvdcss->b_encrypted = 1; dvdcss->b_encrypted = 1;
memset( &dvdcss->css.disc, 0, sizeof(dvdcss->css.disc) );
} }
/* If disc is CSS protected and the ioctls work, authenticate the drive */ /* If disc is CSS protected and the ioctls work, authenticate the drive */
...@@ -208,6 +207,7 @@ extern dvdcss_handle dvdcss_open ( char *psz_target ) ...@@ -208,6 +207,7 @@ extern dvdcss_handle dvdcss_open ( char *psz_target )
memset( dvdcss->css.p_unenc_key, 0, KEY_SIZE ); memset( dvdcss->css.p_unenc_key, 0, KEY_SIZE );
} }
memset( dvdcss->css.p_title_key, 0, KEY_SIZE );
#ifndef WIN32 #ifndef WIN32
if( psz_raw_device != NULL ) if( psz_raw_device != NULL )
......
...@@ -25,7 +25,7 @@ CFLAGS := -I../../include -I../../extras $(CFLAGS) ...@@ -25,7 +25,7 @@ CFLAGS := -I../../include -I../../extras $(CFLAGS)
# Objects # Objects
# #
OBJ_C = dvdread.o dvd_udf.o nav_print.o nav_read.o ifo_print.o ifo_read.o OBJ_C = dvd_setup.o dvd_reader.o dvd_udf.o nav_print.o nav_read.o ifo_print.o ifo_read.o
ALL_OBJ = $(OBJ_C) $(OBJ_LIBDVDREAD) ALL_OBJ = $(OBJ_C) $(OBJ_LIBDVDREAD)
# #
...@@ -52,7 +52,7 @@ $(C_DEP): %.d: FORCE ...@@ -52,7 +52,7 @@ $(C_DEP): %.d: FORCE
$(OBJ_C): %.o: .dep/%.d $(OBJ_C): %.o: .dep/%.d
$(OBJ_C): %.o: %.c $(OBJ_C): %.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_LIBDVDREAD) $(PCFLAGS) -c -o $@ $< $(CC) $(CFLAGS) $(CFLAGS_DVDREAD) $(CFLAGS_LIBDVDREAD) $(PCFLAGS) -c -o $@ $<
../../lib/$(FULL_SO): $(OBJ_C) $(OBJ_LIBDVDREAD) ../../lib/$(FULL_SO): $(OBJ_C) $(OBJ_LIBDVDREAD)
$(CC) $(PCFLAGS) $(ALL_SOFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_LIBDVDREAD) $(CC) $(PCFLAGS) $(ALL_SOFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_LIBDVDREAD)
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef BSWAP_H_INCLUDED #ifndef BSWAP_H_INCLUDED
#define BSWAP_H_INCLUDED #define BSWAP_H_INCLUDED
#include <defs.h>
#include <config.h> #include <config.h>
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
......
This diff is collapsed.
...@@ -111,6 +111,12 @@ void DVDCloseFile( dvd_file_t *dvd_file ); ...@@ -111,6 +111,12 @@ void DVDCloseFile( dvd_file_t *dvd_file );
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset, ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, unsigned char *data ); size_t block_count, unsigned char *data );
/**
* The same calling a readv-like function to fill a struct iovec.
*/
struct iovec;
ssize_t DVDReadVBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, struct iovec * vector );
/** /**
* Seek to the given position in the file. Returns the resulting position in * Seek to the given position in the file. Returns the resulting position in
* bytes from the beginning of the file. The seek position is only used for * bytes from the beginning of the file. The seek position is only used for
......
/**
* dvd_setup.c: setup read functions with either libdvdcss
* or minimal DVD access.
*/
/**
* Copyright (C) 2001 VideoLAN
* $Id: dvd_setup.c,v 1.1 2002/01/23 03:15:31 stef Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
/**
* Preamble
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <dlfcn.h>
#include <sys/uio.h> /* struct iovec */
#include "dvd_reader.h"
#include "dvd_setup.h"
#ifdef GOD_DAMN_DMCA
/**
* dvd_open: initialize library, open a DVD device.
*/
static dvd_handle dvd_open ( char *psz_target )
{
dvd_handle dev;
/* Allocate the library structure */
dev = malloc( sizeof( dvd_handle ) );
if( dev == NULL )
{
fprintf( stderr, "libdvdread: Could not allocate memory.\n" );
return NULL;
}
/* Open the device */
dev->i_fd = open( psz_target, 0 );
if( dev->i_fd < 0 )
{
fprintf( stderr, "libdvdread: Could not open device.\n" );
free( dev );
return NULL;
}
return dev;
}
/**
* dvd_error: return the last error message
*/
static char * dvd_error ( dvd_handle dev )
{
return "unknown error";
}
/**
* dvd_seek: seek into the device.
*/
static int dvd_seek ( dvd_handle dev, int i_blocks, int i_flags )
{
off_t i_read;
i_read = lseek( dev->i_fd,
(off_t)i_blocks * (off_t)DVD_VIDEO_LB_LEN, SEEK_SET );
return i_read / DVD_VIDEO_LB_LEN;
}
/**
* dvd_title: crack the current title key if needed.
*/
static int dvd_title ( dvd_handle dev, int i_block )
{
return 0;
}
/**
* dvd_read: read data from the device.
*/
static int dvd_read ( dvd_handle dev, void *p_buffer,
int i_blocks,
int i_flags )
{
int i_bytes;
i_bytes = read( dev->i_fd, p_buffer,
(size_t)i_blocks * DVD_VIDEO_LB_LEN );
return i_bytes / DVD_VIDEO_LB_LEN;
}
/**
* dvd_readv: read data to an iovec structure.
*/
static int dvd_readv ( dvd_handle dev, void *p_iovec,
int i_blocks,
int i_flags )
{
int i_read;
i_read = readv( dev->i_fd, (struct iovec*)p_iovec, i_blocks );
return i_read / DVD_VIDEO_LB_LEN;
}
/**
* dvd_close: close the DVD device and clean up the library.
*/
static int dvd_close ( dvd_handle dev )
{
int i_ret;
i_ret = close( dev->i_fd );
if( i_ret < 0 )
{
return i_ret;
}
free( dev );
return 0;
}
void DVDSetupRead( void )
{
void * dvdcss_library = NULL;
if( ( dvdcss_library = dlopen( "libdvdcss.so.1", RTLD_LAZY ) ) )
{
pf_dvd_open = dlsym( dvdcss_library, "dvdcss_open" );
pf_dvd_close = dlsym( dvdcss_library, "dvdcss_close" );
pf_dvd_title = dlsym( dvdcss_library, "dvdcss_title" );
pf_dvd_seek = dlsym( dvdcss_library, "dvdcss_seek" );
pf_dvd_read = dlsym( dvdcss_library, "dvdcss_read" );
pf_dvd_readv = dlsym( dvdcss_library, "dvdcss_readv" );
pf_dvd_error = dlsym( dvdcss_library, "dvdcss_error" );
if( pf_dvd_open == NULL || pf_dvd_close == NULL
|| pf_dvd_title == NULL || pf_dvd_seek == NULL
|| pf_dvd_read == NULL || pf_dvd_readv == NULL
|| pf_dvd_error == NULL )
{
fprintf( stderr, "libdvdread: Missing symbols in libdvdcss.so.1, "
"this shouldn't happen !" );
dlclose( dvdcss_library );
dvdcss_library = NULL;
}
else
{
printf( "libdvdread: Using libdvdcss.so.1 for DVD access\n" );
}
}
else
{
fprintf( stderr, "libdvdread: Can't open libdvdcss.so.1: %s.\n",
dlerror() );
}
if( !dvdcss_library )
{
/* Replacement functions */
pf_dvd_open = dvd_open;
pf_dvd_close = dvd_close;
pf_dvd_title = dvd_title;
pf_dvd_seek = dvd_seek;
pf_dvd_read = dvd_read;
pf_dvd_readv = dvd_readv;
pf_dvd_error = dvd_error;
}
}
#else
void DVDSetupRead( void )
{
pf_dvd_open = dvdcss_open;
pf_dvd_close = dvdcss_close;
pf_dvd_title = dvdcss_title;
pf_dvd_seek = dvdcss_seek;
pf_dvd_read = dvdcss_read;
pf_dvd_readv = dvdcss_readv;
pf_dvd_error = dvdcss_error;
}
#endif
/***************************************************************************** /**
* libdvdcss.h: DVD reading library, exported functions. * dvd_setup.h: setup functions header.
***************************************************************************** */
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvdcss.h,v 1.1 2001/11/25 05:04:38 stef Exp $ /* Copyright (C) 2001 VideoLAN
* $Id: dvd_setup.h,v 1.1 2002/01/23 03:15:31 stef Exp $
* *
* Authors: Stphane Borel <stef@via.ecp.fr> * Authors: Samuel Hocevar <sam@zoy.org>
* Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -20,22 +20,45 @@ ...@@ -20,22 +20,45 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ */
/***************************************************************************** /**
* The libdvdcss structure * The libdvdcss structure.
*****************************************************************************/ */
typedef struct dvdcss_s* dvdcss_handle; struct dvdcss_s
{
/* File descriptor */
int i_fd;
};
/***************************************************************************** #ifdef GOD_DAMN_DMCA
* Flags /**
*****************************************************************************/ * Defines and flags.
#define DVDCSS_NOFLAGS 0 */
# define DVDCSS_NOFLAGS 0
# define DVDCSS_READ_DECRYPT (1 << 0)
# define DVDCSS_SEEK_MPEG (1 << 0)
# define DVDCSS_SEEK_KEY (1 << 1)
#define DVDCSS_INIT_QUIET (1 << 0) #else
#define DVDCSS_INIT_DEBUG (1 << 1) # include <videolan/dvdcss.h>
#endif
#define DVDCSS_READ_DECRYPT (1 << 0) typedef struct dvdcss_s* dvd_handle;
#define DVDCSS_BLOCK_SIZE 2048 /**
* Pointers which will be filled either with dummy functions or
* with the dlopen()ed ones.
*/
dvd_handle (*pf_dvd_open) ( char * );
int (*pf_dvd_close) ( dvd_handle );
int (*pf_dvd_title) ( dvd_handle, int );
int (*pf_dvd_seek) ( dvd_handle, int, int );
int (*pf_dvd_read) ( dvd_handle, void *, int, int );
int (*pf_dvd_readv) ( dvd_handle, void *, int, int );
char * (*pf_dvd_error) ( dvd_handle );
/**
* Setup function accessed by dvd_reader.c
*/
void DVDSetupRead( void );
This diff is collapsed.
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
#ifndef IFO_PRINT_H_INCLUDED #ifndef IFO_PRINT_H_INCLUDED
#define IFO_PRINT_H_INCLUDED #define IFO_PRINT_H_INCLUDED
//#include <dvdread/ifo_types.h> #include <dvdread/ifo_types.h>
//#include <dvdread/dvd_reader.h> #include <dvdread/dvd_reader.h>
#include "ifo_types.h"
#include "dvd_reader.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -20,10 +20,8 @@ ...@@ -20,10 +20,8 @@
#ifndef IFO_READ_H_INCLUDED #ifndef IFO_READ_H_INCLUDED
#define IFO_READ_H_INCLUDED #define IFO_READ_H_INCLUDED
//#include <dvdread/ifo_types.h> #include <dvdread/ifo_types.h>
//#include <dvdread/dvd_reader.h> #include <dvdread/dvd_reader.h>
#include "ifo_types.h"
#include "dvd_reader.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define IFO_TYPES_H_INCLUDED #define IFO_TYPES_H_INCLUDED
#include <inttypes.h> #include <inttypes.h>
//#include <dvdread/dvd_reader.h> #include <dvdread/dvd_reader.h>
#include "dvd_reader.h"
#undef ATTRIBUTE_PACKED #undef ATTRIBUTE_PACKED
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define NAV_PRINT_H_INCLUDED #define NAV_PRINT_H_INCLUDED
#include <stdio.h> #include <stdio.h>
//#include <dvdread/nav_types.h> #include <dvdread/nav_types.h>
#include "nav_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
#ifndef NAV_READ_H_INCLUDED #ifndef NAV_READ_H_INCLUDED
#define NAV_READ_H_INCLUDED #define NAV_READ_H_INCLUDED
//#include <dvdread/nav_types.h> #include <dvdread/nav_types.h>
#include "nav_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#define NAV_TYPES_H_INCLUDED #define NAV_TYPES_H_INCLUDED
#include <inttypes.h> #include <inttypes.h>
//#include <dvdread/ifo_types.h> // only dvd_time_t, vm_cmd_t and user_ops_t #include <dvdread/ifo_types.h> // only dvd_time_t, vm_cmd_t and user_ops_t
#include "ifo_types.h"
#undef ATTRIBUTE_PACKED #undef ATTRIBUTE_PACKED
#undef PRAGMA_PACK_BEGIN #undef PRAGMA_PACK_BEGIN
......
This diff is collapsed.
/*****************************************************************************
* dvdread.h: DVD reading library, exported functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvdread.h,v 1.1 2001/11/25 05:04:38 stef Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
ssize_t DVDReadVBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, struct iovec * vector );
/* include/defs.h.in. Generated automatically from configure.in by autoheader. */ /* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#undef C_ALLOCA #undef C_ALLOCA
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dummy_dvdcss.h: Dummy libdvdcss header. * dummy_dvdcss.h: Dummy libdvdcss header.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: dummy_dvdcss.h,v 1.6 2002/01/07 02:12:29 sam Exp $ * $Id: dummy_dvdcss.h,v 1.7 2002/01/23 03:15:31 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -51,6 +51,14 @@ char * dummy_dvdcss_error ( dvdcss_handle ); ...@@ -51,6 +51,14 @@ char * dummy_dvdcss_error ( dvdcss_handle );
* Pointers which will be filled either with dummy_dvdcss functions or * Pointers which will be filled either with dummy_dvdcss functions or
* with the dlopen()ed ones. * with the dlopen()ed ones.
*****************************************************************************/ *****************************************************************************/
#define ____dvdcss_open dvdcss_open
#define ____dvdcss_close dvdcss_close
#define ____dvdcss_title dvdcss_title
#define ____dvdcss_seek dvdcss_seek
#define ____dvdcss_read dvdcss_read
#define ____dvdcss_readv dvdcss_readv
#define ____dvdcss_error dvdcss_error
dvdcss_handle (* ____dvdcss_open ) ( char * ); dvdcss_handle (* ____dvdcss_open ) ( char * );
int (* ____dvdcss_close ) ( dvdcss_handle ); int (* ____dvdcss_close ) ( dvdcss_handle );
int (* ____dvdcss_title ) ( dvdcss_handle, int ); int (* ____dvdcss_title ) ( dvdcss_handle, int );
...@@ -59,11 +67,4 @@ int (* ____dvdcss_read ) ( dvdcss_handle, void *, int, int ); ...@@ -59,11 +67,4 @@ int (* ____dvdcss_read ) ( dvdcss_handle, void *, int, int );
int (* ____dvdcss_readv ) ( dvdcss_handle, void *, int, int ); int (* ____dvdcss_readv ) ( dvdcss_handle, void *, int, int );
char * (* ____dvdcss_error ) ( dvdcss_handle ); char * (* ____dvdcss_error ) ( dvdcss_handle );
#define ____dvdcss_open dvdcss_open
#define ____dvdcss_close dvdcss_close
#define ____dvdcss_title dvdcss_title
#define ____dvdcss_seek dvdcss_seek
#define ____dvdcss_read dvdcss_read
#define ____dvdcss_readv dvdcss_readv
#define ____dvdcss_error dvdcss_error
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvdread.c : DvdRead input module for vlc * dvdread.c : DvdRead input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: dvdread.c,v 1.7 2002/01/08 23:34:06 stef Exp $ * $Id: dvdread.c,v 1.8 2002/01/23 03:15:31 stef Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -29,25 +29,11 @@ ...@@ -29,25 +29,11 @@
#include <videolan/vlc.h> #include <videolan/vlc.h>
#ifdef GOD_DAMN_DMCA
# include <dlfcn.h>
# include "dummy_dvdcss.h"
#endif
/***************************************************************************** /*****************************************************************************
* Capabilities defined in the other files. * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
void _M( input_getfunctions )( function_list_t * p_function_list ); void _M( input_getfunctions )( function_list_t * p_function_list );
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
#ifdef GOD_DAMN_DMCA
static void *p_libdvdcss;
static void ProbeLibDVDCSS ( void );
static void UnprobeLibDVDCSS( void );
#endif
/***************************************************************************** /*****************************************************************************
* Build configuration tree. * Build configuration tree.
*****************************************************************************/ *****************************************************************************/
...@@ -55,130 +41,15 @@ MODULE_CONFIG_START ...@@ -55,130 +41,15 @@ MODULE_CONFIG_START
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
#ifdef GOD_DAMN_DMCA SET_DESCRIPTION( "DVDRead input module" )
SET_DESCRIPTION( "DVDRead input module, uses libdvdcss if present" )
ADD_CAPABILITY( INPUT, 70 )
#else
SET_DESCRIPTION( "DVDRead input module, linked with libdvdcss" )
ADD_CAPABILITY( INPUT, 110 ) ADD_CAPABILITY( INPUT, 110 )
#endif
ADD_SHORTCUT( "dvdread" ) ADD_SHORTCUT( "dvdread" )
MODULE_INIT_STOP MODULE_INIT_STOP
MODULE_ACTIVATE_START MODULE_ACTIVATE_START
_M( input_getfunctions )( &p_module->p_functions->input ); _M( input_getfunctions )( &p_module->p_functions->input );
#ifdef GOD_DAMN_DMCA
ProbeLibDVDCSS();
#endif
MODULE_ACTIVATE_STOP MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START MODULE_DEACTIVATE_START
#ifdef GOD_DAMN_DMCA
UnprobeLibDVDCSS();
#endif
MODULE_DEACTIVATE_STOP MODULE_DEACTIVATE_STOP
/* Following functions are local */
#ifdef GOD_DAMN_DMCA
/*****************************************************************************
* ProbeLibDVDCSS: look for a libdvdcss object.
*****************************************************************************
* This functions looks for libdvdcss, using dlopen(), and fills function
* pointers with what it finds. On failure, uses the dummy libdvdcss
* replacement provided by vlc.
*****************************************************************************/
static void ProbeLibDVDCSS( void )
{
char *pp_filelist[4] = { "libdvdcss.so.0",
"./libdvdcss.so.0",
"./lib/libdvdcss.so.0",
NULL };
char **pp_file = pp_filelist;
/* Try to open the dynamic object */
do
{
p_libdvdcss = dlopen( *pp_file, RTLD_LAZY );
if( p_libdvdcss != NULL )
{
intf_WarnMsg( 2, "module: builtin module `dvd' found libdvdcss "
"in `%s'", *pp_file );
break;
}
pp_file++;
} while( *pp_file != NULL );
/* If libdvdcss.so was found, check that it's valid */
if( p_libdvdcss == NULL )
{
intf_ErrMsg( "dvd warning: libdvdcss.so.0 not present" );
}
else
{
/* Check for libdvdcss 0.0.1 */
if( dlsym( p_libdvdcss, "dvdcss_crack" ) != NULL )
{
intf_ErrMsg( "dvd warning: libdvdcss.so.0 has deprecated symbol "
"dvdcss_crack(), please upgrade" );
dlclose( p_libdvdcss );
p_libdvdcss = NULL;
}
else
{
dvdcss_open = dlsym( p_libdvdcss, "dvdcss_open" );
dvdcss_close = dlsym( p_libdvdcss, "dvdcss_close" );
dvdcss_title = dlsym( p_libdvdcss, "dvdcss_title" );
dvdcss_seek = dlsym( p_libdvdcss, "dvdcss_seek" );
dvdcss_read = dlsym( p_libdvdcss, "dvdcss_read" );
dvdcss_readv = dlsym( p_libdvdcss, "dvdcss_readv" );
dvdcss_error = dlsym( p_libdvdcss, "dvdcss_error" );
if( dvdcss_open == NULL || dvdcss_close == NULL
|| dvdcss_title == NULL || dvdcss_seek == NULL
|| dvdcss_read == NULL || dvdcss_readv == NULL
|| dvdcss_error == NULL )
{
intf_ErrMsg( "dvd warning: missing symbols in libdvdcss.so.0, "
"please upgrade libdvdcss or vlc" );
dlclose( p_libdvdcss );
p_libdvdcss = NULL;
}
}
}
/* If libdvdcss was not found or was not valid, use the dummy
* replacement functions. */
if( p_libdvdcss == NULL )
{
intf_ErrMsg( "dvd warning: no valid libdvdcss found, "
"I will only play unencrypted DVDs" );
intf_ErrMsg( "dvd warning: get libdvdcss at "
"http://www.videolan.org/libdvdcss/" );
dvdcss_open = dummy_dvdcss_open;
dvdcss_close = dummy_dvdcss_close;
dvdcss_title = dummy_dvdcss_title;
dvdcss_seek = dummy_dvdcss_seek;
dvdcss_read = dummy_dvdcss_read;
dvdcss_readv = dummy_dvdcss_readv;
dvdcss_error = dummy_dvdcss_error;
}
}
/*****************************************************************************
* UnprobeLibDVDCSS: free resources allocated by ProbeLibDVDCSS, if any.
*****************************************************************************/
static void UnprobeLibDVDCSS( void )
{
if( p_libdvdcss != NULL )
{
dlclose( p_libdvdcss );
p_libdvdcss = NULL;
}
}
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_dvdread.h: thread structure of the DVD plugin * input_dvdread.h: thread structure of the DVD plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_dvdread.h,v 1.3 2001/12/29 22:22:01 massiot Exp $ * $Id: input_dvdread.h,v 1.4 2002/01/23 03:15:31 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "dvd_udf.h" #include "dvd_udf.h"
#include "nav_read.h" #include "nav_read.h"
#include "nav_print.h" #include "nav_print.h"
#include "videolan/dvdread.h"
/* Logical block size for DVD-VIDEO */ /* Logical block size for DVD-VIDEO */
#define LB2OFF(x) ((off_t)(x) * (off_t)(DVD_VIDEO_LB_LEN)) #define LB2OFF(x) ((off_t)(x) * (off_t)(DVD_VIDEO_LB_LEN))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment