Commit 8a430a88 authored by Stéphane Borel's avatar Stéphane Borel

*first version of plugin for libdvdplay. To test it, you need to have

 libdvdplay installed (available from videolan CVS), and request plugins
compilation in the usual way:
	--enable-dvdplay.
Note that libdvdplay needs libdvdread and libdvdcss.

Currently it has only been tested under linux, with gnome interface (optional)
and xvideo output.

What works (more or less):
 -DVD reading in some rare cases :) (title and menus),
 -Menu pause,
 -Seeking,
 -Selecting directly a specific title/chapter/angle,
 -Changing audio, sub-picture, angle during playback,
 -Interactive menus with mouse only.

What is missing:
 -Menu buttons highlighting (needs spudec patch),
 -Keyboard interaction (needs a specific part in port specific plugins),
 -A specific interface to navigate through menus (needs that I move my ass),
 -Interactive menus won't work with other output plugins so long as they
  have not been patched to send mouse/keyboard events to vlc interface,
 -Whatever you need.

Known bugs (bugs in libdvdplay mostly):
 -Seeking in some menus or intro titles (bad vobu map),
 -Read/seek error with some DVDs,
 -the configure needs tweaking,
 -numerous segfaults,
 -decoder/output modules locking error,
 -fuzzy colors in menus when spudec is active (default in menus).

The plugin is not guaranteed to work anywhere outside my computer. If it break your, don't come and complain to me :).
parent eddfb25c
...@@ -34,6 +34,7 @@ PLUGINS_DIR := a52 \ ...@@ -34,6 +34,7 @@ PLUGINS_DIR := a52 \
dummy \ dummy \
dvd \ dvd \
dvdread \ dvdread \
dvdplay \
esd \ esd \
familiar \ familiar \
fb \ fb \
...@@ -101,6 +102,7 @@ PLUGINS_TARGETS := a52/a52 \ ...@@ -101,6 +102,7 @@ PLUGINS_TARGETS := a52/a52 \
dummy/null \ dummy/null \
dvd/dvd \ dvd/dvd \
dvdread/dvdread \ dvdread/dvdread \
dvdplay/dvdplay \
esd/esd \ esd/esd \
familiar/familiar \ familiar/familiar \
fb/fb \ fb/fb \
......
...@@ -64,6 +64,7 @@ chroma_i420_yuy2_mmx_CFLAGS = @chroma_i420_yuy2_mmx_CFLAGS@ ...@@ -64,6 +64,7 @@ chroma_i420_yuy2_mmx_CFLAGS = @chroma_i420_yuy2_mmx_CFLAGS@
directx_CFLAGS = @directx_CFLAGS@ directx_CFLAGS = @directx_CFLAGS@
dvd_CFLAGS = @dvd_CFLAGS@ dvd_CFLAGS = @dvd_CFLAGS@
dvdread_CFLAGS = @dvdread_CFLAGS@ dvdread_CFLAGS = @dvdread_CFLAGS@
dvdplay_CFLAGS = @dvdplay_CFLAGS@
esd_CFLAGS = @esd_CFLAGS@ esd_CFLAGS = @esd_CFLAGS@
familiar_CFLAGS = @familiar_CFLAGS@ familiar_CFLAGS = @familiar_CFLAGS@
ffmpeg_CFLAGS = @ffmpeg_CFLAGS@ ffmpeg_CFLAGS = @ffmpeg_CFLAGS@
...@@ -99,6 +100,7 @@ directx_LDFLAGS = @directx_LDFLAGS@ ...@@ -99,6 +100,7 @@ directx_LDFLAGS = @directx_LDFLAGS@
dsp_LDFLAGS = @dsp_LDFLAGS@ dsp_LDFLAGS = @dsp_LDFLAGS@
dvd_LDFLAGS = @dvd_LDFLAGS@ dvd_LDFLAGS = @dvd_LDFLAGS@
dvdread_LDFLAGS = @dvdread_LDFLAGS@ dvdread_LDFLAGS = @dvdread_LDFLAGS@
dvdplay_LDFLAGS = @dvdplay_LDFLAGS@
esd_LDFLAGS = @esd_LDFLAGS@ esd_LDFLAGS = @esd_LDFLAGS@
familiar_LDFLAGS = @familiar_LDFLAGS@ familiar_LDFLAGS = @familiar_LDFLAGS@
filter_distort_LDFLAGS = @filter_distort_LDFLAGS@ filter_distort_LDFLAGS = @filter_distort_LDFLAGS@
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -716,9 +716,46 @@ then ...@@ -716,9 +716,46 @@ then
fi fi
fi fi
]) ])
CPPFLAGS="$save_CPPFLAGS"
fi
dnl
dnl dvdplay module: check for libdvdplay
dnl
AC_ARG_ENABLE(dvdplay,
[ --enable-dvdplay dvdplay input module (default disabled)])
if test "x$enable_dvdplay" != "xno"
then
AC_ARG_WITH(dvdplay,
[ --with-dvdplay=PATH libdvdplay headers and libraries])
if test "x$with_dvdplay" = x
then
test_LDFLAGS=""
test_CFLAGS=""
else
test_LDFLAGS="-L${with_dvdplay}/lib"
test_CFLAGS="-I${with_dvdplay}/include"
fi
CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
PLUGINS="${PLUGINS} dvdplay"
dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
],[
if test "x$enable_dvdplay" != x
then
if test "x$with_dvdplay" != x
then
AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
else
AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
fi
fi
])
CPPFLAGS="${save_CPPFLAGS}" CPPFLAGS="${save_CPPFLAGS}"
fi fi
dnl dnl
dnl libdvbpsi ts demux dnl libdvbpsi ts demux
dnl dnl
...@@ -1827,6 +1864,7 @@ AC_SUBST(arts_CFLAGS) ...@@ -1827,6 +1864,7 @@ AC_SUBST(arts_CFLAGS)
AC_SUBST(chroma_i420_yuy2_mmx_CFLAGS) AC_SUBST(chroma_i420_yuy2_mmx_CFLAGS)
AC_SUBST(dvd_CFLAGS) AC_SUBST(dvd_CFLAGS)
AC_SUBST(dvdread_CFLAGS) AC_SUBST(dvdread_CFLAGS)
AC_SUBST(dvdplay_CFLAGS)
AC_SUBST(mpeg_ts_dvbpsi_CFLAGS) AC_SUBST(mpeg_ts_dvbpsi_CFLAGS)
AC_SUBST(directx_CFLAGS) AC_SUBST(directx_CFLAGS)
AC_SUBST(esd_CFLAGS) AC_SUBST(esd_CFLAGS)
...@@ -1861,6 +1899,7 @@ AC_SUBST(directx_LDFLAGS) ...@@ -1861,6 +1899,7 @@ AC_SUBST(directx_LDFLAGS)
AC_SUBST(dsp_LDFLAGS) AC_SUBST(dsp_LDFLAGS)
AC_SUBST(dvd_LDFLAGS) AC_SUBST(dvd_LDFLAGS)
AC_SUBST(dvdread_LDFLAGS) AC_SUBST(dvdread_LDFLAGS)
AC_SUBST(dvdplay_LDFLAGS)
AC_SUBST(mpeg_ts_dvbpsi_LDFLAGS) AC_SUBST(mpeg_ts_dvbpsi_LDFLAGS)
AC_SUBST(esd_LDFLAGS) AC_SUBST(esd_LDFLAGS)
AC_SUBST(familiar_LDFLAGS) AC_SUBST(familiar_LDFLAGS)
......
...@@ -199,6 +199,9 @@ ...@@ -199,6 +199,9 @@
/* Define if you have the <dvdcss/dvdcss.h> header file. */ /* Define if you have the <dvdcss/dvdcss.h> header file. */
#undef HAVE_DVDCSS_DVDCSS_H #undef HAVE_DVDCSS_DVDCSS_H
/* Define if you have the <dvdplay/dvdplay.h> header file. */
#undef HAVE_DVDPLAY_DVDPLAY_H
/* Define if you have the <dvdread/dvd_reader.h> header file. */ /* Define if you have the <dvdread/dvd_reader.h> header file. */
#undef HAVE_DVDREAD_DVD_READER_H #undef HAVE_DVDREAD_DVD_READER_H
......
This diff is collapsed.
.dep
*.lo
*.o.*
*.lo.*
dvdplay_SOURCES = dvd.c access.c demux.c intf.c es.c tools.c
This diff is collapsed.
/*****************************************************************************
* access.h: send info to access plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: access.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: 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.
*****************************************************************************/
union dvdplay_ctrl_u;
void dvdAccessSendControl( struct input_thread_t *, union dvdplay_ctrl_u * );
/*****************************************************************************
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: demux.c,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: Stphane 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include "interface.h"
#include "dvd.h"
#include "intf.h"
#include "es.h"
/* how many packets dvdplay_Demux will read in each loop */
#define dvdplay_READ_ONCE 64
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* called from outside */
static int dvdplay_Rewind ( struct input_thread_t * );
static int dvdplay_Demux ( struct input_thread_t * );
static int dvdplay_Init ( struct input_thread_t * );
static void dvdplay_End ( struct input_thread_t * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( demux_getfunctions)( function_list_t * p_function_list )
{
#define demux p_function_list->functions.demux
demux.pf_init = dvdplay_Init;
demux.pf_end = dvdplay_End;
demux.pf_demux = dvdplay_Demux;
demux.pf_rewind = dvdplay_Rewind;
#undef demux
}
/*
* Data demux functions
*/
/*****************************************************************************
* dvdplay_Init: initializes dvdplay structures
*****************************************************************************/
static int dvdplay_Init( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
char * psz_intf = NULL;
if( p_input->stream.i_method != INPUT_METHOD_DVD )
{
return -1;
}
p_input->p_demux_data = (void*)p_input->p_access_data;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
psz_intf = config_GetPsz( p_input, "intf" );
config_PutPsz( p_input, "intf", "dvdplay" );
p_dvd->p_intf = intf_Create( p_input );
p_dvd->p_intf->b_block = VLC_FALSE;
intf_RunThread( p_dvd->p_intf );
if( psz_intf != NULL )
{
config_PutPsz( p_input, "intf", psz_intf );
}
return 0;
}
/*****************************************************************************
* dvdplay_End: frees unused data
*****************************************************************************/
static void dvdplay_End( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
intf_thread_t * p_intf = NULL;
p_intf = vlc_object_find( p_input, VLC_OBJECT_INTF, FIND_CHILD );
if( p_intf != NULL )
{
intf_StopThread( p_intf );
vlc_object_detach_all( p_intf );
vlc_object_release( p_intf );
intf_Destroy( p_intf );
}
p_dvd = (dvd_data_t *)p_input->p_demux_data;
p_dvd->p_intf = NULL;
}
/*****************************************************************************
* dvdplay_Demux
*****************************************************************************/
static int dvdplay_Demux( input_thread_t * p_input )
{
dvd_data_t * p_dvd;
data_packet_t * p_data;
ssize_t i_result;
ptrdiff_t i_remains;
int i_data_nb = 0;
p_dvd = (dvd_data_t *)p_input->p_demux_data;
/* Read headers to compute payload length */
do
{
if( ( i_result = input_ReadPS( p_input, &p_data ) ) <= 0)
{
return i_result;
}
i_remains = p_input->p_last_data - p_input->p_current_data;
input_DemuxPS( p_input, p_data );
++i_data_nb;
}
while( i_remains );
// if( p_dvd->b_still && p_dvd->b_end_of_cell && p_dvd->p_intf != NULL )
if( p_dvd->i_still_time && p_dvd->b_end_of_cell && p_dvd->p_intf != NULL )
{
pgrm_descriptor_t * p_pgrm;
/* when we receive still_time flag, we have to pause immediately */
input_SetStatus( p_input, INPUT_STATUS_PAUSE );
dvdIntfStillTime( p_dvd->p_intf, p_dvd->i_still_time );
p_dvd->i_still_time = 0;
vlc_mutex_lock( &p_input->stream.stream_lock );
p_pgrm = p_input->stream.p_selected_program;
p_pgrm->i_synchro_state = SYNCHRO_REINIT;
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ClockManageControl( p_input, p_pgrm, 0 );
}
return i_data_nb;
}
/*****************************************************************************
* dvdplay_Rewind : reads a stream backward
*****************************************************************************/
static int dvdplay_Rewind( input_thread_t * p_input )
{
return( -1 );
}
/*****************************************************************************
* es.h: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: demux.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: 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.
*****************************************************************************/
void dvdplay_DeleteES( struct input_thread_s * );
void dvdplay_Video( struct input_thread_s * );
void dvdplay_Audio( struct input_thread_s * );
void dvdplay_Subp( struct input_thread_s * );
void dvdplay_ES( struct input_thread_s * );
void dvdplay_LaunchDecoders( struct input_thread_s * );
/*****************************************************************************
* dvd.c : dvdplay module for vlc
*****************************************************************************
* This plugins should handle all the known specificities of the DVD format,
* especially the 2048 bytes logical block size.
* It depends on: libdvdplay for ifo files and block reading.
*****************************************************************************
*
* Copyright (C) 2001 VideoLAN
* $Id: dvd.c,v 1.1 2002/07/23 19:56:19 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 <stdlib.h> /* malloc(), free() */
#include <string.h> /* strdup() */
#include <vlc/vlc.h>
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void _M( access_getfunctions)( function_list_t * p_function_list );
void _M( demux_getfunctions)( function_list_t * p_function_list );
void _M( intf_getfunctions)( function_list_t * p_function_list );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_CATEGORY_HINT( "[dvdplay:][device][@[title][,[chapter][,angle]]]", NULL )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "dvdplay input module" )
ADD_CAPABILITY( INTF, 0 )
ADD_CAPABILITY( DEMUX, 0 )
ADD_CAPABILITY( ACCESS, 120 )
ADD_SHORTCUT( "dvd" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
_M( access_getfunctions)( &p_module->p_functions->access );
_M( demux_getfunctions)( &p_module->p_functions->demux );
_M( intf_getfunctions)( &p_module->p_functions->intf );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* dvd.h: structure of the dvdplay plugin
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: Stphane 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
#include <dvdread/nav_read.h>
#include <dvdread/nav_print.h>
#include <dvdplay/dvdplay.h>
#include <dvdplay/info.h>
#include <dvdplay/nav.h>
#include <dvdplay/state.h>
#define LB2OFF(x) ((off_t)(x) * (off_t)(DVD_VIDEO_LB_LEN))
#define OFF2LB(x) ((x) / DVD_VIDEO_LB_LEN)
/*****************************************************************************
* dvd_data_t: structure for communication between dvdplay access, demux
* and intf.
*****************************************************************************/
typedef struct
{
dvdplay_ptr vmg;
intf_thread_t * p_intf;
int i_audio_nb;
int i_spu_nb;
int i_still_time;
vlc_bool_t b_end_of_cell;
dvdplay_event_t event;
dvdplay_ctrl_t control;
} dvd_data_t;
This diff is collapsed.
/*****************************************************************************
* es.h: functions to handle elementary streams.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: es.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: 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.
*****************************************************************************/
void dvdplay_DeleteES( struct input_thread_t * );
void dvdplay_Video( struct input_thread_t * );
void dvdplay_Audio( struct input_thread_t * );
void dvdplay_Subp( struct input_thread_t * );
void dvdplay_ES( struct input_thread_t * );
void dvdplay_LaunchDecoders( struct input_thread_t * );
This diff is collapsed.
/*****************************************************************************
* intf.h: send info to intf.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: 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.
*****************************************************************************/
int dvdIntfStillTime( struct intf_thread_t *, int );
/*****************************************************************************
* tools.c: tools for dvd plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: tools.c,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: Stphane 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <vlc/vlc.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "input_ext-dec.h"
#include "input_ext-plugins.h"
#include "dvd.h"
/*****************************************************************************
* dvdplay_ParseCL: parse command line
*****************************************************************************/
char * dvdplay_ParseCL( input_thread_t * p_input,
int * i_title, int * i_chapter, int * i_angle )
{
dvd_data_t * p_dvd;
struct stat stat_info;
char * psz_parser;
char * psz_source;
char * psz_next;
p_dvd = (dvd_data_t*)(p_input->p_access_data);
psz_parser = psz_source = strdup( p_input->psz_name );
if( !psz_parser )
{
return NULL;
}
while( *psz_parser && *psz_parser != '@' )
{
psz_parser++;
}
*i_title = 0;
*i_chapter = 1;
*i_angle = 1;
if( *psz_parser == '@' )
{
/* Found options */
*psz_parser = '\0';
++psz_parser;
*i_title = (int)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
psz_parser = psz_next + 1;
*i_chapter = (int)strtol( psz_parser, &psz_next, 10 );
if( *psz_next )
{
*i_angle = (int)strtol( psz_next + 1, NULL, 10 );
}
}
}
*i_title = *i_title >= 0 ? *i_title : 0;
*i_chapter = *i_chapter ? *i_chapter : 1;
*i_angle = *i_angle ? *i_angle : 1;
if( !*psz_source )
{
free( psz_source );
if( !p_input->psz_access )
{
return NULL;
}
psz_source = config_GetPsz( p_input, "dvd" );
}
if( stat( psz_source, &stat_info ) == -1 )
{
msg_Err( p_input, "cannot stat() source `%s' (%s)",
psz_source, strerror(errno));
return NULL;
}
if( !S_ISBLK(stat_info.st_mode) &&
!S_ISCHR(stat_info.st_mode) &&
!S_ISDIR(stat_info.st_mode) )
{
msg_Dbg( p_input, "plugin discarded"
" (not a valid source)" );
return NULL;
}
msg_Dbg( p_input, "dvdroot=%s title=%d chapter=%d angle=%d",
psz_source, *i_title, *i_chapter, *i_angle );
return psz_source;
}
/*****************************************************************************
* tools.h: tools for dvdplay plugin.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: tools.h,v 1.1 2002/07/23 19:56:19 stef Exp $
*
* Author: 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.
*****************************************************************************/
char * dvdplay_ParseCL( struct input_thread_t *, int*, int*, int* );
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