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

Support for libdvdread.

Libdvdread files are in extras/libdvdread. They have not been changed from
those of libdvdread 0.9.2. The changes are in the subdirectory videolan.
They basically consist of a new function in the API that does a readv()
instead fo a read().

The library is statically linked with libdvdcss from extras/libdvdcss, and
the whole is statically linked with the plugin dvdread. Dvdread can only be
compiled as a builtin module for the time being, I think (which means I
haven't tried to compile it as a plugin).

Basically, input_dvdread.c is a copy and paste from input_dvd.c with a few
changes to use libdvdread calls. It is still in very alpha stage, but it
should offer the same features as the current DVD input.

It can be called with either the syntax: "dvdread:/dev/dvd"
or "--input dvdread /dev/dvd". The command line switches (-t, -T, -c, -u)
should work too.
parent 81287869
...@@ -23,6 +23,7 @@ PLUGINS_DIR := ac3_adec \ ...@@ -23,6 +23,7 @@ PLUGINS_DIR := ac3_adec \
dsp \ dsp \
dummy \ dummy \
dvd \ dvd \
dvdread \
esd \ esd \
fb \ fb \
ggi \ ggi \
...@@ -58,6 +59,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \ ...@@ -58,6 +59,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
dummy/dummy \ dummy/dummy \
dummy/null \ dummy/null \
dvd/dvd \ dvd/dvd \
dvdread/dvdread \
esd/esd \ esd/esd \
fb/fb \ fb/fb \
ggi/ggi \ ggi/ggi \
...@@ -198,7 +200,7 @@ show: ...@@ -198,7 +200,7 @@ show:
# #
# Cleaning rules # Cleaning rules
# #
clean: libdvdcss-clean plugins-clean vlc-clean clean: libdvdcss-clean libdvdread-clean plugins-clean vlc-clean
rm -f src/*/*.o extras/*/*.o rm -f src/*/*.o extras/*/*.o
rm -f lib/*.so* lib/*.a rm -f lib/*.so* lib/*.a
rm -f plugins/*.so plugins/*.a rm -f plugins/*.so plugins/*.a
...@@ -207,6 +209,9 @@ clean: libdvdcss-clean plugins-clean vlc-clean ...@@ -207,6 +209,9 @@ clean: libdvdcss-clean plugins-clean vlc-clean
libdvdcss-clean: libdvdcss-clean:
-cd extras/libdvdcss && $(MAKE) clean -cd extras/libdvdcss && $(MAKE) clean
libdvdread-clean:
-cd extras/libdvdread && $(MAKE) clean
plugins-clean: plugins-clean:
for dir in $(PLUGINS_DIR) ; do \ for dir in $(PLUGINS_DIR) ; do \
( cd plugins/$${dir} && $(MAKE) clean ) ; done ( cd plugins/$${dir} && $(MAKE) clean ) ; done
...@@ -533,3 +538,10 @@ $(BUILTIN_OBJ): FORCE ...@@ -533,3 +538,10 @@ $(BUILTIN_OBJ): FORCE
# #
libdvdcss: Makefile.opts libdvdcss: Makefile.opts
cd extras/libdvdcss && $(MAKE) cd extras/libdvdcss && $(MAKE)
#
# libdvdread target
#
libdvdread: Makefile.opts
cd extras/libdvdread && $(MAKE)
...@@ -72,6 +72,8 @@ LIB_BEOS = @LIB_BEOS@ ...@@ -72,6 +72,8 @@ LIB_BEOS = @LIB_BEOS@
LIB_DARWIN = @LIB_DARWIN@ LIB_DARWIN = @LIB_DARWIN@
LIB_DVD = @LIB_DVD@ LIB_DVD = @LIB_DVD@
LIB_DVD_PLUGIN = @LIB_DVD_PLUGIN@ LIB_DVD_PLUGIN = @LIB_DVD_PLUGIN@
LIB_DVDREAD = @LIB_DVDREAD@
LIB_DVDREAD_PLUGIN = @LIB_DVDREAD_PLUGIN@
LIB_ESD = @LIB_ESD@ LIB_ESD = @LIB_ESD@
LIB_GGI = @LIB_GGI@ LIB_GGI = @LIB_GGI@
LIB_GLIDE = @LIB_GLIDE@ LIB_GLIDE = @LIB_GLIDE@
...@@ -95,6 +97,7 @@ LIB_YUV = @LIB_YUV@ ...@@ -95,6 +97,7 @@ LIB_YUV = @LIB_YUV@
# #
CFLAGS_ALTIVEC = @CFLAGS_ALTIVEC@ CFLAGS_ALTIVEC = @CFLAGS_ALTIVEC@
CFLAGS_DVD = @CFLAGS_DVD@ CFLAGS_DVD = @CFLAGS_DVD@
CFLAGS_DVDREAD = @CFLAGS_DVDREAD@
CFLAGS_ARTS = @CFLAGS_ARTS@ CFLAGS_ARTS = @CFLAGS_ARTS@
CFLAGS_ESD = @CFLAGS_ESD@ CFLAGS_ESD = @CFLAGS_ESD@
CFLAGS_LIBDVDCSS = @CFLAGS_LIBDVDCSS@ CFLAGS_LIBDVDCSS = @CFLAGS_LIBDVDCSS@
......
This diff is collapsed.
...@@ -683,6 +683,25 @@ AC_ARG_WITH(dvdcss, ...@@ -683,6 +683,25 @@ AC_ARG_WITH(dvdcss,
LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl" LIB_DVD_PLUGIN="${LIB_DVD_PLUGIN} -ldl"
fi ]) fi ])
dnl
dnl DVDREAD module: check for libdvdread plugin
dnl
AC_ARG_ENABLE(dvdread,
[ --enable-dvdread Enable dvdread support (default enabled)],
[ if test x$enableval = xyes
then
NEED_LIBDVDCSS=1
STATIC_LIBDVDCSS=1
BUILTINS="${BUILTINS} dvdread"
CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a"
fi ],
[ NEED_LIBDVDCSS=1
STATIC_LIBDVDCSS=1
BUILTINS="${BUILTINS} dvdread"
CFLAGS_DVDREAD="${CFLAGS_DVDREAD} -I../../extras/libdvdread"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a lib/libdvdcss.a" ])
dnl dnl
dnl VCD module dnl VCD module
dnl dnl
...@@ -1186,6 +1205,8 @@ AC_SUBST(LIB_BEOS) ...@@ -1186,6 +1205,8 @@ AC_SUBST(LIB_BEOS)
AC_SUBST(LIB_DARWIN) AC_SUBST(LIB_DARWIN)
AC_SUBST(LIB_DVD) AC_SUBST(LIB_DVD)
AC_SUBST(LIB_DVD_PLUGIN) AC_SUBST(LIB_DVD_PLUGIN)
AC_SUBST(LIB_DVDREAD)
AC_SUBST(LIB_DVDREAD_PLUGIN)
AC_SUBST(LIB_ESD) AC_SUBST(LIB_ESD)
AC_SUBST(LIB_GGI) AC_SUBST(LIB_GGI)
AC_SUBST(LIB_GLIDE) AC_SUBST(LIB_GLIDE)
...@@ -1207,6 +1228,7 @@ AC_SUBST(LIB_YUV) ...@@ -1207,6 +1228,7 @@ AC_SUBST(LIB_YUV)
AC_SUBST(CFLAGS_VLC) AC_SUBST(CFLAGS_VLC)
AC_SUBST(CFLAGS_ALTIVEC) AC_SUBST(CFLAGS_ALTIVEC)
AC_SUBST(CFLAGS_DVD) AC_SUBST(CFLAGS_DVD)
AC_SUBST(CFLAGS_DVDREAD)
AC_SUBST(CFLAGS_LIBDVDCSS) AC_SUBST(CFLAGS_LIBDVDCSS)
AC_SUBST(CFLAGS_ARTS) AC_SUBST(CFLAGS_ARTS)
AC_SUBST(CFLAGS_ESD) AC_SUBST(CFLAGS_ESD)
......
###############################################################################
# vlc (VideoLAN Client) dvdread module Makefile
# (c)2001 VideoLAN
###############################################################################
LIBDVDREAD_VERSION := 0.9.2
CFLAGS_LIBDVDREAD := -I. -DHAVE_CONFIG_H
LIB_LIBDVDREAD := -ldl
BASE_A := libdvdread.a
BASE_SO := libdvdread.so
MAJOR_SO := libdvdread.so.$(shell echo $(LIBDVDREAD_VERSION) | cut -f1 -d.)
FULL_SO := libdvdread.so.$(LIBDVDREAD_VERSION)
ifneq (,$(SOFLAGS))
ALL_SOFLAGS := $(SOFLAGS)$(MAJOR_SO)
SOFLAGS :=
endif
#
# Objects
#
OBJ_C = dvdread.o dvd_udf.o nav_print.o nav_read.o ifo_print.o ifo_read.o
PLUGIN_OBJ = $(OBJ_C) $(OBJ_LIBDVDREAD)
BUILTIN_OBJ = $(OBJ_C:%.o=DVDREAD_%.o)
ALL_OBJ = $(PLUGIN_OBJ) $(BUILTIN_OBJ)
include ../../Makefile.modules
$(OBJ_C): %.o: .dep/%.d
$(OBJ_C): %.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_LIBDVDREAD) $(PCFLAGS) -c -o $@ $<
$(BUILTIN_OBJ): DVDREAD_%.o: .dep/%.d
$(BUILTIN_OBJ): DVDREAD_%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_LIBDVDREAD) $(PCFLAGS) -c -o $@ $<
../../lib/$(FULL_SO): $(OBJ_C) $(OBJ_LIBDVDREAD)
$(CC) $(PCFLAGS) $(ALL_SOFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_LIBDVDREAD)
rm -f ../../lib/$(BASE_SO) && ln -s $(FULL_SO) ../../lib/$(BASE_SO)
rm -f ../../lib/$(MAJOR_SO) && ln -s $(FULL_SO) ../../lib/$(MAJOR_SO)
../../lib/$(BASE_A): libdvdcss $(BUILTIN_OBJ) $(OBJ_LIBDVDREAD)
ar r $@ $(BUILTIN_OBJ)
$(RANLIB) $@
#
# Virtual targets
#
all: ../../lib/$(BASE_A)
libdvdcss:
cd ../../ && $(MAKE) libdvdcss
#install:
# mkdir -p $(DESTDIR)$(includedir)/videolan
# $(INSTALL) -m 644 videolan/dvdcss.h $(DESTDIR)$(includedir)/videolan
# mkdir -p $(DESTDIR)$(libdir)
# -$(INSTALL) -m 644 ../../lib/$(BASE_A) $(DESTDIR)$(libdir)
# -$(INSTALL) -m 644 ../../lib/$(FULL_SO) $(DESTDIR)$(libdir)
# rm -f $(DESTDIR)$(libdir)/$(BASE_SO) && ln -s $(FULL_SO) $(DESTDIR)$(libdir)/$(BASE_SO)
# rm -f $(DESTDIR)$(libdir)/$(MAJOR_SO) && ln -s $(FULL_SO) $(DESTDIR)$(libdir)/$(MAJOR_SO)
#
#uninstall:
# rm -f $(DESTDIR)$(includedir)/videolan/dvdcss.h
# rm -f $(DESTDIR)$(libdir)/$(BASE_A)
# rm -f $(DESTDIR)$(libdir)/$(BASE_SO)
# rm -f $(DESTDIR)$(libdir)/$(MAJOR_SO)
# rm -f $(DESTDIR)$(libdir)/$(FULL_SO)
/**
* Copyright (C) 2000, 2001 Billy Biggs <vektor@dumbterm.net>,
* Hkan Hjort <d95hjort@dtek.chalmers.se>
*
* 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-1307 USA
*/
#ifndef BSWAP_H_INCLUDED
#define BSWAP_H_INCLUDED
#include <config.h>
#if defined(WORDS_BIGENDIAN)
/* All bigendian systems are fine, just ignore the swaps. */
#define B2N_16(x) (void)(x)
#define B2N_32(x) (void)(x)
#define B2N_64(x) (void)(x)
#else
#if defined(__linux__)
#include <byteswap.h>
#define B2N_16(x) x = bswap_16(x)
#define B2N_32(x) x = bswap_32(x)
#define B2N_64(x) x = bswap_64(x)
#elif defined(__NetBSD__)
#include <sys/endian.h>
#define B2N_16(x) BE16TOH(x)
#define B2N_32(x) BE32TOH(x)
#define B2N_64(x) BE64TOH(x)
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define B2N_16(x) x = swap16(x)
#define B2N_32(x) x = swap32(x)
#define B2N_64(x) x = swap64(x)
/* This is a slow but portable implementation, it has multiple evaluation
* problems so beware.
* FreeBSD and Solaris don't have <byteswap.h> or any other such
* functionality!
*/
#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
#define B2N_16(x) \
x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define B2N_32(x) \
x = ((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define B2N_64(x) \
x = ((((x) & 0xff00000000000000) >> 56) | \
(((x) & 0x00ff000000000000) >> 40) | \
(((x) & 0x0000ff0000000000) >> 24) | \
(((x) & 0x000000ff00000000) >> 8) | \
(((x) & 0x00000000ff000000) << 8) | \
(((x) & 0x0000000000ff0000) << 24) | \
(((x) & 0x000000000000ff00) << 40) | \
(((x) & 0x00000000000000ff) << 56))
#else
/* If there isn't a header provided with your system with this functionality
* add the relevant || define( ) to the portable implementation above.
*/
#error "You need to add endian swap macros for you're system"
#endif
#endif /* WORDS_BIGENDIAN */
#endif /* BSWAP_H_INCLUDED */
This diff is collapsed.
/**
* Copyright (C) 2001 Billy Biggs <vektor@dumbterm.net>,
* Håkan Hjort <d95hjort@dtek.chalmers.se>
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef DVD_READER_H_INCLUDED
#define DVD_READER_H_INCLUDED
#include <sys/types.h>
#include <inttypes.h>
/**
* The length of one Logical Block of a DVD Video.
*/
#define DVD_VIDEO_LB_LEN 2048
/**
* Maximum length of filenames for UDF.
*/
#define MAX_UDF_FILE_NAME_LEN 2048
#ifdef __cplusplus
extern "C" {
#endif
typedef struct dvd_reader_s dvd_reader_t;
typedef struct dvd_file_s dvd_file_t;
/**
* Opens a block device of a DVD-ROM file, or an image file, or a directory
* name for a mounted DVD or HD copy of a DVD. Returns 0 if we can't get any
* of those methods to work.
*
* If the given file is a block device, or is the mountpoint for a block
* device, then that device is used for CSS authentication using libdvdcss.
* If no device is available, then no CSS authentication is performed,
* and we hope that the image is decrypted.
*
* If the path given is a directory, then the files in that directory may be in
* any one of these formats:
*
* path/VIDEO_TS/VTS_01_1.VOB
* path/video_ts/vts_01_1.vob
* path/VTS_01_1.VOB
* path/vts_01_1.vob
*/
dvd_reader_t *DVDOpen( const char *path );
/**
* Closes and cleans up the DVD reader object. You must close all open files
* before calling this function.
*/
void DVDClose( dvd_reader_t *dvd );
/**
* INFO_FILE : VIDEO_TS.IFO (manager)
* VTS_XX_0.IFO (title)
*
* INFO_BACKUP_FILE: VIDEO_TS.BUP (manager)
* VTS_XX_0.BUP (title)
*
* MENU_VOBS : VIDEO_TS.VOB (manager)
* VTS_XX_0.VOB (title)
*
* TITLE_VOBS : VTS_XX_[1-9].VOB (title)
* All files in the title set are opened and read as a single
* file.
*/
typedef enum {
DVD_READ_INFO_FILE,
DVD_READ_INFO_BACKUP_FILE,
DVD_READ_MENU_VOBS,
DVD_READ_TITLE_VOBS
} dvd_read_domain_t;
/**
* Opens a file on the DVD given the title number and domain. If the title
* number is 0, the video manager information is opened
* (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be used for
* reads, or 0 if the file was not found.
*/
dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum,
dvd_read_domain_t domain );
/**
* Closes a file and frees the associated structure.
*/
void DVDCloseFile( dvd_file_t *dvd_file );
/**
* Reads block_count number of blocks from the file at the given block offset.
* Returns number of blocks read on success, -1 on error. This call is only
* for reading VOB data, and should not be used when reading the IFO files.
* When reading from an encrypted drive, blocks are decrypted using libdvdcss
* where required.
*/
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, unsigned char *data );
/**
* 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
* byte reads from the file, the block read call always reads from the given
* offset.
*/
int DVDFileSeek( dvd_file_t *dvd_file, int offset );
/**
* Reads the given number of bytes from the file. This call can only be used
* on the information files, and may not be used for reading from a VOB. This
* reads from and increments the currrent seek position for the file.
*/
ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size );
/**
* Returns the file size in blocks.
*/
ssize_t DVDFileSize( dvd_file_t *dvd_file );
#ifdef __cplusplus
};
#endif
#endif /* DVD_READER_H_INCLUDED */
This diff is collapsed.
/**
* This code is based on dvdudf by:
* Christian Wolff <scarabaeus@convergence.de>.
*
* Modifications by:
* Billy Biggs <vektor@dumbterm.net>.
*
* dvdudf: parse and read the UDF volume information of a DVD Video
* Copyright (C) 1999 Christian Wolff for convergence integrated media
* GmbH The author can be reached at scarabaeus@convergence.de, the
* project's page is at http://linuxtv.org/dvd/
*
* 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-1307, USA. Or, point your browser to
* http://www.gnu.org/copyleft/gpl.html
*/
#ifndef DVD_UDF_H_INCLUDED
#define DVD_UDF_H_INCLUDED
#include "dvd_reader.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Looks for a file on the UDF disc/imagefile and returns the block number
* where it begins, or 0 if it is not found. The filename should be an
* absolute pathname on the UDF filesystem, starting with '/'. For example,
* '/VIDEO_TS/VTS_01_1.IFO'. On success, filesize will be set to the size of
* the file in bytes.
*/
uint32_t UDFFindFile( dvd_reader_t *device, char *filename, uint32_t *size );
#ifdef __cplusplus
};
#endif
#endif /* DVD_UDF_H_INCLUDED */
/*****************************************************************************
* libdvdcss.h: DVD reading library, exported functions.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvdcss.h,v 1.1 2001/11/25 05:04:38 stef 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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 );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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