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,27 +3307,21 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ...@@ -3307,27 +3307,21 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
cat >> confdefs.h <<EOF cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1 #define $ac_tr_hdr 1
EOF EOF
for ac_hdr in linux/cdrom.h
else
echo "$ac_t""no" 1>&6
fi
done
for ac_hdr in sys/dvdio.h
do do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3321: 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 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3326 "configure" #line 3320 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <$ac_hdr> #include <$ac_hdr>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 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; } { (eval echo configure:3325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3353,48 +3347,8 @@ else ...@@ -3353,48 +3347,8 @@ else
fi fi
done done
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
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 cat > conftest.$ac_ext <<EOF
#line 3366 "configure" #line 3352 "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; }
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
cat > conftest.$ac_ext <<EOF
#line 3398 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <linux/cdrom.h> #include <linux/cdrom.h>
EOF EOF
...@@ -3408,6 +3362,11 @@ EOF ...@@ -3408,6 +3362,11 @@ EOF
fi fi
rm -f conftest* rm -f conftest*
else
echo "$ac_t""no" 1>&6
fi
done
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion "; PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
...@@ -3544,17 +3503,17 @@ if test "${enable_alsa+set}" = set; then ...@@ -3544,17 +3503,17 @@ if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa" enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'` 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 $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 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3553 "configure" #line 3512 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/asoundlib.h> #include <sys/asoundlib.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" 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}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
...@@ -3571,7 +3530,7 @@ fi ...@@ -3571,7 +3530,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 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_%'` ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
...@@ -3579,14 +3538,14 @@ else ...@@ -3579,14 +3538,14 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS" LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 3583 "configure" #line 3542 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
main() main()
; return 0; } ; return 0; }
EOF 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* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
......
...@@ -101,10 +101,9 @@ AC_TYPE_SIZE_T ...@@ -101,10 +101,9 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME AC_HEADER_TIME
dnl Checks for DVD ioctls dnl Checks for DVD ioctls
AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/ioctl.h,
AC_CHECK_HEADERS(sys/dvdio.h) [AC_CHECK_HEADERS(linux/cdrom.h)
AC_CHECK_HEADERS(linux/cdrom.h) AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))])
AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))
dnl default plugins dnl default plugins
PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion "; PLUGINS=${PLUGINS}"ps ts dvd yuv idct idctclassic motion ";
......
...@@ -97,9 +97,6 @@ ...@@ -97,9 +97,6 @@
/* Define if you have the <stddef.h> header file. */ /* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H #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. */ /* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H #undef HAVE_SYS_IOCTL_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling * dvd_css.c: Functions for DVD authentification and unscrambling
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/ioctl.h> #ifdef HAVE_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_DVDIO_H #ifdef HAVE_SYS_DVDIO_H
# include <sys/dvdio.h> # include <sys/dvdio.h>
#endif #endif
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing * dvd_ifo.c: Functions for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "dvd_ifo.h" #include "dvd_ifo.h"
#include "input_dvd.h" #include "input_dvd.h"
void CommandRead( ifo_command_t );
/* /*
* IFO Management. * IFO Management.
*/ */
...@@ -244,9 +246,10 @@ void IfoEnd( ifo_t* p_ifo ) ...@@ -244,9 +246,10 @@ void IfoEnd( ifo_t* p_ifo )
(int)((p_com)->i_dir_cmp), \ (int)((p_com)->i_dir_cmp), \
(int)((p_com)->i_cmp), \ (int)((p_com)->i_cmp), \
(int)((p_com)->i_sub_cmd), \ (int)((p_com)->i_sub_cmd), \
(int)((p_com)->i_v0), \ (int)((p_com)->data.pi_16[0]), \
(int)((p_com)->i_v2), \ (int)((p_com)->data.pi_16[1]), \
(int)((p_com)->i_v4) ); */ \ (int)((p_com)->data.pi_16[2]));*/ \
/* CommandRead( *(p_com) );*/ \
p_ifo->i_pos += 8; \ p_ifo->i_pos += 8; \
} }
...@@ -1115,9 +1118,435 @@ void IfoRead( ifo_t* p_ifo ) ...@@ -1115,9 +1118,435 @@ 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 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]=
{
"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];
}
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 )
{
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 )
{
printf("s[ILL]");
}
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 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;
#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 1:
printf( "to VMG root menu (?)" );
break;
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;
}
}
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 );
}
}
void IfoSetSystem( ifo_command_t com )
{
switch( com.i_cmd )
{
case 1: {
int i;
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 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;
case 3:
if( com.i_direct )
{
printf( "r[0x%02x] = 0x%02x", OP_VAL_8(3)&0x0f, OP_VAL_16(0) );
}
else
{
printf ("r[r[0x%02x]] = r[0x%02x]",
OP_VAL_8(3)&0x0f, OP_VAL_8(1)&0x0f);
}
break;
case 4:
//actually only bits 00011100 00011100 are set
if( com.i_direct )
{
printf ("s[%s] = 0x%02x", ifo_reg[11], OP_VAL_16(1));
}
else
{
printf ("s[%s] = r[0x%02x]", ifo_reg[11], OP_VAL_8(3)&0x0f );
}
break;
case 6:
//actually,
//s[%s]=(r[%s]&0x3FF) | (0x%02x << 0xA);
//but it is way too ugly
if( com.i_direct )
{
printf( "s[%s] = 0x%02x", ifo_reg[8], OP_VAL_8(2)>>2 );
}
else
{
printf( "s[%s] = r[0x%02x]", ifo_reg[8], OP_VAL_8(3)&0x0f );
}
break;
default:
printf ("unknown");
}
}
static void IfoSet( ifo_command_t com )
{
IfoRegister( OP_VAL_16(0), 0 );
printf( " %s ", IfoMath( com.i_cmd ) );
IfoRegister( OP_VAL_16(1), com.i_direct );
}
/***************************************************************************** /*****************************************************************************
* CommandRead : translates the command strings in ifo into command * CommandRead : translates the command strings in ifo into command
* structures. * structures.
...@@ -1128,59 +1557,242 @@ void CommandRead( ifo_command_t com ) ...@@ -1128,59 +1557,242 @@ void CommandRead( ifo_command_t com )
switch( com.i_type ) switch( com.i_type )
{ {
case 0: /* Goto */ /* Goto */
case 0:
/* Main command */
if( !pi_code[1] ) if( !pi_code[1] )
{ {
fprintf( stderr, "NOP\n" ); printf( "NOP\n" );
} }
else if( cmd.i_cmp ) else
{ {
if( com.i_cmp )
{
printf ("if (r[0x%02x] %s ", OP_VAL_8(1)&0x0f,
ifo_cmp[com.i_cmp]);
IfoRegister (OP_VAL_16(1), com.i_dir_cmp);
printf (") ");
} }
/* Sub command */
switch( com.i_sub_cmd )
{
case 1:
printf( "goto Line 0x%02x", OP_VAL_16(2) );
break; break;
case 1: /* Lnk */
case 2:
printf( "stop VM" );
break;
case 3:
printf( "Set Parental Level To %s and goto Line 0x%02x",
ifo_parental[OP_VAL_8(4)&0x7],
OP_VAL_8(5) );
break; break;
case 2: /* SetSystem */
default:
printf( "Illegal" );
break; break;
case 3: /* Set */ }
}
break; break;
case 4: /* */
/* Lnk */
case 1:
/* Main command */
if( !pi_code[1] )
{
printf( "NOP\n" );
}
else
{
if( com.i_direct )
{
if( com.i_cmp )
{
printf( "if (r[0x%02x] %s ", OP_VAL_8(4)&0x0f,
ifo_cmp[com.i_cmp] );
IfoRegister( OP_VAL_8(5), 0 );
printf( ") " );
}
/* Sub command */
IfoJmp( com );
}
else
{
if( com.i_cmp )
{
printf( "if (r[0x%02x] %s ", OP_VAL_8(1)&0x0f,
ifo_cmp[com.i_cmp] );
IfoRegister( OP_VAL_16(1), com.i_dir_cmp );
printf( ") " );
}
/* Sub command */
IfoLnk( com );
}
}
break; break;
case 5: /* */
/* SetSystem */
case 2:
if( !pi_code[1] )
{
IfoSetSystem( com );
}
else if( com.i_cmp && !com.i_sub_cmd )
{
printf ("if (r[0x%02x] %s ", OP_VAL_8(4)&0x0f, ifo_cmp[com.i_cmp]);
IfoRegister( OP_VAL_8(5), 0 );
printf (") ");
IfoSetSystem( com );
}
else if( !com.i_cmp && com.i_sub_cmd )
{
printf( "if (" );
IfoSetSystem( com );
printf( ") " );
IfoLnk( com );
}
else
{
printf("nop");
}
break; break;
case 6: /* */
/* Set */
case 3:
if( ! pi_code[1] )
{
IfoSet( com );
}
else if( com.i_cmp && !com.i_sub_cmd )
{
printf ("if (r[0x%02x] %s ", OP_VAL_8(0)&0x0f, ifo_cmp[com.i_cmp]);
IfoRegister( OP_VAL_16(2), com.i_dir_cmp );
printf (") ");
IfoSet( com );
}
else if( !com.i_cmp && com.i_sub_cmd )
{
printf ("if (");
IfoSet( com );
printf (") ");
IfoLnk( com );
}
else
{
printf( "nop" );
}
break; break;
default:
fprintf( stderr, "Unknown Command\n" ); /*
* math command on r[opcode[1]] and
* direct?be2me_16(OP_VAL_8(0)):reg[OP_VAL_8(1)] is executed
* ( unless command is swap; then r[opcode[1]] and r[OP_VAL_8(1)]
* are swapped )
* boolean operation cmp on r[opcode[1]] and
* dir_cmp?be2me_16(OP_VAL_8(1)[1]):reg[OP_VAL_8(3)] is executed
* on true result, buttons(c[6], c[7]) is called
* problem is 'what is buttons()'
*/
case 4:
printf( "r[0x%X] ", pi_code[1] );
printf( " %s ", IfoMath( com.i_cmd ) );
if( com.i_cmd == 2 )
{
printf( "r[0x%X] ", OP_VAL_8(1) );
}
else
{
IfoRegister( OP_VAL_16(0), com.i_direct );
}
printf("; ");
printf( "if ( r[%d] %s ", pi_code[1], ifo_cmp[com.i_cmp] );
IfoRegister( OP_VAL_8(1), com.i_dir_cmp );
printf( " ) then {" );
IfoAdvanced( &OP_VAL_8(4) );
printf( "}" );
break; break;
/*
* opposite to case 4: boolean, math and buttons.
*/
case 5:
case 6:
printf("if (");
if( !com.i_direct && com.i_dir_cmp )
{
printf( "0x%X", OP_VAL_16(1) );
}
else
{
IfoRegister( OP_VAL_8(3), 0 );
if( OP_VAL_8(3)&0x80 )
{
printf( "s[%s]", ifo_reg[OP_VAL_8(3)&0x1F] );
}
else
{
printf( "r[0x%X]", OP_VAL_8(3)&0x1F);
// 0x1F is either not a mistake,
// or Microsoft programmer's mistake!!!
}
} }
return; printf( " %s r[0x%X] ", ifo_cmp[com.i_cmp],
} com.i_direct ? OP_VAL_8(2) : OP_VAL_8(1) );
printf( " ) then {" );
printf( "r[0x%X] ", pi_code[1] & 0xF );
printf( " %s ", IfoMath( com.i_cmd ) );
/***************************************************************************** if( com.i_cmd == 0x02 ) // swap
* IfoGoto {
*****************************************************************************/ printf("r[0x%X] ", OP_VAL_8(0)&0x1F);
static void IfoGoto( ifo_command_t cmd ) }
{ else
{
if( com.i_direct )
{
printf( "0x%X", OP_VAL_16(0) );
}
else
{
if( OP_VAL_8(0) & 0x80 )
{
printf("s[%s]", ifo_reg[OP_VAL_8(0) & 0x1F] );
}
else
{
printf("r[0x%X]", OP_VAL_8(0) & 0x1F );
}
}
}
printf("; ");
IfoAdvanced( &OP_VAL_8(4) );
printf("}");
return; break;
}
default:
printf( "Unknown Command\n" );
break;
}
/*****************************************************************************
* IfoLnk
*****************************************************************************/
static void IfoLnk( ifo_t* p_ifo )
{
return; return;
} }
/***************************************************************************** /*****************************************************************************
* IfoJmp * CommandPrint : print in clear text (I hope so !) what a command does
*****************************************************************************/ *****************************************************************************/
static void IfoJmp( ifo_t* p_ifo ) void CommandPrint( ifo_t ifo )
{ {
return; return;
} }
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvd_ifo.h: Structures for ifo parsing * dvd_ifo.h: Structures for ifo parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.h,v 1.2 2001/02/08 17:44:12 massiot Exp $ * $Id: dvd_ifo.h,v 1.3 2001/02/09 03:51:42 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -38,9 +38,11 @@ typedef struct ifo_command_s ...@@ -38,9 +38,11 @@ typedef struct ifo_command_s
u8 i_dir_cmp :1; u8 i_dir_cmp :1;
u8 i_cmp :3; u8 i_cmp :3;
u8 i_sub_cmd :4; u8 i_sub_cmd :4;
u16 i_v0 :16; union
u16 i_v2 :16; {
u16 i_v4 :16; u8 pi_8[6];
u16 pi_16[3];
} data;
} ifo_command_t; } ifo_command_t;
/* Program Chain Command Table /* Program Chain Command Table
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* -dvd_udf to find files * -dvd_udf to find files
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.5 2001/02/08 17:44:12 massiot Exp $ * $Id: input_dvd.c,v 1.6 2001/02/09 03:51:42 stef Exp $
* *
* Author: Stphane Borel <stef@via.ecp.fr> * Author: Stphane Borel <stef@via.ecp.fr>
* *
...@@ -176,10 +176,10 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -176,10 +176,10 @@ static void DVDInit( input_thread_t * p_input )
IfoRead( &(p_method->ifo) ); IfoRead( &(p_method->ifo) );
intf_Msg( "Ifo: Initialized" ); intf_Msg( "Ifo: Initialized" );
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
/* CSS authentication and keys */ /* CSS authentication and keys */
if( ( p_method->b_encrypted = DVDCheckCSS( p_input ) ) ) if( ( p_method->b_encrypted = DVDCheckCSS( p_input ) ) )
{ {
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
int i; int i;
p_method->css = CSSInit( p_input->i_handle ); p_method->css = CSSInit( p_input->i_handle );
...@@ -199,8 +199,10 @@ static void DVDInit( input_thread_t * p_input ) ...@@ -199,8 +199,10 @@ static void DVDInit( input_thread_t * p_input )
} }
CSSGetKeys( &(p_method->css) ); CSSGetKeys( &(p_method->css) );
intf_Msg( "CSS: Initialized" ); intf_Msg( "CSS: Initialized" );
} #else
intf_ErrMsg( "Unscrambling not supported" );
#endif #endif
}
/* FIXME: Kludge beginning of vts_01_1.vob */ /* FIXME: Kludge beginning of vts_01_1.vob */
i_start = p_method->ifo.p_vts[0].i_pos + i_start = p_method->ifo.p_vts[0].i_pos +
......
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