Commit 6b14a375 authored by Stéphane Borel's avatar Stéphane Borel

-Some functions to prepare ifo commands utilisation to move in the

structures of DVDs
-Change in configure to avoid compiling css functions on BSD.
parent 71f866bf
......@@ -3307,67 +3307,21 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
for ac_hdr in sys/dvdio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3321: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3326 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
for ac_hdr in linux/cdrom.h
for ac_hdr in linux/cdrom.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3361: checking for $ac_hdr" >&5
echo "configure:3315: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3366 "configure"
#line 3320 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3393,8 +3347,8 @@ else
fi
done
cat > conftest.$ac_ext <<EOF
#line 3398 "configure"
cat > conftest.$ac_ext <<EOF
#line 3352 "configure"
#include "confdefs.h"
#include <linux/cdrom.h>
EOF
......@@ -3408,6 +3362,11 @@ EOF
fi
rm -f conftest*
else
echo "$ac_t""no" 1>&6
fi
done
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
......@@ -3544,17 +3503,17 @@ if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:3548: checking for sys/asoundlib.h" >&5
echo "configure:3507: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3553 "configure"
#line 3512 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3571,7 +3530,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3575: checking for main in -lasound" >&5
echo "configure:3534: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -3579,14 +3538,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3583 "configure"
#line 3542 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......
......@@ -101,10 +101,9 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for DVD ioctls
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/dvdio.h)
AC_CHECK_HEADERS(linux/cdrom.h)
AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))
AC_CHECK_HEADERS(sys/ioctl.h,
[AC_CHECK_HEADERS(linux/cdrom.h)
AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))])
dnl default plugins
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
......
......@@ -97,9 +97,6 @@
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <sys/dvdio.h> header file. */
#undef HAVE_SYS_DVDIO_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
......
......@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.3 2001/02/08 17:44:12 massiot Exp $
* $Id: dvd_css.c,v 1.4 2001/02/09 03:51:42 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -33,7 +33,9 @@
#include <string.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#ifdef HAVE_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_DVDIO_H
# include <sys/dvdio.h>
#endif
......
......@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.3 2001/02/08 17:44:12 massiot Exp $
* $Id: dvd_ifo.c,v 1.4 2001/02/09 03:51:42 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -35,6 +35,8 @@
#include "dvd_ifo.h"
#include "input_dvd.h"
void CommandRead( ifo_command_t );
/*
* IFO Management.
*/
......@@ -244,9 +246,10 @@ void IfoEnd( ifo_t* p_ifo )
(int)((p_com)->i_dir_cmp), \
(int)((p_com)->i_cmp), \
(int)((p_com)->i_sub_cmd), \
(int)((p_com)->i_v0), \
(int)((p_com)->i_v2), \
(int)((p_com)->i_v4) ); */ \
(int)((p_com)->data.pi_16[0]), \
(int)((p_com)->data.pi_16[1]), \
(int)((p_com)->data.pi_16[2]));*/ \
/* CommandRead( *(p_com) );*/ \
p_ifo->i_pos += 8; \
}
......@@ -1115,72 +1118,681 @@ void IfoRead( ifo_t* p_ifo )
}
/*
* IFO virtual machine : a set of commands that give the behaviour of the dvd
* IFO virtual machine : a set of commands that give the
* interactive behaviour of the dvd
*/
#if 0
/*****************************************************************************
* CommandRead : translates the command strings in ifo into command
* structures.
*****************************************************************************/
void CommandRead( ifo_command_t com )
#if 1
#define OP_VAL_16(i) (ntoh16( com.data.pi_16[i]))
#define OP_VAL_8(i) ((com.data.pi_8[i]))
static char ifo_reg[][80]=
{
u8* pi_code = (u8*)(&com);
"Menu_Language_Code",
"Audio_Stream_#",
"SubPicture_Stream_#",
"Angle_#",
"VTS_#",
"VTS_Title_#",
"PGC_#",
"PTT_#",
"Highlighted_Button_#",
"Nav_Timer",
"TimedPGC",
"Karaoke_audio_mixing_mode",
"Parental_mgmt_country_code",
"Parental_Level",
"Player_Video_Cfg",
"Player_Audio_Cfg",
"Audio_language_code_setting",
"Audio_language_extension_code",
"SPU_language_code_setting",
"SPU_language_extension_code",
"?Player_Regional_Code",
"Reserved_21",
"Reserved_22",
"Reserved_23"
};
static char * IfoMath( char val )
{
static char math_op[][10] =
{
"none",
"=",
"<->", // swap
"+=",
"-=",
"*=",
"/=",
"%=",
"rnd", // rnd
"&=",
"|=",
"^=",
"??", // invalid
"??", // invalid
"??", // invalid
"??" // invalid
};
return (char *) math_op[val & 0x0f];
}
switch( com.i_type )
char ifo_cmp[][10] =
{
"none",
"&&",
"==",
"!=",
">=",
">",
"<",
"<="
};
char ifo_parental[][10] =
{
"0",
"G",
"2",
"PG",
"PG-13",
"5",
"R",
"NC-17"
};
char ifo_menu_id[][80] =
{
"-0-",
"-1-",
"Title (VTS menu)",
"Root",
"Sub-Picture",
"Audio",
"Angle",
"Part of Title",
};
char * IfoMenuName( char index )
{
return ifo_menu_id[index&0x07];
}
static void IfoRegister( u16 i_data, u8 i_direct)
{
if( i_direct )
{
case 0: /* Goto */
if( !pi_code[1] )
if( 0/*isalpha( i_data >> 8 & 0xff )*/ )
{
printf("'%c%c'", i_data>>8&0xff, i_data&0xff);
}
else
{
printf("0x%02x", i_data);
}
}
else
{
if( i_data & 0x80 )
{
i_data &= 0x1f;
if( i_data > 0x17 )
{
fprintf( stderr, "NOP\n" );
printf("s[ILL]");
}
else if( cmd.i_cmp )
else
{
printf("s[%s]", ifo_reg[i_data]);
}
}
else
{
i_data &= 0x1f;
if( i_data > 0xf )
{
printf("r[ILL]");
}
else
{
printf("r[0x%02x]", i_data);
}
}
}
}
static void IfoAdvanced( u8 *pi_code )
{
u8 i_cmd = pi_code[0];
printf(" { ");
if( pi_code[1]>>2 )
{
printf( " Highlight button %d; ", pi_code[1]>>2 );
}
if( i_cmd == 0xff )
{
printf( " Illegal " );
}
if( i_cmd == 0x00 )
{
printf( "ReSuME %d", pi_code[7] );
}
else if( ( i_cmd & 0x06) == 0x02 )
{ // XX01Y
printf ("Link to %s cell ", ( i_cmd & 0x01 ) ? "prev" : "next");
}
else
{
printf( "advanced (0x%02x) ", i_cmd );
}
printf(" } ");
}
static void IfoJmp( ifo_command_t com )
{
printf ("jmp ");
switch( com.i_sub_cmd )
{
case 0x01:
printf( "Exit" );
break;
case 0x02:
printf( "VTS 0x%02x", OP_VAL_8(3) );
break;
case 0x03:
printf( "This VTS Title 0x%02x", OP_VAL_8(3) );
break;
case 0x05:
printf( "This VTS Title 0x%02x Part 0x%04x",
OP_VAL_8(3),
OP_VAL_8(0)<<8|OP_VAL_8(1));
break;
case 0x06:
#if 0
printf ("in SystemSpace ");
switch (OP_VAL_8(3)>>4) {
case 0x00:
printf ("to play first PGC");
break;
case 0x01: {
printf ("to menu \"%s\"", decode_menuname (OP_VAL_8(3)));
}
break;
case 0x02:
printf ("to VTS 0x%02x and TTN 0x%02x", OP_VAL_8(1), OP_VAL_8(2));
break;
case 0x03:
printf ("to VMGM PGC number 0x%02x", OP_VAL_8(0)<<8 | OP_VAL_8(1));
break;
case 0x08:
printf ("vts 0x%02x lu 0x%02x menu \"%s\"", OP_VAL_8(2), OP_VAL_8(1), decode_menuname (OP_VAL_8(3)));
break;
#else
switch( OP_VAL_8(3)>>6 )
{
case 0x00:
printf( "to play first PGC" );
break;
case 0x01:
printf( "to VMG title menu (?)" );
break;
case 1: /* Lnk */
break;
case 2: /* SetSystem */
break;
case 3: /* Set */
break;
case 4: /* */
case 0x02:
printf( "vts 0x%02x lu 0x%02x menu \"%s\"",
OP_VAL_8(2),
OP_VAL_8(1),
IfoMenuName( OP_VAL_8(3)&0xF ) );
break;
case 0x03:
printf( "vmg pgc 0x%04x (?)", ( OP_VAL_8(0)<<8) | OP_VAL_8(1) );
break;
case 5: /* */
#endif
}
break;
case 0x08:
#if 0
switch(OP_VAL_8(3)>>4) {
case 0x00:
printf ("system first pgc");
break;
case 0x01:
printf ("system title menu");
break;
case 0x02:
printf ("system menu \"%s\"", decode_menuname (OP_VAL_8(3)));
break;
case 0x03:
printf ("system vmg pgc %02x ????", OP_VAL_8(0)<<8|OP_VAL_8(1));
break;
case 0x08:
printf ("system lu 0x%02x menu \"%s\"", OP_VAL_8(2), decode_menuname (OP_VAL_8(3)));
break;
case 0x0c:
printf ("system vmg pgc 0x%02x", OP_VAL_8(0)<<8|OP_VAL_8(1));
break;
}
#else
// OP_VAL_8(2) is number of cell
// it is processed BEFORE switch
// under some conditions, it is ignored
// I don't understand exactly what it means
printf( " ( spec cell 0x%02X ) ", OP_VAL_8(2) );
switch( OP_VAL_8(3)>>6 )
{
case 0:
printf( "to FP PGC" );
break;
case 6: /* */
case 1:
printf( "to VMG root menu (?)" );
break;
default:
fprintf( stderr, "Unknown Command\n" );
case 2:
printf( "to VTS menu \"%s\" (?)",
IfoMenuName(OP_VAL_8(3)&0xF) );
break;
case 3:
printf( "vmg pgc 0x%02x (?)", (OP_VAL_8(0)<<8)|OP_VAL_8(1) );
break;
}
#endif
break;
}
}
return;
static void IfoLnk( ifo_command_t com )
{
u16 i_button=OP_VAL_8(4)>>2;
printf ("lnk to ");
switch( com.i_sub_cmd )
{
case 0x01:
IfoAdvanced( &OP_VAL_8(4) );
break;
case 0x04:
printf( "PGC 0x%02x", OP_VAL_16(2) );
break;
case 0x05:
printf( "PTT 0x%02x", OP_VAL_16(2) );
break;
case 0x06:
printf( "Program 0x%02x this PGC", OP_VAL_8(5) );
break;
case 0x07:
printf( "Cell 0x%02x this PGC", OP_VAL_8(5) );
break;
default:
return;
}
if( i_button )
{
printf( ", Highlight 0x%02x", OP_VAL_8(4)>>2 );
}
}
/*****************************************************************************
* IfoGoto
*****************************************************************************/
static void IfoGoto( ifo_command_t cmd )
void IfoSetSystem( ifo_command_t com )
{
switch( com.i_cmd )
{
case 1: {
int i;
return;
for( i=1; i<=3; i++ )
{
if( OP_VAL_8(i)&0x80 )
{
if( com.i_direct )
{
printf ("s[%s] = 0x%02x;", ifo_reg[i], OP_VAL_8(i)&0xf);
}
else
{
printf ("s[%s] = r[0x%02x];", ifo_reg[i], OP_VAL_8(i)&0xf);
}
}
}
#if 0
if(op->direct) {
if(OP_VAL_8(1]&0x80)
printf ("s[%s] = 0x%02x;", reg_name[1], OP_VAL_8(1]&0xf);
if(OP_VAL_8(2)&0x80)
//DENT: lwhat about 0x7f here ???
printf ("s[%s] = 0x%02x;", reg_name[2], OP_VAL_8(2)&0x7f);
if(OP_VAL_8(3)&0x80)
printf ("s[%s] = 0x%02x;", reg_name[3], OP_VAL_8(3)&0xf);
} else {
if(OP_VAL_8(1)&0x80)
printf ("s[%s] = r[0x%02x];", reg_name[1], OP_VAL_8(1)&0xf);
if(OP_VAL_8(2)&0x80)
printf ("s[%s] = r[0x%02x];", reg_name[2], OP_VAL_8(2)&0xf);
if(OP_VAL_8(3)&0x80)
printf ("s[%s] = r[0x%02x];", reg_name[3], OP_VAL_8(3)&0xf);
}
#endif
}
break;
case 2:
if( com.i_direct )
{
printf( "s[%s] = 0x%02x", ifo_reg[9], OP_VAL_16(0) );
}
else
{
printf( "s[%s] = r[0x%02x]", ifo_reg[9], OP_VAL_8(1)&0x0f );
}
printf( "s[%s] = (s[%s]&0x7FFF)|0x%02x",
ifo_reg[10], ifo_reg[10], OP_VAL_16(1)&0x8000);
break;