Commit 495436e7 authored by Sam Hocevar's avatar Sam Hocevar

  * Exported the CSS part of the dvd plugin into a library.
parent 106079bc
......@@ -249,6 +249,9 @@ snapshot: Makefile.opts
cp share/$$icon.xpm share/$$icon.png \
/tmp/vlc-${PROGRAM_VERSION}/share/ ; done
# make distclean
(cd /tmp/vlc-${PROGRAM_VERSION} ; ./configure ; make distclean )
# build css-enabled archives
(cd /tmp ; tar cf vlc-${PROGRAM_VERSION}.tar vlc-${PROGRAM_VERSION} ; \
bzip2 -f -9 < vlc-${PROGRAM_VERSION}.tar \
......@@ -348,3 +351,9 @@ builtins: Makefile.modules Makefile.opts Makefile.dep Makefile $(BUILTIN_OBJ)
$(BUILTIN_OBJ): FORCE
cd $(shell echo " "$(PLUGINS_TARGETS)" " | sed -e 's@.* \([^/]*/\)'$(@:lib/%.a=%)' .*@plugins/\1@' -e 's@^ .*@@') && $(MAKE) $(@:%=../../%)
#
# libdvdcss target
#
libdvdcss:
cd extras/libdvdcss && $(MAKE)
......@@ -62,6 +62,7 @@ libdir = @libdir@
LIB_ALSA = @LIB_ALSA@
LIB_BEOS = @LIB_BEOS@
LIB_DARWIN = @LIB_DARWIN@
LIB_DVD = @LIB_DVD@
LIB_ESD = @LIB_ESD@
LIB_GGI = @LIB_GGI@
LIB_GLIDE = @LIB_GLIDE@
......@@ -81,6 +82,7 @@ LIB_YUV = @LIB_YUV@
#
# CFLAGS for special cases
#
CFLAGS_DVD = @CFLAGS_DVD@
CFLAGS_GTK = @CFLAGS_GTK@
CFLAGS_SDL = @CFLAGS_SDL@
CFLAGS_X11 = @CFLAGS_X11@
......
This diff is collapsed.
......@@ -180,6 +180,8 @@ dnl DVD module: check for DVD ioctls
dnl
AC_CHECK_HEADERS(sys/ioctl.h,[
BUILTINS="${BUILTINS} dvd"
LIB_DVD="${LIB_DVD} -Llib -L../../lib -ldvdcss"
CFLAGS_DVD="${CFLAGS_DVD} -I../../extras/libdvdcss"
AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h)
BSD_DVD_STRUCT=0
dnl
......@@ -592,6 +594,7 @@ AC_SUBST(LIB)
AC_SUBST(LIB_ALSA)
AC_SUBST(LIB_BEOS)
AC_SUBST(LIB_DARWIN)
AC_SUBST(LIB_DVD)
AC_SUBST(LIB_ESD)
AC_SUBST(LIB_GGI)
AC_SUBST(LIB_GLIDE)
......@@ -609,6 +612,7 @@ AC_SUBST(LIB_XVIDEO)
AC_SUBST(LIB_YUV)
AC_SUBST(CFLAGS_VLC)
AC_SUBST(CFLAGS_DVD)
AC_SUBST(CFLAGS_GTK)
AC_SUBST(CFLAGS_SDL)
AC_SUBST(CFLAGS_X11)
......@@ -616,20 +620,27 @@ AC_SUBST(CFLAGS_X11)
AC_OUTPUT([Makefile.opts include/config.h])
echo "
global configuration
--------------------
system : ${SYS}
architecture : ${ARCH}
optimizations : ${OPTIMS}
vlc configuration
-----------------
vlc version : ${VLC_VERSION}
system : ${SYS}
architecture : ${ARCH}
debug mode : ${DEBUG}
statistics : ${STATS}
trace mode : ${TRACE}
optimizations : ${OPTIMS}
CSS decryption : ${CSS}
need builtin getopt : ${GETOPT}
built-in modules :${BUILTINS}
plugin modules :${PLUGINS}
vlc aliases :${ALIASES}
You may now tune Makefile.opts at your convenience."
libdvdcss configuration
-----------------------
CSS decryption : ${CSS}
You may now tune Makefile.opts at your convenience. To build vlc, type
\`make vlc'. To build libdvdcss only, type \`make libdvdcss'."
###############################################################################
# vlc (VideoLAN Client) dvd module Makefile
# (c)2001 VideoLAN
###############################################################################
include ../../Makefile.opts
#
# Objects
#
LIBDVDCSS_O = libdvdcss.o css.o ioctl.o
ALL_OBJ = $(LIBDVDCSS_O)
include ../../Makefile.modules
$(LIBDVDCSS_O): %.o: .dep/%.d
$(LIBDVDCSS_O): %.o: %.c
$(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $<
../../lib/libdvdcss.so: $(LIBDVDCSS_O)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../../lib/libdvdcss.a: $(LIBDVDCSS_O)
ar r $@ $^
$(RANLIB) $@
#all: ../../lib/libdvdcss.so ../../lib/libdvdcss.a
all: ../../lib/libdvdcss.a
/*****************************************************************************
* dvd_css.h: Structures for DVD authentification and unscrambling
* css.h: Structures for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.h,v 1.8 2001/05/19 00:39:29 stef Exp $
* $Id: css.h,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -60,7 +60,8 @@ typedef struct css_s
*****************************************************************************/
struct css_s;
int CSSTest ( int );
int CSSInit ( int, struct css_s * );
int CSSGetKey ( int, struct css_s * );
int CSSTest ( dvdcss_handle );
int CSSInit ( dvdcss_handle );
int CSSGetKey ( dvdcss_handle );
int CSSDescrambleSector ( u8 * , u8 * );
/*****************************************************************************
* dvd_csstables.h: CSS Tables for DVD unscrambling
* csstables.h: CSS Tables for DVD unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_csstables.h,v 1.1 2001/03/02 13:47:01 sam Exp $
* $Id: csstables.h,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......
/*****************************************************************************
* dvd_ioctl.c: DVD ioctl replacement function
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.17 2001/06/03 12:47:21 sam Exp $
* $Id: ioctl.c,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
......@@ -55,20 +55,12 @@
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#ifdef SYS_DARWIN1_3
# include "DVDioctl/DVDioctl.h"
#endif
#include "dvd_css.h"
#include "dvd_ioctl.h"
#include "modules.h"
#include "modules_export.h"
#include "ioctl.h"
/*****************************************************************************
* Local prototypes, BeOS specific
......@@ -115,8 +107,8 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
#elif defined( SYS_DARWIN1_3 )
intf_ErrMsg( "css error: DVD ioctls not fully functional yet" );
intf_ErrMsg( "css error: assuming disc is encrypted" );
_dvd_error( dvdcss, "DVD ioctls not fully functional yet, "
"assuming disc is encrypted" );
*pi_copyright = 1;
......@@ -159,8 +151,8 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
else
{
/* TODO: add WNASPI support for Win9x */
intf_ErrMsg( "css error: DVD ioctls not functional yet" );
intf_ErrMsg( "css error: assuming disc is unencrypted" );
_dvd_error( dvdcss, "DVD ioctls not functional yet, "
"assuming disc is unencrypted" );
*pi_copyright = 0;
i_ret = 0;
}
......@@ -228,8 +220,8 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 2048 );
#elif defined( SYS_DARWIN1_3 )
intf_ErrMsg( "css error: DVD ioctls not fully functional yet" );
intf_ErrMsg( "css error: sending an empty key" );
_dvd_error( dvdcss, "DVD ioctls not fully functional yet, "
"sending an empty key" );
i_ret = 0;
......
......@@ -2,7 +2,7 @@
* dvd_ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.h,v 1.10 2001/05/31 03:57:54 sam Exp $
* $Id: ioctl.h,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
This diff is collapsed.
/*****************************************************************************
* private.h: private DVD reading library data
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: libdvdcss.h,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* 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.
*****************************************************************************/
/*****************************************************************************
* Needed headers
*****************************************************************************/
#include "css.h"
/*****************************************************************************
* The libdvdcss structure
*****************************************************************************/
struct dvdcss_s
{
/* Status */
int i_status;
/* File descriptor */
int i_fd;
/* Decryption stuff */
css_t css;
boolean_t b_encrypted;
/* Error management */
char *psz_error;
boolean_t b_errors;
boolean_t b_debug;
};
/*****************************************************************************
* Flags
*****************************************************************************/
#define DVDCSS_STATUS_NONE 0
#define DVDCSS_STATUS_INIT 1 << 0
#define DVDCSS_STATUS_OPEN 1 << 1
/*****************************************************************************
* Error management
*****************************************************************************/
#define DVDCSS_ERROR( x... ) fprintf( stderr, "libdvdcss error: %s\n", ##x );
#define DVDCSS_DEBUG( x... ) fprintf( stderr, "libdvdcss debug: %s\n", ##x );
static __inline__ void _dvdcss_error( dvdcss_handle dvdcss, char *psz_string )
{
if( dvdcss->b_errors )
{
DVDCSS_ERROR( psz_string );
}
dvdcss->psz_error = psz_string;
}
static __inline__ void _dvdcss_debug( dvdcss_handle dvdcss, char *psz_string )
{
if( dvdcss->b_debug )
{
DVDCSS_DEBUG( psz_string );
}
}
/*****************************************************************************
* libdvdcss.h: DVD reading library, exported functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvdcss.h,v 1.1 2001/06/12 22:14:44 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* 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.
*****************************************************************************/
/*****************************************************************************
* The libdvdcss structure
*****************************************************************************/
typedef struct dvdcss_s* dvdcss_handle;
/*****************************************************************************
* Flags
*****************************************************************************/
#define DVDCSS_NOFLAGS 0
#define DVDCSS_INIT_QUIET 1 << 0
#define DVDCSS_INIT_DEBUG 1 << 1
#define DVDCSS_READ_DECRYPT 1 << 0
#define DVDCSS_BLOCK_SIZE 2048
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
extern dvdcss_handle dvdcss_init ( int i_flags );
extern int dvdcss_end ( dvdcss_handle );
extern int dvdcss_open ( dvdcss_handle,
char *psz_target );
extern int dvdcss_close ( dvdcss_handle );
extern int dvdcss_crack ( dvdcss_handle,
int i_title,
int i_block );
extern int dvdcss_seek ( dvdcss_handle,
int i_blocks );
extern int dvdcss_read ( dvdcss_handle,
void *p_buffer,
int i_blocks,
int i_flags );
extern int dvdcss_readv ( dvdcss_handle,
void *p_iovec,
int i_blocks,
int i_flags );
extern char * dvdcss_error ( dvdcss_handle );
......@@ -30,7 +30,6 @@ struct iovec
size_t iov_len; /* Length of data. */
};
#if defined( WIN32 )
/*****************************************************************************
* readv: readv() replacement for iovec-impaired C libraries
*****************************************************************************/
......@@ -86,4 +85,3 @@ static __inline int readv( int i_fd, struct iovec *p_iovec, int i_count )
return i_total;
}
#endif
......@@ -7,10 +7,10 @@
# Objects
#
PLUGIN_C = dvd.o input_dvd.o dvd_netlist.o dvd_ioctl.o dvd_ifo.o dvd_udf.o dvd_css.o dvd_summary.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
PLUGIN_DVD = dvd.o input_dvd.o dvd_netlist.o dvd_ifo.o dvd_udf.o dvd_summary.o
BUILTIN_DVD = $(PLUGIN_DVD:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
ALL_OBJ = $(PLUGIN_DVD) $(BUILTIN_DVD)
#
# Virtual targets
......@@ -18,14 +18,25 @@ ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
include ../../Makefile.modules
$(PLUGIN_DVD): %.o: .dep/%.d
$(PLUGIN_DVD): %.o: %.c
$(CC) $(CFLAGS) $(PCFLAGS) $(CFLAGS_DVD) -DPLUGIN -c -o $@ $<
$(BUILTIN_DVD): BUILTIN_%.o: .dep/%.d
$(BUILTIN_DVD): BUILTIN_%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_DVD) -DBUILTIN -c -o $@ $<
#
# Real targets
#
../../lib/dvd.so: $(PLUGIN_C)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../../lib/dvd.so: libdvdcss $(PLUGIN_DVD)
$(CC) $(PCFLAGS) -o $@ $(PLUGIN_DVD) $(PLCFLAGS) $(LIB_DVD)
../../lib/dvd.a: $(BUILTIN_C)
ar r $@ $^
../../lib/dvd.a: libdvdcss $(BUILTIN_DVD)
ar r $@ $(BUILTIN_DVD)
$(RANLIB) $@
libdvdcss:
cd ../../ && $(MAKE) libdvdcss
This diff is collapsed.
......@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.16 2001/06/07 15:27:44 sam Exp $
* $Id: dvd_ifo.h,v 1.17 2001/06/12 22:14:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -521,7 +521,7 @@ typedef struct time_inf_s
typedef struct vts_s
{
boolean_t b_initialized;
off_t i_pos;
int i_pos;
vts_manager_t manager_inf;
vts_title_t title_inf;
title_unit_t menu_unit;
......@@ -538,18 +538,17 @@ typedef struct vts_s
*/
typedef struct ifo_s
{
int i_fd; /* File descriptor for the device */
off_t i_off; /* Offset to video_ts.ifo on the device */
off_t i_pos; /* Position of stream pointer */
dvdcss_handle dvdhandle; /* File descriptor for the device */
int i_start; /* Offset to video_ts.ifo on the device */
int i_pos; /* Position of stream pointer */
boolean_t b_error; /* Error Management */
vmg_t vmg; /* Structure described in video_ts */
int i_title; /* Current title number */
vts_t vts; /* Vts ifo for current title set */
#if defined(__FreeBSD__)
uint8_t p_remap[ 2 * DVD_LB_SIZE ];
/* Remap buffer for unaligned reads */
#endif
/* Remap buffer for unaligned reads */
u8 p_remap[ 2 * DVD_LB_SIZE ];
} ifo_t;
......@@ -562,3 +561,4 @@ int IfoCreate ( struct thread_dvd_data_s * );
int IfoInit ( struct ifo_s * );
int IfoTitleSet ( struct ifo_s * );
void IfoDestroy ( struct ifo_s * );
......@@ -3,7 +3,7 @@
* found in .ifo.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_summary.c,v 1.5 2001/06/12 18:16:49 stef Exp $
* $Id: dvd_summary.c,v 1.6 2001/06/12 22:14:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -54,6 +54,8 @@
#endif
#include <errno.h>
#include <videolan/dvdcss.h>
#include "config.h"
#include "common.h"
#include "threads.h"
......@@ -260,8 +262,8 @@ char * IfoLanguage( u16 i_code )
void IfoPrintTitle( thread_dvd_data_t * p_dvd )
{
intf_WarnMsg( 5, "dvd info: title: %d", p_dvd->i_title );
intf_WarnMsg( 5, " vobstart at: %lld", p_dvd->i_start );
intf_WarnMsg( 5, " stream size: %lld", p_dvd->i_size );
intf_WarnMsg( 5, " vobstart at: %d blocks", p_dvd->i_start );
intf_WarnMsg( 5, " stream size: %d blocks", p_dvd->i_size );
intf_WarnMsg( 5, " number of chapters: %d", p_dvd->i_chapter_nb );
intf_WarnMsg( 5, " number of angles: %d", p_dvd->i_angle_nb );
}
......
......@@ -5,7 +5,7 @@
* contains the basic udf handling functions
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.c,v 1.10 2001/06/07 22:25:42 sam Exp $
* $Id: dvd_udf.c,v 1.11 2001/06/12 22:14:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -55,6 +55,8 @@
# include <strings.h>
#endif
#include <videolan/dvdcss.h>
#include "config.h"
#include "common.h"
#include "threads.h"
......@@ -63,7 +65,6 @@
#include "intf_msg.h"
#include "input_dvd.h"
#include "dvd_css.h"
#include "dvd_ifo.h"
#include "modules.h"
......@@ -75,15 +76,15 @@
typedef struct partition_s
{
boolean_t b_valid;
u8 pi_volume_desc[128];
u16 i_flags;
u16 i_number;
u8 pi_contents[32];
u32 i_access_type;
u32 i_start;
u32 i_length;
int i_fd;
boolean_t b_valid;
u8 pi_volume_desc[128];
u16 i_flags;
u16 i_number;
u8 pi_contents[32];
u32 i_access_type;
u32 i_start;
u32 i_length;
dvdcss_handle dvdhandle;
} partition_t;
typedef struct ad_s
......@@ -106,41 +107,16 @@ typedef struct ad_s
*****************************************************************************
* Returns number of read bytes on success, 0 on error
*****************************************************************************/
static int UDFReadLB( int i_fd, off_t i_lba, size_t i_block_count, u8 *pi_data )
static int UDFReadLB( dvdcss_handle dvdhandle, off_t i_lba,
size_t i_block_count, u8 *pi_data )
{
#if !defined( WIN32 )
if( i_fd < 0 )
#else
DWORD read;
if( (HANDLE) i_fd == INVALID_HANDLE_VALUE )
#endif
{
return 0;
}
#if !defined( WIN32 )
if( lseek( i_fd, i_lba * (off_t) DVD_LB_SIZE, SEEK_SET ) < 0 )
#else
if( SetFilePointer( (HANDLE) i_fd, i_lba * (off_t) DVD_LB_SIZE,
NULL, FILE_BEGIN ) == -1 )
#endif
if( dvdcss_seek( dvdhandle, i_lba ) < 0 )
{
intf_ErrMsg( "UDF: Postion not found" );
return 0;
}
#if !defined( WIN32 )
return read( i_fd, pi_data, i_block_count *DVD_LB_SIZE);
#else
if(!ReadFile( (HANDLE) i_fd, pi_data, i_block_count * DVD_LB_SIZE,
&read, NULL) || read != i_block_count * DVD_LB_SIZE )
{
return 0;
}
return read;
#endif
return dvdcss_read( dvdhandle, pi_data, i_block_count, DVDCSS_NOFLAGS );
}
......@@ -413,7 +389,7 @@ static int UDFMapICB( struct ad_s icb, u8 * pi_file_type, struct ad_s * p_file,
do
{
if( !UDFReadLB( partition.i_fd, i_lba++, 1, pi_lb ) )
if( !UDFReadLB( partition.dvdhandle, i_lba++, 1, pi_lb ) )
{
i_tag_id = 0;
}
......@@ -457,7 +433,7 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename,
#if 0
do
{
if( !UDFReadLB( partition.i_fd, i_lba++, 1, pi_lb ) )
if( !UDFReadLB( partition.dvdhandle, i_lba++, 1, pi_lb ) )
{
i_tag_id = 0;
}
......@@ -489,7 +465,7 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename,
#else
if( UDFReadLB( partition.i_fd, i_lba, 2, pi_lb ) <= 0 ) {
if( UDFReadLB( partition.dvdhandle, i_lba, 2, pi_lb ) <= 0 ) {
return 0;
}
......@@ -501,7 +477,7 @@ static int UDFScanDir( struct ad_s dir, char * psz_filename,
++i_lba;
p -= DVD_LB_SIZE;
dir.i_length -= DVD_LB_SIZE;
if( UDFReadLB( partition.i_fd, i_lba, 2, pi_lb ) <= 0 )
if( UDFReadLB( partition.dvdhandle, i_lba, 2, pi_lb ) <= 0 )
{
return 0;
}
......@@ -558,7 +534,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition )
/* Search anchor loop */
while( 1 )
{
if( UDFReadLB( p_partition->i_fd, i_lba, 1, pi_anchor ) )
if( UDFReadLB( p_partition->dvdhandle, i_lba, 1, pi_anchor ) )
{
UDFDescriptor( pi_anchor, &i_tag_id );
}
......@@ -622,7 +598,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition )
do
{
if( !UDFReadLB( p_partition->i_fd, i_lba++, 1, pi_lb ) )
if( !UDFReadLB( p_partition->dvdhandle, i_lba++, 1, pi_lb ) )
{
i_tag_id = 0;
}
......@@ -679,7 +655,7 @@ static int UDFFindPartition( int i_part_nb, struct partition_s *p_partition )
* starting with '/'.
* returns absolute LB number, or 0 on error
*****************************************************************************/
u32 UDFFindFile( int i_fd, char * psz_path )
u32 UDFFindFile( dvdcss_handle dvdhandle, char * psz_path )
{
struct partition_s partition;
struct ad_s root_icb;
......@@ -696,7 +672,7 @@ u32 UDFFindFile( int i_fd, char * psz_path )
strcat( psz_tokenline, psz_path );
/* Init file descriptor of UDF filesystem (== DVD) */
partition.i_fd = i_fd;
partition.dvdhandle = dvdhandle;
/* Find partition 0, standard partition for DVD-Video */
i_partition = 0;
......@@ -711,7 +687,7 @@ u32 UDFFindFile( int i_fd, char * psz_path )
do
{
if( !UDFReadLB( i_fd, i_lba++, 1, pi_lb ) )
if( !UDFReadLB( dvdhandle, i_lba++, 1, pi_lb ) )
{
i_tag_id = 0;
}
......
......@@ -2,7 +2,7 @@
* dvd_udf.h: structures for udf filesystem tools.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.h,v 1.2 2001/02/18 01:42:05 stef Exp $
* $Id: dvd_udf.h,v 1.3 2001/06/12 22:14:44 sam Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
......@@ -27,4 +27,5 @@
/*
* Fonctions in dvd_udf.c
*/
u32 UDFFindFile( int, char * );
u32 UDFFindFile( dvdcss_handle, char * );
This diff is collapsed.
......@@ -2,7 +2,7 @@
* input_dvd.h: thread structure of the DVD plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dvd.h,v 1.23 2001/06/07 22:25:42 sam Exp $
* $Id: input_dvd.h,v 1.24 2001/06/12 22:14:44 sam Exp $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
......@@ -26,14 +26,15 @@
*****************************************************************************/
/* Logical block size for DVD-VIDEO */
#define DVD_LB_SIZE 2048
#define LB2OFF(x) ((off_t)(x) * (off_t)(DVD_LB_SIZE))
#define OFF2LB(x) ((x) >> 11)
/*****************************************************************************
* thread_dvd_data_t: extension of input_thread_t for DVD specificity.
*****************************************************************************/
typedef struct thread_dvd_data_s
{
int i_fd; // File descriptor of device
boolean_t b_encrypted; // CSS encryption
dvdcss_handle dvdhandle; /* libdvdcss handle */
int i_block_once; // Nb of block read once by
// readv
......@@ -55,9 +56,9 @@ typedef struct thread_dvd_data_s
int i_sector;
int i_end_sector; /* last sector of current cell */
off_t i_title_start;
off_t i_start;
off_t i_size;
int i_title_start;
int i_start;
int i_size;
/* Scrambling Information */
struct css_s * p_css;
......
......@@ -7,10 +7,10 @@
# Objects
#
PLUGIN_C = sdl.o vout_sdl.o aout_sdl.o
BUILTIN_C = $(PLUGIN_C:%.o=BUILTIN_%.o)
PLUGIN_SDL = sdl.o vout_sdl.o aout_sdl.o
BUILTIN_SDL = $(PLUGIN_SDL:%.o=BUILTIN_%.o)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
ALL_OBJ = $(PLUGIN_SDL) $(BUILTIN_SDL)
#
# Virtual targets
......@@ -22,18 +22,18 @@ $(PLUGIN_SDL): %.o: .dep/%.d
$(PLUGIN_SDL): %.o: %.c
$(CC) $(CFLAGS) $(PCFLAGS) $(CFLAGS_SDL) -DPLUGIN -c -o $@ $<
$(BUILTIN_SDL): BUILTIN_SDL_%.o: .dep/%.d
$(BUILTIN_SDL): BUILTIN_SDL_%.o: %.c
$(BUILTIN_SDL): BUILTIN_%.o: .dep/%.d
$(BUILTIN_SDL): BUILTIN_%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_SDL) -DBUILTIN -c -o $@ $<
#
# Real targets
#
../../lib/sdl.so: $(PLUGIN_C)
../../lib/sdl.so: $(PLUGIN_SDL)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_SDL)
../../lib/sdl.a: $(BUILTIN_C)
../../lib/sdl.a: $(BUILTIN_SDL)
ar r $@ $^
$(RANLIB) $@
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.101 2001/06/12 11:02:07 reno Exp $
* $Id: main.c,v 1.102 2001/06/12 22:14:44 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -133,6 +133,16 @@
#define SHORT_HELP 1
#define LONG_HELP 2
/* Needed for x86 CPU capabilities detection */
#define cpuid( a ) \
asm volatile ( "cpuid" \
: "=a" ( i_eax ), \
"=b" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( a ) \
: "cc" );
/* Long options */
static const struct option longopts[] =
{
......@@ -912,7 +922,7 @@ static void InstructionSignalHandler( int i_signal )
* to an interface having been destroyed */
/* Acknowledge the signal received */
fprintf(stderr,"illegal instruction : optimization disable\n");
fprintf( stderr, "illegal instruction : optimization disabled\n" );
i_illegal = 1;
......@@ -920,9 +930,6 @@ static void InstructionSignalHandler( int i_signal )
longjmp( env, 1 );
}
/*****************************************************************************
* CPUCapabilities: list the processors MMX support and other capabilities
*****************************************************************************
......@@ -937,8 +944,9 @@ static int CPUCapabilities( void )
| CPU_CAPABILITY_586
| CPU_CAPABILITY_MMX;
#elif defined( SYS_DARWIN1_3 )
return( i_capabilities );
#elif defined( SYS_DARWIN1_3 )
struct host_basic_info hi;
kern_return_t ret;
host_name_port_t host;
......@@ -966,21 +974,14 @@ static int CPUCapabilities( void )
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
}
return( i_capabilities );
#elif defined( __i386__ )
volatile unsigned int i_eax, i_ebx, i_ecx, i_edx;
volatile boolean_t b_amd;
signal( SIGILL, InstructionSignalHandler );
# define cpuid( a ) \
asm volatile ( "cpuid" \
: "=a" ( i_eax ), \
"=b" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( a ) \
: "cc" ); \
/* test for a 486 CPU */
asm volatile ( "pushfl\n\t"
"popl %%eax\n\t"
......@@ -1032,19 +1033,20 @@ static int CPUCapabilities( void )
if( i_edx & 0x02000000 )
{
i_capabilities |= CPU_CAPABILITY_MMXEXT;
/* We test if OS support the SSE instructions */
i_illegal = 0;
if(setjmp(env)==0) { /* Test a SSE instruction */
__asm__ __volatile__ (
"xorps %%xmm0,%%xmm0\n"
::);
if( setjmp( env ) == 0 )
{
/* Test a SSE instruction */
__asm__ __volatile__ ( "xorps %%xmm0,%%xmm0\n" : : );
}
if( i_illegal != 1 )
if( i_illegal == 0 )
{
i_capabilities |= CPU_CAPABILITY_SSE;
}
}
/* test for additional capabilities */
......@@ -1062,26 +1064,30 @@ static int CPUCapabilities( void )
if( i_edx & 0x80000000 )
{
i_illegal = 0;
if(setjmp(env)==0) { /* Test a 3D Now! instruction */
__asm__ __volatile__ (
"pfadd %%mm0,%%mm0\n"
"femms\n"
::);
if( setjmp( env ) == 0 )
{
/* Test a 3D Now! instruction */
__asm__ __volatile__ ( "pfadd %%mm0,%%mm0\n" "femms\n" : : );
}
if( i_illegal != 1 )
if( i_illegal == 0 )
{
i_capabilities |= CPU_CAPABILITY_3DNOW;
}
}
if( b_amd && ( i_edx & 0x00400000 ) )
{
i_capabilities |= CPU_CAPABILITY_MMXEXT;
}
signal( SIGILL, NULL );
return( i_capabilities );
#else
/* default behaviour */
return( i_capabilities );
#endif
signal( SIGILL, NULL );
return( i_capabilities );
}
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