MPlayer-cvslog
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2005
- 19 participants
- 170 discussions
CVS: main/libmpdvdkit2 common.h, 1.6, 1.7 css.c, 1.9, 1.10 device.c, 1.9, 1.10 error.c, 1.6, 1.7 libdvdcss.c, 1.15, 1.16
by syncmail@mplayerhq.hu 01 Oct '05
by syncmail@mplayerhq.hu 01 Oct '05
01 Oct '05
CVS change done by Diego Biurrun CVS
Update of /cvsroot/mplayer/main/libmpdvdkit2
In directory mail:/var2/tmp/cvs-serv2348
Modified Files:
common.h css.c device.c error.c libdvdcss.c
Log Message:
modification notices according to GPL 2a
Index: common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/common.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- common.h 1 Oct 2005 17:19:33 -0000 1.6
+++ common.h 1 Oct 2005 17:58:37 -0000 1.7
@@ -3,6 +3,9 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
+ *
+ * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
+ * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Samuel Hocevar <sam(a)via.ecp.fr>
Index: css.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/css.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- css.c 1 Oct 2005 17:19:33 -0000 1.9
+++ css.c 1 Oct 2005 17:58:37 -0000 1.10
@@ -2,6 +2,9 @@
* css.c: Functions for DVD authentication and descrambling
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
+ *
+ * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
+ * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Stéphane Borel <stef(a)via.ecp.fr>
Index: device.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/device.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- device.c 1 Oct 2005 17:19:33 -0000 1.9
+++ device.c 1 Oct 2005 17:58:37 -0000 1.10
@@ -2,6 +2,9 @@
* device.h: DVD device access
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
+ *
+ * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
+ * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Stéphane Borel <stef(a)via.ecp.fr>
Index: error.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/error.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- error.c 1 Oct 2005 17:19:33 -0000 1.6
+++ error.c 1 Oct 2005 17:58:37 -0000 1.7
@@ -2,6 +2,9 @@
* error.c: error management functions
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
+ *
+ * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
+ * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Author: Samuel Hocevar <sam(a)zoy.org>
Index: libdvdcss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/libdvdcss.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- libdvdcss.c 1 Oct 2005 17:19:33 -0000 1.15
+++ libdvdcss.c 1 Oct 2005 17:58:37 -0000 1.16
@@ -5,6 +5,9 @@
* Håkan Hjort <d95hjort(a)dtek.chalmers.se>
*
* Copyright (C) 1998-2002 VideoLAN
+ *
+ * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
+ * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* This program is free software; you can redistribute it and/or modify
1
0
01 Oct '05
CVS change done by Diego Biurrun CVS
Update of /cvsroot/mplayer/main/libmpdvdkit2
In directory mail:/var2/tmp/cvs-serv23110/libmpdvdkit2
Modified Files:
FILES bsdi_dvd.h bsdi_ioctl.c common.h css.c css.h csstables.h
device.c device.h dvdcss.h error.c ioctl.c ioctl.h libdvdcss.c
libdvdcss.h libdvdcss_changes.diff
Log Message:
upgrade to libdvdcss 1.2.9
Index: FILES
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/FILES,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FILES 28 Jul 2005 12:20:10 -0000 1.1
+++ FILES 1 Oct 2005 17:19:33 -0000 1.2
@@ -23,7 +23,7 @@
nav_read.h
nav_types.h
-libdvdcss 1.2.8:
+libdvdcss 1.2.9:
----------------
bsdi_dvd.h
bsdi_ioctl.c
Index: bsdi_ioctl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/bsdi_ioctl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- bsdi_ioctl.c 1 Mar 2005 06:41:41 -0000 1.4
+++ bsdi_ioctl.c 1 Oct 2005 17:19:33 -0000 1.5
@@ -4,10 +4,6 @@
* Hacked version of the linux cdrom.c kernel module - everything except the
* DVD handling ripped out and the rest rewritten to use raw SCSI commands
* on BSD/OS 4.2 (but should work with earlier versions as well).
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
- * $Id$
*/
#include <sys/types.h>
Index: common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/common.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- common.h 1 Mar 2005 06:41:41 -0000 1.5
+++ common.h 1 Oct 2005 17:19:33 -0000 1.6
@@ -3,9 +3,6 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Samuel Hocevar <sam(a)via.ecp.fr>
@@ -42,6 +39,8 @@
# define PATH_MAX MAX_PATH
#endif
+#define lseek _lseeki64
+
/* several type definitions */
# if defined( __MINGW32__ )
# if !defined( _OFF_T_ )
Index: css.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/css.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- css.c 1 Mar 2005 06:41:41 -0000 1.8
+++ css.c 1 Oct 2005 17:19:33 -0000 1.9
@@ -1,19 +1,17 @@
/*****************************************************************************
* css.c: Functions for DVD authentication and descrambling
*****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
+ * Copyright (C) 1999-2003 VideoLAN
* $Id$
*
- * Author: Stéphane Borel <stef(a)via.ecp.fr>
- * Håkan Hjort <d95hjort(a)dtek.chalmers.se>
+ * Authors: Stéphane Borel <stef(a)via.ecp.fr>
+ * Håkan Hjort <d95hjort(a)dtek.chalmers.se>
*
* based on:
* - css-auth by Derek Fawcus <derek(a)spider.com>
* - DVD CSS ioctls example program by Andrew T. Veliath <andrewtv(a)usa.net>
* - The Divide and conquer attack by Frank A. Stevenson <frank(a)funcom.com>
+ * (see http://www-2.cs.cmu.edu/~dst/DeCSS/FrankStevenson/index.html)
* - DeCSSPlus by Ethan Hawke
* - DecVOB
* see http://www.lemuria.org/DeCSS/ by Tom Vogt for more information.
@@ -43,9 +41,9 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+# include <unistd.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
+# include <limits.h>
#include "dvdcss.h"
@@ -59,6 +57,8 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
+static void PrintKey ( dvdcss_t, char *, uint8_t const * );
+
static int GetBusKey ( dvdcss_t );
static int GetASF ( dvdcss_t );
@@ -66,7 +66,7 @@
static void DecryptKey ( uint8_t,
uint8_t const *, uint8_t const *, uint8_t * );
-static int DecryptDiscKey ( uint8_t const *, dvd_key_t );
+static int DecryptDiscKey ( dvdcss_t, uint8_t const *, dvd_key_t );
static int CrackDiscKey ( dvdcss_t, uint8_t * );
static void DecryptTitleKey ( dvd_key_t, dvd_key_t );
@@ -91,24 +91,25 @@
#ifdef WIN32
if( i_ret < 0 )
{
- /* Maybe we didn't have enough priviledges to read the copyright
+ /* Maybe we didn't have enough privileges to read the copyright
* (see ioctl_ReadCopyright comments).
* Apparently, on unencrypted DVDs _dvdcss_disckey() always fails, so
- * we can check this as a work-around. */
+ * we can check this as a workaround. */
i_ret = 0;
+ i_copyright = 1;
if( _dvdcss_disckey( dvdcss ) < 0 )
+ {
i_copyright = 0;
- else
- i_copyright = 1;
+ }
}
#endif
if( i_ret < 0 )
{
/* Since it's the first ioctl we try to issue, we add a notice */
- _dvdcss_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
- "make sure there is a DVD in the drive, and that "
- "you have used the correct device node." );
+ print_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
+ "make sure there is a DVD in the drive, and that "
+ "you have used the correct device node." );
return i_ret;
}
@@ -117,167 +118,6 @@
}
/*****************************************************************************
- * GetBusKey : Go through the CSS Authentication process
- *****************************************************************************
- * It simulates the mutual authentication between logical unit and host,
- * and stops when a session key (called bus key) has been established.
- * Always do the full auth sequence. Some drives seem to lie and always
- * respond with ASF=1. For instance the old DVD roms on Compaq Armada says
- * that ASF=1 from the start and then later fail with a 'read of scrambled
- * block without authentication' error.
- *****************************************************************************/
-static int GetBusKey( dvdcss_t dvdcss )
-{
- uint8_t p_buffer[10];
- uint8_t p_challenge[2*KEY_SIZE];
- dvd_key_t p_key1;
- dvd_key_t p_key2;
- dvd_key_t p_key_check;
- uint8_t i_variant = 0;
- char psz_warning[80];
- int i_ret = -1;
- int i;
-
- _dvdcss_debug( dvdcss, "requesting AGID" );
- i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
-
- /* We might have to reset hung authentication processes in the drive
- by invalidating the corresponding AGID'. As long as we haven't got
- an AGID, invalidate one (in sequence) and try again. */
- for( i = 0; i_ret == -1 && i < 4 ; ++i )
- {
- sprintf( psz_warning,
- "ioctl ReportAgid failed, invalidating AGID %d", i );
- _dvdcss_debug( dvdcss, psz_warning );
-
- /* This is really _not good_, should be handled by the OS.
- Invalidating an AGID could make another process fail some
- where in it's authentication process. */
- dvdcss->css.i_agid = i;
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
-
- _dvdcss_debug( dvdcss, "requesting AGID" );
- i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- }
-
- /* Unable to authenticate without AGID */
- if( i_ret == -1 )
- {
- _dvdcss_error( dvdcss, "ioctl ReportAgid failed, fatal" );
- return -1;
- }
-
- /* Setup a challenge, any values should work */
- for( i = 0 ; i < 10; ++i )
- {
- p_challenge[i] = i;
- }
-
- /* Get challenge from host */
- for( i = 0 ; i < 10 ; ++i )
- {
- p_buffer[9-i] = p_challenge[i];
- }
-
- /* Send challenge to LU */
- if( ioctl_SendChallenge( dvdcss->i_fd,
- &dvdcss->css.i_agid, p_buffer ) < 0 )
- {
- _dvdcss_error( dvdcss, "ioctl SendChallenge failed" );
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- return -1;
- }
-
- /* Get key1 from LU */
- if( ioctl_ReportKey1( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0)
- {
- _dvdcss_error( dvdcss, "ioctl ReportKey1 failed" );
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- return -1;
- }
-
- /* Send key1 to host */
- for( i = 0 ; i < KEY_SIZE ; i++ )
- {
- p_key1[i] = p_buffer[4-i];
- }
-
- for( i = 0 ; i < 32 ; ++i )
- {
- CryptKey( 0, i, p_challenge, p_key_check );
-
- if( memcmp( p_key_check, p_key1, KEY_SIZE ) == 0 )
- {
- snprintf( psz_warning, sizeof(psz_warning),
- "drive authenticated, using variant %d", i );
- _dvdcss_debug( dvdcss, psz_warning );
- i_variant = i;
- break;
- }
- }
-
- if( i == 32 )
- {
- _dvdcss_error( dvdcss, "drive would not authenticate" );
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- return -1;
- }
-
- /* Get challenge from LU */
- if( ioctl_ReportChallenge( dvdcss->i_fd,
- &dvdcss->css.i_agid, p_buffer ) < 0 )
- {
- _dvdcss_error( dvdcss, "ioctl ReportKeyChallenge failed" );
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- return -1;
- }
-
- /* Send challenge to host */
- for( i = 0 ; i < 10 ; ++i )
- {
- p_challenge[i] = p_buffer[9-i];
- }
-
- CryptKey( 1, i_variant, p_challenge, p_key2 );
-
- /* Get key2 from host */
- for( i = 0 ; i < KEY_SIZE ; ++i )
- {
- p_buffer[4-i] = p_key2[i];
- }
-
- /* Send key2 to LU */
- if( ioctl_SendKey2( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 )
- {
- _dvdcss_error( dvdcss, "ioctl SendKey2 failed" );
- ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
- return -1;
- }
-
- /* The drive has accepted us as authentic. */
- _dvdcss_debug( dvdcss, "authentication established" );
-
- memcpy( p_challenge, p_key1, KEY_SIZE );
- memcpy( p_challenge + KEY_SIZE, p_key2, KEY_SIZE );
-
- CryptKey( 2, i_variant, p_challenge, dvdcss->css.p_bus_key );
-
- return 0;
-}
-
-/*****************************************************************************
- * PrintKey : debug function that dumps a key value
- *****************************************************************************/
-static void PrintKey( dvdcss_t dvdcss, char *prefix, uint8_t const *data )
-{
- char psz_output[80];
-
- sprintf( psz_output, "%s%02x:%02x:%02x:%02x:%02x", prefix,
- data[0], data[1], data[2], data[3], data[4] );
- _dvdcss_debug( dvdcss, psz_output );
-}
-
-/*****************************************************************************
* _dvdcss_title: crack or decrypt the current title key if needed
*****************************************************************************
* This function should only be called by dvdcss->pf_seek and should eventually
@@ -322,13 +162,27 @@
if( i_fd >= 0 )
{
- if( read( i_fd, p_title_key, 5 ) == 5 )
+ unsigned char psz_key[KEY_SIZE * 3];
+ unsigned int k0, k1, k2, k3, k4;
+
+ psz_key[KEY_SIZE * 3 - 1] = '\0';
+
+ if( read( i_fd, psz_key, KEY_SIZE * 3 - 1 ) == KEY_SIZE * 3 - 1
+ && sscanf( psz_key, "%x:%x:%x:%x:%x",
+ &k0, &k1, &k2, &k3, &k4 ) == 5 )
{
- _dvdcss_debug( dvdcss, "key found in cache" );
+ p_title_key[0] = k0;
+ p_title_key[1] = k1;
+ p_title_key[2] = k2;
+ p_title_key[3] = k3;
+ p_title_key[4] = k4;
+ PrintKey( dvdcss, "title key found in cache ", p_title_key );
+
/* Don't try to save it again */
b_cache = 0;
i_ret = 1;
}
+
close( i_fd );
}
}
@@ -340,24 +194,30 @@
if( i_ret < 0 )
{
- _dvdcss_error( dvdcss, "fatal error in vts css key" );
+ print_error( dvdcss, "fatal error in vts css key" );
return i_ret;
}
if( i_ret == 0 )
{
- _dvdcss_debug( dvdcss, "unencrypted title" );
+ print_debug( dvdcss, "unencrypted title" );
/* We cache this anyway, so we don't need to check again. */
}
}
/* Key is valid, we store it on disk. */
- if( b_cache )
+ if( dvdcss->psz_cachefile[0] && b_cache )
{
- i_fd = open( dvdcss->psz_cachefile, O_RDWR|O_CREAT|O_EXCL, 0644 );
+ i_fd = open( dvdcss->psz_cachefile, O_RDWR|O_CREAT, 0644 );
if( i_fd >= 0 )
{
- write( i_fd, p_title_key, 5 );
+ unsigned char psz_key[KEY_SIZE * 3 + 2];
+
+ sprintf( psz_key, "%02x:%02x:%02x:%02x:%02x\r\n",
+ p_title_key[0], p_title_key[1], p_title_key[2],
+ p_title_key[3], p_title_key[4] );
+
+ write( i_fd, psz_key, KEY_SIZE * 3 + 1 );
close( i_fd );
}
}
@@ -420,7 +280,7 @@
/* Get encrypted disc key */
if( ioctl_ReadDiscKey( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 )
{
- _dvdcss_error( dvdcss, "ioctl ReadDiscKey failed" );
+ print_error( dvdcss, "ioctl ReadDiscKey failed" );
return -1;
}
@@ -428,32 +288,33 @@
if( GetASF( dvdcss ) != 1 )
{
/* Region mismatch (or region not set) is the most likely source. */
- _dvdcss_error( dvdcss,
- "ASF not 1 after reading disc key (region mismatch?)" );
+ print_error( dvdcss,
+ "ASF not 1 after reading disc key (region mismatch?)" );
ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
return -1;
}
- /* Decrypt disc key using bus key */
+ /* Shuffle disc key using bus key */
for( i = 0 ; i < DVD_DISCKEY_SIZE ; i++ )
{
p_buffer[ i ] ^= dvdcss->css.p_bus_key[ 4 - (i % KEY_SIZE) ];
}
+ /* Decrypt disc key */
switch( dvdcss->i_method )
{
case DVDCSS_METHOD_KEY:
/* Decrypt disc key with player key. */
- _dvdcss_debug( dvdcss, "decrypting disc key with player keys" );
- if( ! DecryptDiscKey( p_buffer, p_disc_key ) )
+ PrintKey( dvdcss, "decrypting disc key ", p_buffer );
+ if( ! DecryptDiscKey( dvdcss, p_buffer, p_disc_key ) )
{
PrintKey( dvdcss, "decrypted disc key is ", p_disc_key );
break;
}
- _dvdcss_debug( dvdcss, "failed to decrypt the disc key, "
- "faulty drive/kernel? "
- "cracking title keys instead" );
+ print_debug( dvdcss, "failed to decrypt the disc key, "
+ "faulty drive/kernel? "
+ "cracking title keys instead" );
/* Fallback, but not to DISC as the disc key might be faulty */
dvdcss->i_method = DVDCSS_METHOD_TITLE;
@@ -462,22 +323,21 @@
case DVDCSS_METHOD_DISC:
/* Crack Disc key to be able to use it */
- _dvdcss_debug( dvdcss, "cracking disc key from key hash ..."
- " this will take some time" );
memcpy( p_disc_key, p_buffer, KEY_SIZE );
+ PrintKey( dvdcss, "cracking disc key ", p_disc_key );
if( ! CrackDiscKey( dvdcss, p_disc_key ) )
{
PrintKey( dvdcss, "cracked disc key is ", p_disc_key );
break;
}
- _dvdcss_debug( dvdcss, "failed to crack the disc key" );
+ print_debug( dvdcss, "failed to crack the disc key" );
memset( p_disc_key, 0, KEY_SIZE );
dvdcss->i_method = DVDCSS_METHOD_TITLE;
break;
default:
- _dvdcss_debug( dvdcss, "disc key needs not be decrypted" );
+ print_debug( dvdcss, "disc key needs not be decrypted" );
memset( p_disc_key, 0, KEY_SIZE );
break;
}
@@ -504,7 +364,8 @@
* read the title key and decrypt it.
*/
- _dvdcss_debug( dvdcss, "getting title key the classic way" );
+ print_debug( dvdcss, "getting title key at block %i the classic way",
+ i_pos );
/* We need to authenticate again every time to get a new session key */
if( GetBusKey( dvdcss ) < 0 )
@@ -516,8 +377,8 @@
if( ioctl_ReadTitleKey( dvdcss->i_fd, &dvdcss->css.i_agid,
i_pos, p_key ) < 0 )
{
- _dvdcss_debug( dvdcss,
- "ioctl ReadTitleKey failed (region mismatch?)" );
+ print_debug( dvdcss,
+ "ioctl ReadTitleKey failed (region mismatch?)" );
i_ret = -1;
}
@@ -526,7 +387,7 @@
{
case -1:
/* An error getting the ASF status, something must be wrong. */
- _dvdcss_debug( dvdcss, "lost ASF requesting title key" );
+ print_debug( dvdcss, "lost ASF requesting title key" );
ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
i_ret = -1;
break;
@@ -534,7 +395,7 @@
case 0:
/* This might either be a title that has no key,
* or we encountered a region error. */
- _dvdcss_debug( dvdcss, "lost ASF requesting title key" );
+ print_debug( dvdcss, "lost ASF requesting title key" );
break;
case 1:
@@ -565,7 +426,9 @@
}
else
{
+ PrintKey( dvdcss, "initial disc key ", dvdcss->css.p_disc_key );
DecryptTitleKey( dvdcss->css.p_disc_key, p_key );
+ PrintKey( dvdcss, "decrypted title key ", p_key );
i_ret = 1;
}
@@ -577,7 +440,7 @@
}
/* The title key request failed */
- _dvdcss_debug( dvdcss, "resetting drive and cracking title key" );
+ print_debug( dvdcss, "resetting drive and cracking title key" );
/* Read an unscrambled sector and reset the drive */
dvdcss->pf_seek( dvdcss, 0 );
@@ -612,39 +475,195 @@
uint8_t *p_end = p_sec + DVDCSS_BLOCK_SIZE;
/* PES_scrambling_control */
- if( p_sec[0x14] & 0x30)
+ if( !(p_sec[0x14] & 0x30) )
{
- i_t1 = (p_key[0] ^ p_sec[0x54]) | 0x100;
- i_t2 = p_key[1] ^ p_sec[0x55];
- i_t3 = (p_key[2] | (p_key[3] << 8) |
- (p_key[4] << 16)) ^ (p_sec[0x56] |
- (p_sec[0x57] << 8) | (p_sec[0x58] << 16));
- i_t4 = i_t3 & 7;
- i_t3 = i_t3 * 2 + 8 - i_t4;
- p_sec += 0x80;
- i_t5 = 0;
+ return 0;
+ }
+
+ i_t1 = (p_key[0] ^ p_sec[0x54]) | 0x100;
+ i_t2 = p_key[1] ^ p_sec[0x55];
+ i_t3 = (p_key[2] | (p_key[3] << 8) |
+ (p_key[4] << 16)) ^ (p_sec[0x56] |
+ (p_sec[0x57] << 8) | (p_sec[0x58] << 16));
+ i_t4 = i_t3 & 7;
+ i_t3 = i_t3 * 2 + 8 - i_t4;
+ p_sec += 0x80;
+ i_t5 = 0;
+
+ while( p_sec != p_end )
+ {
+ i_t4 = p_css_tab2[i_t2] ^ p_css_tab3[i_t1];
+ i_t2 = i_t1>>1;
+ i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
+ i_t4 = p_css_tab5[i_t4];
+ i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
+ i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
+ i_t3 = (i_t3 << 8 ) | i_t6;
+ i_t6 = p_css_tab4[i_t6];
+ i_t5 += i_t6 + i_t4;
+ *p_sec = p_css_tab1[*p_sec] ^ ( i_t5 & 0xff );
+ p_sec++;
+ i_t5 >>= 8;
+ }
- while( p_sec != p_end )
+ return 0;
+}
+
+/* Following functions are local */
+
+/*****************************************************************************
+ * GetBusKey : Go through the CSS Authentication process
+ *****************************************************************************
+ * It simulates the mutual authentication between logical unit and host,
+ * and stops when a session key (called bus key) has been established.
+ * Always do the full auth sequence. Some drives seem to lie and always
+ * respond with ASF=1. For instance the old DVD roms on Compaq Armada says
+ * that ASF=1 from the start and then later fail with a 'read of scrambled
+ * block without authentication' error.
+ *****************************************************************************/
+static int GetBusKey( dvdcss_t dvdcss )
+{
+ uint8_t p_buffer[10];
+ uint8_t p_challenge[2*KEY_SIZE];
+ dvd_key_t p_key1;
+ dvd_key_t p_key2;
+ dvd_key_t p_key_check;
+ uint8_t i_variant = 0;
+ int i_ret = -1;
+ int i;
+
+ print_debug( dvdcss, "requesting AGID" );
+ i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+
+ /* We might have to reset hung authentication processes in the drive
+ * by invalidating the corresponding AGID'. As long as we haven't got
+ * an AGID, invalidate one (in sequence) and try again. */
+ for( i = 0; i_ret == -1 && i < 4 ; ++i )
+ {
+ print_debug( dvdcss, "ioctl ReportAgid failed, "
+ "invalidating AGID %d", i );
+
+ /* This is really _not good_, should be handled by the OS.
+ * Invalidating an AGID could make another process fail somewhere
+ * in its authentication process. */
+ dvdcss->css.i_agid = i;
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+
+ print_debug( dvdcss, "requesting AGID" );
+ i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ }
+
+ /* Unable to authenticate without AGID */
+ if( i_ret == -1 )
+ {
+ print_error( dvdcss, "ioctl ReportAgid failed, fatal" );
+ return -1;
+ }
+
+ /* Setup a challenge, any values should work */
+ for( i = 0 ; i < 10; ++i )
+ {
+ p_challenge[i] = i;
+ }
+
+ /* Get challenge from host */
+ for( i = 0 ; i < 10 ; ++i )
+ {
+ p_buffer[9-i] = p_challenge[i];
+ }
+
+ /* Send challenge to LU */
+ if( ioctl_SendChallenge( dvdcss->i_fd,
+ &dvdcss->css.i_agid, p_buffer ) < 0 )
+ {
+ print_error( dvdcss, "ioctl SendChallenge failed" );
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ return -1;
+ }
+
+ /* Get key1 from LU */
+ if( ioctl_ReportKey1( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0)
+ {
+ print_error( dvdcss, "ioctl ReportKey1 failed" );
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ return -1;
+ }
+
+ /* Send key1 to host */
+ for( i = 0 ; i < KEY_SIZE ; i++ )
+ {
+ p_key1[i] = p_buffer[4-i];
+ }
+
+ for( i = 0 ; i < 32 ; ++i )
+ {
+ CryptKey( 0, i, p_challenge, p_key_check );
+
+ if( memcmp( p_key_check, p_key1, KEY_SIZE ) == 0 )
{
- i_t4 = p_css_tab2[i_t2] ^ p_css_tab3[i_t1];
- i_t2 = i_t1>>1;
- i_t1 = ( ( i_t1 & 1 ) << 8 ) ^ i_t4;
- i_t4 = p_css_tab5[i_t4];
- i_t6 = ((((((( i_t3 >> 3 ) ^ i_t3 ) >> 1 ) ^
- i_t3 ) >> 8 ) ^ i_t3 ) >> 5 ) & 0xff;
- i_t3 = (i_t3 << 8 ) | i_t6;
- i_t6 = p_css_tab4[i_t6];
- i_t5 += i_t6 + i_t4;
- *p_sec = p_css_tab1[*p_sec] ^ ( i_t5 & 0xff );
- p_sec++;
- i_t5 >>= 8;
+ print_debug( dvdcss, "drive authenticated, using variant %d", i );
+ i_variant = i;
+ break;
}
}
+ if( i == 32 )
+ {
+ print_error( dvdcss, "drive would not authenticate" );
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ return -1;
+ }
+
+ /* Get challenge from LU */
+ if( ioctl_ReportChallenge( dvdcss->i_fd,
+ &dvdcss->css.i_agid, p_buffer ) < 0 )
+ {
+ print_error( dvdcss, "ioctl ReportKeyChallenge failed" );
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ return -1;
+ }
+
+ /* Send challenge to host */
+ for( i = 0 ; i < 10 ; ++i )
+ {
+ p_challenge[i] = p_buffer[9-i];
+ }
+
+ CryptKey( 1, i_variant, p_challenge, p_key2 );
+
+ /* Get key2 from host */
+ for( i = 0 ; i < KEY_SIZE ; ++i )
+ {
+ p_buffer[4-i] = p_key2[i];
+ }
+
+ /* Send key2 to LU */
+ if( ioctl_SendKey2( dvdcss->i_fd, &dvdcss->css.i_agid, p_buffer ) < 0 )
+ {
+ print_error( dvdcss, "ioctl SendKey2 failed" );
+ ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
+ return -1;
+ }
+
+ /* The drive has accepted us as authentic. */
+ print_debug( dvdcss, "authentication established" );
+
+ memcpy( p_challenge, p_key1, KEY_SIZE );
+ memcpy( p_challenge + KEY_SIZE, p_key2, KEY_SIZE );
+
+ CryptKey( 2, i_variant, p_challenge, dvdcss->css.p_bus_key );
+
return 0;
}
-/* Following functions are local */
+/*****************************************************************************
+ * PrintKey : debug function that dumps a key value
+ *****************************************************************************/
+static void PrintKey( dvdcss_t dvdcss, char *prefix, uint8_t const *data )
+{
+ print_debug( dvdcss, "%s%02x:%02x:%02x:%02x:%02x", prefix,
+ data[0], data[1], data[2], data[3], data[4] );
+}
/*****************************************************************************
* GetASF : Get Authentication success flag
@@ -661,17 +680,17 @@
if( ioctl_ReportASF( dvdcss->i_fd, NULL, &i_asf ) != 0 )
{
/* The ioctl process has failed */
- _dvdcss_error( dvdcss, "GetASF fatal error" );
+ print_error( dvdcss, "GetASF fatal error" );
return -1;
}
if( i_asf )
{
- _dvdcss_debug( dvdcss, "GetASF authenticated, ASF=1" );
+ print_debug( dvdcss, "GetASF authenticated, ASF=1" );
}
else
{
- _dvdcss_debug( dvdcss, "GetASF not authenticated, ASF=0" );
+ print_debug( dvdcss, "GetASF not authenticated, ASF=0" );
}
return i_asf;
@@ -945,57 +964,66 @@
}
/*****************************************************************************
+ * player_keys: alternate DVD player keys
+ *****************************************************************************
+ * These player keys were generated using Frank A. Stevenson's PlayerKey
+ * cracker. A copy of his article can be found here:
+ * http://www-2.cs.cmu.edu/~dst/DeCSS/FrankStevenson/mail2.txt
+ *****************************************************************************/
+static const dvd_key_t player_keys[] =
+{
+ { 0x01, 0xaf, 0xe3, 0x12, 0x80 },
+ { 0x12, 0x11, 0xca, 0x04, 0x3b },
+ { 0x14, 0x0c, 0x9e, 0xd0, 0x09 },
+ { 0x14, 0x71, 0x35, 0xba, 0xe2 },
+ { 0x1a, 0xa4, 0x33, 0x21, 0xa6 },
+ { 0x26, 0xec, 0xc4, 0xa7, 0x4e },
+ { 0x2c, 0xb2, 0xc1, 0x09, 0xee },
+ { 0x2f, 0x25, 0x9e, 0x96, 0xdd },
+ { 0x33, 0x2f, 0x49, 0x6c, 0xe0 },
+ { 0x35, 0x5b, 0xc1, 0x31, 0x0f },
+ { 0x36, 0x67, 0xb2, 0xe3, 0x85 },
+ { 0x39, 0x3d, 0xf1, 0xf1, 0xbd },
+ { 0x3b, 0x31, 0x34, 0x0d, 0x91 },
+ { 0x45, 0xed, 0x28, 0xeb, 0xd3 },
+ { 0x48, 0xb7, 0x6c, 0xce, 0x69 },
+ { 0x4b, 0x65, 0x0d, 0xc1, 0xee },
+ { 0x4c, 0xbb, 0xf5, 0x5b, 0x23 },
+ { 0x51, 0x67, 0x67, 0xc5, 0xe0 },
+ { 0x53, 0x94, 0xe1, 0x75, 0xbf },
+ { 0x57, 0x2c, 0x8b, 0x31, 0xae },
+ { 0x63, 0xdb, 0x4c, 0x5b, 0x4a },
+ { 0x7b, 0x1e, 0x5e, 0x2b, 0x57 },
+ { 0x85, 0xf3, 0x85, 0xa0, 0xe0 },
+ { 0xab, 0x1e, 0xe7, 0x7b, 0x72 },
+ { 0xab, 0x36, 0xe3, 0xeb, 0x76 },
+ { 0xb1, 0xb8, 0xf9, 0x38, 0x03 },
+ { 0xb8, 0x5d, 0xd8, 0x53, 0xbd },
+ { 0xbf, 0x92, 0xc3, 0xb0, 0xe2 },
+ { 0xcf, 0x1a, 0xb2, 0xf8, 0x0a },
+ { 0xec, 0xa0, 0xcf, 0xb3, 0xff },
+ { 0xfc, 0x95, 0xa9, 0x87, 0x35 }
+};
+
+/*****************************************************************************
* DecryptDiscKey
*****************************************************************************
- * Decryption of the disc key with player keys if they are available.
- * Try to decrypt the disc key from every position with every player key.
+ * Decryption of the disc key with player keys: try to decrypt the disc key
+ * from every position with every player key.
* p_struct_disckey: the 2048 byte DVD_STRUCT_DISCKEY data
* p_disc_key: result, the 5 byte disc key
*****************************************************************************/
-static int DecryptDiscKey( uint8_t const *p_struct_disckey,
+static int DecryptDiscKey( dvdcss_t dvdcss, uint8_t const *p_struct_disckey,
dvd_key_t p_disc_key )
{
uint8_t p_verify[KEY_SIZE];
unsigned int i, n = 0;
- static const dvd_key_t player_keys[] =
- {
- { 0x01, 0xaf, 0xe3, 0x12, 0x80 },
- { 0x12, 0x11, 0xca, 0x04, 0x3b },
- { 0x14, 0x0c, 0x9e, 0xd0, 0x09 },
- { 0x14, 0x71, 0x35, 0xba, 0xe2 },
- { 0x1a, 0xa4, 0x33, 0x21, 0xa6 },
- { 0x26, 0xec, 0xc4, 0xa7, 0x4e },
- { 0x2c, 0xb2, 0xc1, 0x09, 0xee },
- { 0x2f, 0x25, 0x9e, 0x96, 0xdd },
- { 0x33, 0x2f, 0x49, 0x6c, 0xe0 },
- { 0x35, 0x5b, 0xc1, 0x31, 0x0f },
- { 0x36, 0x67, 0xb2, 0xe3, 0x85 },
- { 0x39, 0x3d, 0xf1, 0xf1, 0xbd },
- { 0x3b, 0x31, 0x34, 0x0d, 0x91 },
- { 0x45, 0xed, 0x28, 0xeb, 0xd3 },
- { 0x48, 0xb7, 0x6c, 0xce, 0x69 },
- { 0x4b, 0x65, 0x0d, 0xc1, 0xee },
- { 0x4c, 0xbb, 0xf5, 0x5b, 0x23 },
- { 0x51, 0x67, 0x67, 0xc5, 0xe0 },
- { 0x53, 0x94, 0xe1, 0x75, 0xbf },
- { 0x57, 0x2c, 0x8b, 0x31, 0xae },
- { 0x63, 0xdb, 0x4c, 0x5b, 0x4a },
- { 0x7b, 0x1e, 0x5e, 0x2b, 0x57 },
- { 0x85, 0xf3, 0x85, 0xa0, 0xe0 },
- { 0xab, 0x1e, 0xe7, 0x7b, 0x72 },
- { 0xab, 0x36, 0xe3, 0xeb, 0x76 },
- { 0xb1, 0xb8, 0xf9, 0x38, 0x03 },
- { 0xb8, 0x5d, 0xd8, 0x53, 0xbd },
- { 0xbf, 0x92, 0xc3, 0xb0, 0xe2 },
- { 0xcf, 0x1a, 0xb2, 0xf8, 0x0a },
- { 0xec, 0xa0, 0xcf, 0xb3, 0xff },
- { 0xfc, 0x95, 0xa9, 0x87, 0x35 }
- };
-
/* Decrypt disc key with the above player keys */
- while( n < sizeof(player_keys) / sizeof(dvd_key_t) )
+ for( n = 0; n < sizeof(player_keys) / sizeof(dvd_key_t); n++ )
{
+ PrintKey( dvdcss, "trying player key ", player_keys[n] );
+
for( i = 1; i < 409; i++ )
{
/* Check if player key n is the right key for position i. */
@@ -1013,7 +1041,6 @@
return 0;
}
}
- n++;
}
/* Have tried all combinations of positions and keys,
@@ -1076,13 +1103,10 @@
unsigned int* BigTable; /* LFSR2 startstate indexed by
* 1,2,5 output byte */
- _dvdcss_debug( dvdcss, "cracking disc key" );
-
/*
* Prepare tables for hash reversal
*/
-
/* initialize lookup tables for k[1] */
K1table = malloc( 65536 * K1TABLEWIDTH );
memset( K1table, 0 , 65536 * K1TABLEWIDTH );
@@ -1104,7 +1128,7 @@
/*
if( tmp4 == K1TABLEWIDTH )
{
- _dvdcss_debug( dvdcss, "Table disaster %d", tmp4 );
+ print_debug( dvdcss, "Table disaster %d", tmp4 );
}
*/
if( tmp4 < K1TABLEWIDTH )
@@ -1125,7 +1149,7 @@
tmp3 = 0;
- _dvdcss_debug( dvdcss, "initializing the big table" );
+ print_debug( dvdcss, "initializing the big table" );
for( i = 0 ; i < 16777216 ; i++ )
{
@@ -1376,7 +1400,7 @@
/******************************************************************************
- * Various pices for the title crack engine.
+ * Various pieces for the title crack engine.
******************************************************************************
* The length of the PES packet is located at 0x12-0x13.
* The the copyrigth protection bits are located at 0x14 (bits 0x20 and 0x10).
@@ -1408,7 +1432,7 @@
int b_read_error = 0;
int i_ret;
- _dvdcss_debug( dvdcss, "cracking title key" );
+ print_debug( dvdcss, "cracking title key at block %i", i_pos );
i_tries = 0;
i_success = 0;
@@ -1419,7 +1443,7 @@
if( i_ret != i_pos )
{
- _dvdcss_error( dvdcss, "seek failed" );
+ print_error( dvdcss, "seek failed" );
}
i_ret = dvdcss_read( dvdcss, p_buf, 1, DVDCSS_NOFLAGS );
@@ -1430,12 +1454,12 @@
{
if( i_ret == 0 )
{
- _dvdcss_debug( dvdcss, "read returned 0 (end of device?)" );
+ print_debug( dvdcss, "read returned 0 (end of device?)" );
}
else if( !b_read_error )
{
- _dvdcss_debug( dvdcss, "read error, resorting to secret "
- "arcanes to recover" );
+ print_debug( dvdcss, "read error at block %i, resorting to "
+ "secret arcanes to recover", i_pos );
/* Reset the drive before trying to continue */
_dvdcss_close( dvdcss );
@@ -1452,12 +1476,13 @@
* For now, allow all blocks that begin with a start code. */
if( memcmp( p_buf, p_packstart, 3 ) )
{
- _dvdcss_debug( dvdcss, "non MPEG block found (end of title)" );
+ print_debug( dvdcss, "non MPEG block found at block %i "
+ "(end of title)", i_pos );
break;
}
if( p_buf[0x0d] & 0x07 )
- _dvdcss_debug( dvdcss, "stuffing in pack header" );
+ print_debug( dvdcss, "stuffing in pack header" );
/* PES_scrambling_control does not exist in a system_header,
* a padding_stream or a private_stream2 (and others?). */
@@ -1486,7 +1511,7 @@
/* Emit a progress indication now and then. */
if( !( i_reads & 0xfff ) )
{
- _dvdcss_debug( dvdcss, "still cracking..." );
+ print_debug( dvdcss, "at block %i, still cracking...", i_pos );
}
/* Stop after 2000 blocks if we haven't seen any encrypted blocks. */
@@ -1496,27 +1521,23 @@
if( !b_stop_scanning )
{
- _dvdcss_debug( dvdcss, "end of title reached" );
+ print_debug( dvdcss, "end of title reached" );
}
- { /* Print some statistics. */
- char psz_info[128];
- snprintf( psz_info, sizeof(psz_info),
- "%d of %d attempts successful, %d of %d blocks scrambled",
- i_success, i_tries, i_encrypted, i_reads );
- _dvdcss_debug( dvdcss, psz_info );
- }
+ /* Print some statistics. */
+ print_debug( dvdcss, "successful attempts %d/%d, scrambled blocks %d/%d",
+ i_success, i_tries, i_encrypted, i_reads );
if( i_success > 0 /* b_stop_scanning */ )
{
- _dvdcss_debug( dvdcss, "vts key initialized" );
+ print_debug( dvdcss, "vts key initialized" );
return 1;
}
if( i_encrypted == 0 && i_reads > 0 )
{
memset( p_titlekey, 0, KEY_SIZE );
- _dvdcss_debug( dvdcss, "file was unscrambled" );
+ print_debug( dvdcss, "no scrambled sectors found" );
return 0;
}
Index: device.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- device.c 7 Jun 2005 13:36:21 -0000 1.8
+++ device.c 1 Oct 2005 17:19:33 -0000 1.9
@@ -2,9 +2,6 @@
* device.h: DVD device access
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Stéphane Borel <stef(a)via.ecp.fr>
@@ -34,11 +31,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+# include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
+# include <unistd.h>
+# include <limits.h>
#if defined( WIN32 ) && !defined( SYS_CYGWIN )
# include <io.h> /* read() */
@@ -129,12 +127,9 @@
int _dvdcss_open ( dvdcss_t dvdcss )
{
- char psz_debug[200];
char const *psz_device = dvdcss->psz_device;
- snprintf( psz_debug, 199, "opening target `%s'", psz_device );
- psz_debug[199] = '\0';
- _dvdcss_debug( dvdcss, psz_debug );
+ print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
dvdcss->b_file = 1;
@@ -149,7 +144,7 @@
if( !dvdcss->b_file && WIN2K )
{
- _dvdcss_debug( dvdcss, "using Win2K API for access" );
+ print_debug( dvdcss, "using Win2K API for access" );
dvdcss->pf_seek = win2k_seek;
dvdcss->pf_read = win2k_read;
dvdcss->pf_readv = win_readv;
@@ -157,7 +152,7 @@
}
else if( !dvdcss->b_file )
{
- _dvdcss_debug( dvdcss, "using ASPI for access" );
+ print_debug( dvdcss, "using ASPI for access" );
dvdcss->pf_seek = aspi_seek;
dvdcss->pf_read = aspi_read;
dvdcss->pf_readv = win_readv;
@@ -166,7 +161,7 @@
else
#endif
{
- _dvdcss_debug( dvdcss, "using libc for access" );
+ print_debug( dvdcss, "using libc for access" );
dvdcss->pf_seek = libc_seek;
dvdcss->pf_read = libc_read;
dvdcss->pf_readv = libc_readv;
@@ -181,7 +176,9 @@
if( dvdcss->i_raw_fd == -1 )
{
- _dvdcss_error( dvdcss, "failed opening raw device, continuing" );
+ print_debug( dvdcss, "cannot open %s (%s)",
+ psz_device, strerror(errno) );
+ print_error( dvdcss, "failed to open raw device, but continuing" );
return -1;
}
else
@@ -250,7 +247,9 @@
if( dvdcss->i_fd == -1 )
{
- _dvdcss_error( dvdcss, "failed opening device" );
+ print_debug( dvdcss, "cannot open %s (%s)",
+ psz_device, strerror(errno) );
+ print_error( dvdcss, "failed to open device" );
return -1;
}
@@ -287,7 +286,7 @@
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
{
- _dvdcss_error( dvdcss, "failed opening device" );
+ print_error( dvdcss, "failed opening device" );
return -1;
}
@@ -310,7 +309,7 @@
hASPI = LoadLibrary( "wnaspi32.dll" );
if( hASPI == NULL )
{
- _dvdcss_error( dvdcss, "unable to load wnaspi32.dll" );
+ print_error( dvdcss, "unable to load wnaspi32.dll" );
return -1;
}
@@ -319,7 +318,7 @@
if(lpGetSupport == NULL || lpSendCommand == NULL )
{
- _dvdcss_error( dvdcss, "unable to get aspi function pointers" );
+ print_error( dvdcss, "unable to get aspi function pointers" );
FreeLibrary( hASPI );
return -1;
}
@@ -328,14 +327,14 @@
if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS )
{
- _dvdcss_error( dvdcss, "no ASPI adapters found" );
+ print_error( dvdcss, "no ASPI adapters found" );
FreeLibrary( hASPI );
return -1;
}
if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP )
{
- _dvdcss_error( dvdcss, "unable to initalize aspi layer" );
+ print_error( dvdcss, "unable to initalize aspi layer" );
FreeLibrary( hASPI );
return -1;
}
@@ -343,7 +342,7 @@
i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) );
if( i_hostadapters == 0 )
{
- _dvdcss_error( dvdcss, "no ASPI adapters ready" );
+ print_error( dvdcss, "no ASPI adapters ready" );
FreeLibrary( hASPI );
return -1;
}
@@ -351,7 +350,7 @@
fd = malloc( sizeof( struct w32_aspidev ) );
if( fd == NULL )
{
- _dvdcss_error( dvdcss, "not enough memory" );
+ print_error( dvdcss, "not enough memory" );
FreeLibrary( hASPI );
return -1;
}
@@ -402,7 +401,7 @@
{
free( (void*) fd );
FreeLibrary( hASPI );
- _dvdcss_error( dvdcss,"this is not a cdrom drive" );
+ print_error( dvdcss,"this is not a cdrom drive" );
return -1;
}
}
@@ -411,7 +410,7 @@
free( (void*) fd );
FreeLibrary( hASPI );
- _dvdcss_error( dvdcss, "unable to get haid and target (aspi)" );
+ print_error( dvdcss, "unable to get haid and target (aspi)" );
return -1;
}
#endif
@@ -429,12 +428,12 @@
return i_blocks;
}
- i_seek = lseek( dvdcss->i_read_fd,
- (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE, SEEK_SET );
+ i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+ i_seek = lseek( dvdcss->i_read_fd, i_seek, SEEK_SET );
if( i_seek < 0 )
{
- _dvdcss_error( dvdcss, "seek error" );
+ print_error( dvdcss, "seek error" );
dvdcss->i_pos = -1;
return i_seek;
}
@@ -511,20 +510,20 @@
*****************************************************************************/
static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
- off_t i_ret;
+ off_t i_size, i_ret;
- i_ret = read( dvdcss->i_read_fd, p_buffer,
- (off_t)i_blocks * DVDCSS_BLOCK_SIZE );
+ i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+ i_ret = read( dvdcss->i_read_fd, p_buffer, i_size );
if( i_ret < 0 )
{
- _dvdcss_error( dvdcss, "read error" );
+ print_error( dvdcss, "read error" );
dvdcss->i_pos = -1;
return i_ret;
}
/* Handle partial reads */
- if( i_ret != (off_t)i_blocks * DVDCSS_BLOCK_SIZE )
+ if( i_ret != i_size )
{
int i_seek;
@@ -667,7 +666,7 @@
dvdcss->p_readv_buffer = malloc( dvdcss->i_readv_buf_size );
if( !dvdcss->p_readv_buffer )
{
- _dvdcss_error( dvdcss, " failed (readv)" );
+ print_error( dvdcss, " failed (readv)" );
dvdcss->i_pos = -1;
return -1;
}
Index: dvdcss.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/dvdcss.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dvdcss.h 1 Mar 2005 06:41:41 -0000 1.4
+++ dvdcss.h 1 Oct 2005 17:19:33 -0000 1.5
@@ -10,9 +10,6 @@
/*
* Copyright (C) 1998-2002 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* This program is free software; you can redistribute it and/or modify
@@ -70,8 +67,6 @@
*/
extern dvdcss_t dvdcss_open ( char *psz_target );
extern int dvdcss_close ( dvdcss_t );
-extern int dvdcss_title ( dvdcss_t,
- int i_block );
extern int dvdcss_seek ( dvdcss_t,
int i_blocks,
int i_flags );
Index: error.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/error.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- error.c 1 Mar 2005 06:41:41 -0000 1.5
+++ error.c 1 Oct 2005 17:19:33 -0000 1.6
@@ -2,9 +2,6 @@
* error.c: error management functions
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Author: Samuel Hocevar <sam(a)zoy.org>
@@ -28,7 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <limits.h>
+# include <limits.h>
#include "dvdcss.h"
@@ -39,7 +36,7 @@
/*****************************************************************************
* Error messages
*****************************************************************************/
-void _dvdcss_error( dvdcss_t dvdcss, char *psz_string )
+void _print_error( dvdcss_t dvdcss, char *psz_string )
{
if( dvdcss->b_errors )
{
@@ -52,11 +49,13 @@
/*****************************************************************************
* Debug messages
*****************************************************************************/
-void _dvdcss_debug( dvdcss_t dvdcss, char *psz_string )
+#if 0
+void _print_debug( dvdcss_t dvdcss, char *psz_string )
{
if( dvdcss->b_debug )
{
fprintf( stderr, "libdvdcss debug: %s\n", psz_string );
}
}
+#endif
Index: ioctl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/ioctl.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ioctl.c 1 Mar 2005 06:41:41 -0000 1.8
+++ ioctl.c 1 Oct 2005 17:19:33 -0000 1.9
@@ -2,9 +2,6 @@
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* Authors: Markus Kuespert <ltlBeBoy(a)beosmail.com>
@@ -1912,44 +1909,60 @@
* for execution
*****************************************************************************
* When available, this function uses the function smedia_uscsi_cmd()
- * from solaris' libsmedia library (solaris 9 or newer) to execute the
+ * from Solaris' libsmedia library (Solaris 9 or newer) to execute the
* USCSI command. smedia_uscsi_cmd() allows USCSI commands for
- * non-root users on removable media devices on solaris 9; sending the
+ * non-root users on removable media devices on Solaris 9; sending the
* USCSI command directly to the device using the USCSICMD ioctl fails
- * with an EPERM error on solaris 9.
+ * with an EPERM error on Solaris 9.
*
* The code will fall back to the USCSICMD ioctl method, when
* libsmedia.so is not available or does not export the
- * smedia_uscsi_cmd() function (on solaris releases upto and including
- * solaris 8). Fortunatelly, on these old releases non-root users are
+ * smedia_uscsi_cmd() function (on Solaris releases upto and including
+ * Solaris 8). Fortunatelly, on these old releases non-root users are
* allowed to perform USCSICMD ioctls on removable media devices.
*****************************************************************************/
-static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc ) {
- void *sm_hdl;
- static int initialized;
- static void* (*sm_get_handle)(int32_t);
- static int (*sm_release_handle)(void*);
- static int (*sm_uscsi_cmd)(void*, struct uscsi_cmd *);
-
- if (!initialized)
- {
- void *smedia_lib;
-
- smedia_lib = dlopen("libsmedia.so", RTLD_NOW);
- if (smedia_lib) {
- sm_get_handle = dlsym(smedia_lib, "smedia_get_handle");
- sm_release_handle = dlsym(smedia_lib, "smedia_release_handle");
- sm_uscsi_cmd = dlsym(smedia_lib, "smedia_uscsi_cmd");
- }
- initialized = 1;
- }
-
- if (sm_get_handle && sm_uscsi_cmd && sm_release_handle
- && (sm_hdl = sm_get_handle(i_fd)))
- {
- int i_ret = sm_uscsi_cmd(sm_hdl, p_sc);
- sm_release_handle(sm_hdl);
- return i_ret;
+static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc )
+{
+ void *p_handle;
+
+ /* We use static variables to keep track of the libsmedia symbols, which
+ * is harmless even in a multithreaded program because the library and
+ * its symbols will always be mapped at the same address. */
+ static int b_tried = 0;
+ static int b_have_sm = 0;
+ static void * (*p_get_handle) ( int32_t );
+ static int (*p_uscsi_cmd) ( void *, struct uscsi_cmd * );
+ static int (*p_release_handle) ( void * );
+
+ if( !b_tried )
+ {
+ void *p_lib;
+
+ p_lib = dlopen( "libsmedia.so", RTLD_NOW );
+ if( p_lib )
+ {
+ p_get_handle = dlsym( p_lib, "smedia_get_handle" );
+ p_uscsi_cmd = dlsym( p_lib, "smedia_uscsi_cmd" );
+ p_release_handle = dlsym( p_lib, "smedia_release_handle" );
+
+ if( p_get_handle && p_uscsi_cmd && p_release_handle )
+ {
+ b_have_sm = 1;
+ }
+ else
+ {
+ dlclose( p_lib );
+ }
+ }
+
+ b_tried = 1;
+ }
+
+ if( b_have_sm && (p_handle = p_get_handle(i_fd)) )
+ {
+ int i_ret = p_uscsi_cmd( p_handle, p_sc );
+ p_release_handle( p_handle );
+ return i_ret;
}
return ioctl( i_fd, USCSICMD, p_sc );
Index: libdvdcss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/libdvdcss.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- libdvdcss.c 1 Mar 2005 06:41:41 -0000 1.14
+++ libdvdcss.c 1 Oct 2005 17:19:33 -0000 1.15
@@ -5,9 +5,6 @@
* Håkan Hjort <d95hjort(a)dtek.chalmers.se>
*
* Copyright (C) 1998-2002 VideoLAN
- *
- * Modified for use with MPlayer, changes contained in libdvdcss_changes.diff.
- * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
* $Id$
*
* This program is free software; you can redistribute it and/or modify
@@ -25,7 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
-/*
+/**
* \mainpage libdvdcss developer documentation
*
* \section intro Introduction
@@ -105,8 +102,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-#include <unistd.h>
-#include <limits.h>
+# include <unistd.h>
+# include <limits.h>
#include "dvdcss.h"
@@ -192,7 +189,7 @@
{
int i = atoi( psz_verbose );
- if( i >= 2 ) dvdcss->b_debug = 1;
+ if( i >= 2 ) dvdcss->b_debug = i;
if( i >= 1 ) dvdcss->b_errors = 1;
}
@@ -215,27 +212,108 @@
}
else
{
- _dvdcss_error( dvdcss, "unknown decrypt method, please choose "
- "from 'title', 'key' or 'disc'" );
+ print_error( dvdcss, "unknown decrypt method, please choose "
+ "from 'title', 'key' or 'disc'" );
free( dvdcss->psz_device );
free( dvdcss );
return NULL;
}
}
+#if 0 /* MPlayer caches keys in its own configuration directory */
+
+ /*
+ * If DVDCSS_CACHE was not set, try to guess a default value
+ */
+ if( psz_cache == NULL || psz_cache[0] == '\0' )
+ {
+#ifdef HAVE_DIRECT_H
+ typedef HRESULT( WINAPI *SHGETFOLDERPATH )
+ ( HWND, int, HANDLE, DWORD, LPTSTR );
+
+# define CSIDL_FLAG_CREATE 0x8000
+# define CSIDL_APPDATA 0x1A
+# define SHGFP_TYPE_CURRENT 0
+
+ char psz_home[MAX_PATH];
+ HINSTANCE p_dll;
+ SHGETFOLDERPATH p_getpath;
+
+ *psz_home = '\0';
+
+ /* Load the shfolder dll to retrieve SHGetFolderPath */
+ p_dll = LoadLibrary( "shfolder.dll" );
+ if( p_dll )
+ {
+ p_getpath = (void*)GetProcAddress( p_dll, "SHGetFolderPathA" );
+ if( p_getpath )
+ {
+ /* Get the "Application Data" folder for the current user */
+ if( p_getpath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
+ NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK )
+ {
+ FreeLibrary( p_dll );
+ }
+ else
+ {
+ *psz_home = '\0';
+ }
+ }
+ FreeLibrary( p_dll );
+ }
+
+ /* Cache our keys in
+ * C:\Documents and Settings\$USER\Application Data\dvdcss\ */
+ if( *psz_home )
+ {
+ snprintf( psz_buffer, PATH_MAX, "%s/dvdcss", psz_home );
+ psz_buffer[PATH_MAX-1] = '\0';
+ psz_cache = psz_buffer;
+ }
+#else
+ char *psz_home = NULL;
+# ifdef HAVE_PWD_H
+ struct passwd *p_pwd;
+
+ /* Try looking in password file for home dir. */
+ p_pwd = getpwuid(getuid());
+ if( p_pwd )
+ {
+ psz_home = p_pwd->pw_dir;
+ }
+# endif
+
+ if( psz_home == NULL )
+ {
+ psz_home = getenv( "HOME" );
+ }
+
+ /* Cache our keys in ${HOME}/.dvdcss/ */
+ if( psz_home )
+ {
+ snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
+ psz_buffer[PATH_MAX-1] = '\0';
+ psz_cache = psz_buffer;
+ }
+#endif
+ }
+
+#endif /* 0 */
+
/*
* Find cache dir from the DVDCSS_CACHE environment variable
*/
if( psz_cache != NULL )
{
- if( psz_cache[0] == '\0' )
+ if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
{
psz_cache = NULL;
}
/* Check that we can add the ID directory and the block filename */
- else if( strlen( psz_cache ) + 1 + 32 + 1 + 10 + 1 > PATH_MAX )
+ else if( strlen( psz_cache ) + 1 + 32 + 1 + (KEY_SIZE * 2) + 10 + 1
+ > PATH_MAX )
{
- _dvdcss_error( dvdcss, "cache directory name is too long" );
+ print_error( dvdcss, "cache directory name is too long" );
psz_cache = NULL;
}
}
@@ -261,14 +339,14 @@
if( i_ret < 0 )
{
/* Disable the CSS ioctls and hope that it works? */
- _dvdcss_debug( dvdcss,
- "could not check whether the disc was scrambled" );
+ print_debug( dvdcss,
+ "could not check whether the disc was scrambled" );
dvdcss->b_ioctls = 0;
}
else
{
- _dvdcss_debug( dvdcss, i_ret ? "disc is scrambled"
- : "disc is unscrambled" );
+ print_debug( dvdcss, i_ret ? "disc is scrambled"
+ : "disc is unscrambled" );
dvdcss->b_scrambled = i_ret;
}
}
@@ -287,11 +365,31 @@
}
}
+ /* If the cache is enabled, write the cache directory tag */
+ if( psz_cache )
+ {
+ char *psz_tag = "Signature: 8a477f597d28d172789f06886806bc55\r\n"
+ "# This file is a cache directory tag created by libdvdcss.\r\n"
+ "# For information about cache directory tags, see:\r\n"
+ "# http://www.brynosaurus.com/cachedir/\r\n";
+ unsigned char psz_tagfile[PATH_MAX+1+12+1];
+ int i_fd;
+
+ sprintf( psz_tagfile, "%s/CACHEDIR.TAG", psz_cache );
+ i_fd = open( psz_tagfile, O_RDWR|O_CREAT, 0644 );
+ if( i_fd >= 0 )
+ {
+ write( i_fd, psz_tag, strlen(psz_tag) );
+ close( i_fd );
+ }
+ }
+
/* If the cache is enabled, extract a unique disc ID */
if( psz_cache )
{
uint8_t p_sector[DVDCSS_BLOCK_SIZE];
unsigned char psz_debug[PATH_MAX+30];
+ unsigned char psz_key[1 + KEY_SIZE * 2 + 1];
unsigned char * psz_title, * psz_serial;
int i;
@@ -358,15 +456,33 @@
{
if( psz_serial[i] < '0' || psz_serial[i] > '9' )
{
- sprintf( psz_serial,
- "%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X",
+ unsigned char psz_tmp[16 + 1];
+ sprintf( psz_tmp,
+ "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
psz_serial[0], psz_serial[1], psz_serial[2],
psz_serial[3], psz_serial[4], psz_serial[5],
psz_serial[6], psz_serial[7] );
+ memcpy( psz_serial, psz_tmp, 16 );
break;
}
}
+ /* Get disk key, since some discs have got same title, manufacturing
+ * date and serial number, but different keys */
+ if( dvdcss->b_scrambled )
+ {
+ psz_key[0] = '-';
+ for( i = 0; i < KEY_SIZE; i++ )
+ {
+ sprintf( &psz_key[1+i*2], "%.2x", dvdcss->css.p_disc_key[i] );
+ }
+ psz_key[1 + KEY_SIZE * 2] = '\0';
+ }
+ else
+ {
+ psz_key[0] = 0;
+ }
+
/* We have a disc name or ID, we can create the cache dir */
i = sprintf( dvdcss->psz_cachefile, "%s", psz_cache );
#if !defined( WIN32 ) || defined( SYS_CYGWIN )
@@ -376,14 +492,14 @@
#endif
if( i_ret < 0 && errno != EEXIST )
{
- _dvdcss_error( dvdcss, "failed creating cache directory" );
+ print_error( dvdcss, "failed creating cache directory" );
dvdcss->psz_cachefile[0] = '\0';
goto nocache;
}
i += sprintf( dvdcss->psz_cachefile + i, "/");
// i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data );
- i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
+ i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
#if !defined( WIN32 ) || defined( SYS_CYGWIN )
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
#else
@@ -391,7 +507,7 @@
#endif
if( i_ret < 0 && errno != EEXIST )
{
- _dvdcss_error( dvdcss, "failed creating cache subdirectory" );
+ print_error( dvdcss, "failed creating cache subdirectory" );
dvdcss->psz_cachefile[0] = '\0';
goto nocache;
}
@@ -402,7 +518,7 @@
sprintf( psz_debug, "using CSS key cache dir: %s",
dvdcss->psz_cachefile );
- _dvdcss_debug( dvdcss, psz_debug );
+ print_debug( dvdcss, psz_debug );
}
nocache:
@@ -522,7 +638,7 @@
{
if( ((uint8_t*)p_buffer)[0x14] & 0x30 )
{
- _dvdcss_error( dvdcss, "no key but found encrypted block" );
+ print_error( dvdcss, "no key but found encrypted block" );
/* Only return the initial range of unscrambled blocks? */
/* or fail completely? return 0; */
break;
Index: libdvdcss.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/libdvdcss.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- libdvdcss.h 1 Mar 2005 06:07:40 -0000 1.5
+++ libdvdcss.h 1 Oct 2005 17:19:33 -0000 1.6
@@ -77,6 +77,14 @@
/*****************************************************************************
* Functions used across the library
*****************************************************************************/
-void _dvdcss_error ( dvdcss_t, char * );
-void _dvdcss_debug ( dvdcss_t, char * );
+#define print_error(dvdcss,msg) _print_error(dvdcss,msg)
+#define print_debug(dvdcss,msg,args...) \
+ if( dvdcss->b_debug ) \
+ { \
+ fprintf( stderr, "libdvdcss debug: " ); \
+ fprintf( stderr, msg, ##args ); \
+ fprintf( stderr, "\n" ); \
+ }
+
+void _print_error ( dvdcss_t, char * );
Index: libdvdcss_changes.diff
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdvdkit2/libdvdcss_changes.diff,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- libdvdcss_changes.diff 7 Jun 2005 17:33:03 -0000 1.3
+++ libdvdcss_changes.diff 1 Oct 2005 17:19:33 -0000 1.4
@@ -1,17 +1,6 @@
---- bsdi_ioctl.c 2003-03-10 00:34:10.000000000 +0100
-+++ bsdi_ioctl.c 2005-03-01 07:41:41.000000000 +0100
-@@ -694,7 +698,7 @@
- struct cdrom_tocentry entry;
- int ret, i;
-
-- bzero(tracks, sizeof (*tracks));
-+ memset(tracks, 0, sizeof (*tracks));
- ret = cdrom_ioctl(fd, CDROMREADTOCHDR, &header);
- /*
- * This whole business is a crock anyhow so we don't bother distinguishing
--- common.h 2003-06-13 19:33:35.000000000 +0200
+++ common.h 2005-03-01 07:41:41.000000000 +0100
-@@ -27,21 +30,10 @@
+@@ -27,21 +27,10 @@
/*****************************************************************************
* Basic types definitions
*****************************************************************************/
@@ -37,9 +26,9 @@
#endif
#if defined( WIN32 )
---- css.c 2003-07-29 01:37:06.000000000 +0200
-+++ css.c 2005-03-01 07:41:41.000000000 +0100
-@@ -40,19 +43,11 @@
+--- css.c 2005-07-11 14:24:09.000000000 +0200
++++ css.c 2005-10-01 19:02:35.000000000 +0200
+@@ -41,19 +41,11 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -47,25 +36,28 @@
-# include <sys/param.h>
-#endif
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
#include <fcntl.h>
-+#include <unistd.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#include "dvdcss/dvdcss.h"
+#include "dvdcss.h"
#include "common.h"
#include "css.h"
---- dvdcss/device.c 2005-06-07 19:22:40.181853664 +0200
-+++ device.c 2005-06-07 15:36:21.000000000 +0200
-@@ -33,18 +36,9 @@
+--- device.c 2005-07-11 13:33:34.000000000 +0200
++++ device.c 2005-10-01 19:08:07.000000000 +0200
+@@ -31,23 +31,12 @@
+ #include <stdio.h>
+ #include <stdlib.h>
#include <string.h>
+-#ifdef HAVE_ERRNO_H
+ # include <errno.h>
+-#endif
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef HAVE_SYS_PARAM_H
@@ -74,18 +66,16 @@
#include <fcntl.h>
-
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
-+#include <unistd.h>
-+#include <limits.h>
#if defined( WIN32 ) && !defined( SYS_CYGWIN )
# include <io.h> /* read() */
-@@ -52,7 +46,7 @@
+@@ -55,7 +44,7 @@
# include <sys/uio.h> /* struct iovec */
#endif
@@ -94,8 +84,8 @@
#include "common.h"
#include "css.h"
-@@ -143,8 +137,11 @@
- _dvdcss_debug( dvdcss, psz_debug );
+@@ -143,8 +132,11 @@
+ print_debug( dvdcss, "opening target `%s'", psz_device );
#if defined( WIN32 )
- /* If device is not "X:", we are actually opening a file. */
@@ -108,259 +98,29 @@
/* Initialize readv temporary buffer */
dvdcss->p_readv_buffer = NULL;
-@@ -276,14 +273,14 @@
- * won't send back the right result).
- * (See Microsoft Q241374: Read and Write Access Required for SCSI
- * Pass Through Requests) */
-- (HANDLE) dvdcss->i_fd =
-+ dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
-
- if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
-- (HANDLE) dvdcss->i_fd =
-+ dvdcss->i_fd = (int)
- CreateFile( psz_dvd, GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING,
- FILE_FLAG_RANDOM_ACCESS, NULL );
-@@ -305,8 +302,8 @@
- DWORD dwSupportInfo;
- struct w32_aspidev *fd;
- int i, j, i_hostadapters;
-- long (*lpGetSupport)( void );
-- long (*lpSendCommand)( void* );
-+ GETASPI32SUPPORTINFO lpGetSupport;
-+ SENDASPI32COMMAND lpSendCommand;
- char c_drive = psz_device[0];
-
- /* load aspi and init w32_aspidev structure */
-@@ -317,8 +314,8 @@
- return -1;
- }
-
-- (FARPROC) lpGetSupport = GetProcAddress( hASPI, "GetASPI32SupportInfo" );
-- (FARPROC) lpSendCommand = GetProcAddress( hASPI, "SendASPI32Command" );
-+ lpGetSupport = (GETASPI32SUPPORTINFO) GetProcAddress( hASPI, "GetASPI32SupportInfo" );
-+ lpSendCommand = (SENDASPI32COMMAND) GetProcAddress( hASPI, "SendASPI32Command" );
-
- if(lpGetSupport == NULL || lpSendCommand == NULL )
- {
---- error.c 2003-03-10 01:15:31.000000000 +0100
-+++ error.c 2005-03-01 07:41:41.000000000 +0100
-@@ -25,16 +28,9 @@
+--- error.c 2004-02-24 16:46:49.000000000 +0100
++++ error.c 2005-10-01 19:10:06.000000000 +0200
+@@ -25,16 +25,9 @@
#include <stdio.h>
#include <stdlib.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#include "dvdcss/dvdcss.h"
+#include "dvdcss.h"
#include "common.h"
#include "css.h"
---- ioctl.c 2003-03-10 00:34:10.000000000 +0100
-+++ ioctl.c 2005-03-01 07:41:41.000000000 +0100
-@@ -76,6 +79,7 @@
- # include <sys/scsi.h>
- #endif
- #ifdef SOLARIS_USCSI
-+# include <dlfcn.h>
- # include <unistd.h>
- # include <stropts.h>
- # include <sys/scsi/scsi_types.h>
-@@ -112,6 +116,7 @@
- *****************************************************************************/
- #if defined( SOLARIS_USCSI )
- static void SolarisInitUSCSI( struct uscsi_cmd *p_sc, int i_type );
-+static int SolarisSendUSCSI( int fd, struct uscsi_cmd *p_sc );
- #endif
-
- /*****************************************************************************
-@@ -192,7 +197,7 @@
- rs_cdb.cdb_opaque[ 6 ] = i_layer;
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_COPYRIGHT;
-
-- i_ret = ioctl(i_fd, USCSICMD, &sc);
-+ i_ret = SolarisSendUSCSI(i_fd, &sc);
-
- if( i_ret < 0 || sc.uscsi_status ) {
- i_ret = -1;
-@@ -351,7 +356,7 @@
- rs_cdb.cdb_opaque[ 7 ] = DVD_STRUCT_DISCKEY;
- rs_cdb.cdb_opaque[ 10 ] = *pi_agid << 6;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -513,7 +518,7 @@
- rs_cdb.cdb_opaque[ 5 ] = ( i_pos ) & 0xff;
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_TITLE_KEY | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -665,7 +670,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -787,7 +792,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -921,7 +926,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_ASF;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1054,7 +1059,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1175,7 +1180,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1299,7 +1304,7 @@
- p_buffer[ 1 ] = 0xe;
- memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
-
-- if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
-+ if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-@@ -1436,7 +1441,7 @@
- p_buffer[ 1 ] = 0xa;
- memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
-
-- if( ioctl( i_fd, USCSICMD, &sc ) < 0 || sc.uscsi_status )
-+ if( SolarisSendUSCSI( i_fd, &sc ) < 0 || sc.uscsi_status )
- {
- return -1;
- }
-@@ -1578,7 +1583,7 @@
-
- rs_cdb.cdb_opaque[ 10 ] = DVD_REPORT_RPC;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1728,7 +1733,7 @@
- p_buffer[ 1 ] = 6;
- p_buffer[ 4 ] = i_pdrc;
-
-- i_ret = ioctl( i_fd, USCSICMD, &sc );
-+ i_ret = SolarisSendUSCSI( i_fd, &sc );
-
- if( i_ret < 0 || sc.uscsi_status )
- {
-@@ -1901,6 +1906,54 @@
-
- USCSI_TIMEOUT( p_sc, 15 );
- }
-+
-+/*****************************************************************************
-+ * SolarisSendUSCSI: send a USCSICMD structure to the Solaris kernel
-+ * for execution
-+ *****************************************************************************
-+ * When available, this function uses the function smedia_uscsi_cmd()
-+ * from solaris' libsmedia library (solaris 9 or newer) to execute the
-+ * USCSI command. smedia_uscsi_cmd() allows USCSI commands for
-+ * non-root users on removable media devices on solaris 9; sending the
-+ * USCSI command directly to the device using the USCSICMD ioctl fails
-+ * with an EPERM error on solaris 9.
-+ *
-+ * The code will fall back to the USCSICMD ioctl method, when
-+ * libsmedia.so is not available or does not export the
-+ * smedia_uscsi_cmd() function (on solaris releases upto and including
-+ * solaris 8). Fortunatelly, on these old releases non-root users are
-+ * allowed to perform USCSICMD ioctls on removable media devices.
-+ *****************************************************************************/
-+static int SolarisSendUSCSI( int i_fd, struct uscsi_cmd *p_sc ) {
-+ void *sm_hdl;
-+ static int initialized;
-+ static void* (*sm_get_handle)(int32_t);
-+ static int (*sm_release_handle)(void*);
-+ static int (*sm_uscsi_cmd)(void*, struct uscsi_cmd *);
-+
-+ if (!initialized)
-+ {
-+ void *smedia_lib;
-+
-+ smedia_lib = dlopen("libsmedia.so", RTLD_NOW);
-+ if (smedia_lib) {
-+ sm_get_handle = dlsym(smedia_lib, "smedia_get_handle");
-+ sm_release_handle = dlsym(smedia_lib, "smedia_release_handle");
-+ sm_uscsi_cmd = dlsym(smedia_lib, "smedia_uscsi_cmd");
-+ }
-+ initialized = 1;
-+ }
-+
-+ if (sm_get_handle && sm_uscsi_cmd && sm_release_handle
-+ && (sm_hdl = sm_get_handle(i_fd)))
-+ {
-+ int i_ret = sm_uscsi_cmd(sm_hdl, p_sc);
-+ sm_release_handle(sm_hdl);
-+ return i_ret;
-+ }
-+
-+ return ioctl( i_fd, USCSICMD, p_sc );
-+}
- #endif
-
- #if defined( WIN32 )
---- libdvdcss.c 2003-06-22 16:08:53.000000000 +0200
-+++ libdvdcss.c 2005-03-01 07:41:41.000000000 +0100
-@@ -22,7 +25,7 @@
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- */
-
--/**
-+/*
- * \mainpage libdvdcss developer documentation
- *
- * \section intro Introduction
-@@ -87,10 +90,7 @@
+--- libdvdcss.c 2004-08-13 15:40:18.000000000 +0200
++++ libdvdcss.c 2005-10-01 19:11:27.000000000 +0200
+@@ -87,10 +87,7 @@
* values. This will speed up descrambling of DVDs which are in the
* cache. The DVDCSS_CACHE directory is created if it does not exist,
* and a subdirectory is created named after the DVD's title or
@@ -372,7 +132,7 @@
*/
/*
-@@ -103,28 +103,12 @@
+@@ -103,28 +100,12 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -384,17 +144,15 @@
-#endif
#include <fcntl.h>
#include <errno.h>
-+#include <unistd.h>
-+#include <limits.h>
-
+-
-#ifdef HAVE_UNISTD_H
--# include <unistd.h>
+ # include <unistd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
--# include <limits.h>
+ # include <limits.h>
-#endif
--
+
-#ifdef HAVE_DIRECT_H
-# include <direct.h>
-#endif
@@ -404,7 +162,7 @@
#include "common.h"
#include "css.h"
-@@ -132,6 +116,12 @@
+@@ -132,6 +113,12 @@
#include "ioctl.h"
#include "device.h"
@@ -417,96 +175,25 @@
/**
* \brief Symbol for version checks.
*
-@@ -234,87 +224,11 @@
+@@ -233,6 +220,8 @@
+ }
}
++#if 0 /* MPlayer caches keys in its own configuration directory */
++
+ /*
+ * If DVDCSS_CACHE was not set, try to guess a default value
+ */
+@@ -309,6 +298,8 @@
+ #endif
+ }
+
++#endif /* 0 */
++
/*
-- * If DVDCSS_CACHE was not set, try to guess a default value
-- */
-- if( psz_cache == NULL || psz_cache[0] == '\0' )
-- {
--#ifdef HAVE_DIRECT_H
-- typedef HRESULT( WINAPI *SHGETFOLDERPATH )
-- ( HWND, int, HANDLE, DWORD, LPTSTR );
--
--# define CSIDL_FLAG_CREATE 0x8000
--# define CSIDL_APPDATA 0x1A
--# define SHGFP_TYPE_CURRENT 0
--
-- char psz_home[MAX_PATH];
-- HINSTANCE p_dll;
-- SHGETFOLDERPATH p_getpath;
--
-- *psz_home = '\0';
--
-- /* Load the shfolder dll to retrieve SHGetFolderPath */
-- p_dll = LoadLibrary( "shfolder.dll" );
-- if( p_dll )
-- {
-- p_getpath = (void*)GetProcAddress( p_dll, "SHGetFolderPathA" );
-- if( p_getpath )
-- {
-- /* Get the "Application Data" folder for the current user */
-- if( p_getpath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
-- NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK )
-- {
-- FreeLibrary( p_dll );
-- }
-- else
-- {
-- *psz_home = '\0';
-- }
-- }
-- FreeLibrary( p_dll );
-- }
--
-- /* Cache our keys in
-- * C:\Documents and Settings\$USER\Application Data\dvdcss\ */
-- if( *psz_home )
-- {
-- snprintf( psz_buffer, PATH_MAX, "%s/dvdcss", psz_home );
-- psz_buffer[PATH_MAX-1] = '\0';
-- psz_cache = psz_buffer;
-- }
--#else
-- char *psz_home = NULL;
--# ifdef HAVE_PWD_H
-- struct passwd *p_pwd;
--
-- /* Try looking in password file for home dir. */
-- p_pwd = getpwuid(getuid());
-- if( p_pwd )
-- {
-- psz_home = p_pwd->pw_dir;
-- }
--# endif
--
-- if( psz_home == NULL )
-- {
-- psz_home = getenv( "HOME" );
-- }
--
-- /* Cache our keys in ${HOME}/.dvdcss/ */
-- if( psz_home )
-- {
-- snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
-- psz_buffer[PATH_MAX-1] = '\0';
-- psz_cache = psz_buffer;
-- }
--#endif
-- }
--
-- /*
* Find cache dir from the DVDCSS_CACHE environment variable
*/
- if( psz_cache != NULL )
- {
-- if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
-+ if( psz_cache[0] == '\0' )
- {
- psz_cache = NULL;
- }
-@@ -325,6 +239,7 @@
+@@ -326,6 +317,7 @@
psz_cache = NULL;
}
}
@@ -514,48 +201,16 @@
/*
* Open device
-@@ -465,9 +380,10 @@
+@@ -504,9 +496,10 @@
dvdcss->psz_cachefile[0] = '\0';
goto nocache;
}
+ i += sprintf( dvdcss->psz_cachefile + i, "/");
-- i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title,
-- psz_serial );
+- i += sprintf( dvdcss->psz_cachefile + i, "/%s-%s%s", psz_title,
+- psz_serial, psz_key );
+// i += sprintf( dvdcss->psz_cachefile + i, "/%s", psz_data );
-+ i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
++ i += sprintf( dvdcss->psz_cachefile + i, "/%s#%s", psz_title, psz_serial );
#if !defined( WIN32 ) || defined( SYS_CYGWIN )
i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
#else
---- dvdcss/dvdcss.h 2003-04-18 20:05:36.000000000 +0200
-+++ dvdcss.h 2005-03-01 07:41:41.000000000 +0100
-@@ -67,6 +70,8 @@
- */
- extern dvdcss_t dvdcss_open ( char *psz_target );
- extern int dvdcss_close ( dvdcss_t );
-+extern int dvdcss_title ( dvdcss_t,
-+ int i_block );
- extern int dvdcss_seek ( dvdcss_t,
- int i_blocks,
- int i_flags );
---- dvdcss/ioctl.h 2005-06-07 19:22:40.187852752 +0200
-+++ ioctl.h 2005-06-07 15:31:43.000000000 +0200
-@@ -318,6 +318,9 @@
- * win32 aspi specific
- *****************************************************************************/
-
-+typedef WINAPI DWORD (*GETASPI32SUPPORTINFO)(VOID);
-+typedef WINAPI DWORD (*SENDASPI32COMMAND)(LPVOID);
-+
- #define WIN2K ( GetVersion() < 0x80000000 )
- #define ASPI_HAID 0
- #define ASPI_TARGET 0
-@@ -339,7 +342,7 @@
- long hASPI;
- short i_sid;
- int i_blocks;
-- long (*lpSendCommand)( void* );
-+ SENDASPI32COMMAND lpSendCommand;
- };
-
- #pragma pack(1)
1
0
CVS change done by Diego Biurrun CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv23110
Modified Files:
Copyright
Log Message:
upgrade to libdvdcss 1.2.9
Index: Copyright
===================================================================
RCS file: /cvsroot/mplayer/main/Copyright,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Copyright 3 Jul 2005 11:56:16 -0000 1.19
+++ Copyright 1 Oct 2005 17:19:32 -0000 1.20
@@ -33,7 +33,7 @@
License: GNU General Public License
Name: libdvdcss
-Version: 1.2.8 + patches
+Version: 1.2.9 + patches
Homepage: http://developers.videolan.org/libdvdcss/
Directory: libmpdvdkit2
License: GNU General Public License
1
0
CVS change done by Diego Biurrun CVS
Update of /cvsroot/mplayer/main/libmpdvdkit2
In directory mail:/var2/tmp/cvs-serv22833
Removed Files:
README
Log Message:
long obsolete
--- README DELETED ---
1
0
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libaf
In directory mail:/var2/tmp/cvs-serv17843/libaf
Modified Files:
af.c af.h
Log Message:
documentation-only patch: make doxygen compatible and create
af_chain and af_filter doxygen modules.
Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- af.c 23 Jul 2005 16:58:25 -0000 1.49
+++ af.c 1 Oct 2005 12:55:34 -0000 1.50
@@ -628,11 +628,7 @@
return AF_OK;
}
-/**
- * \brief send control to all filters, starting with the last, until
- * one responds with AF_OK
- * \return The instance that accepted the command or NULL if none did.
- */
+// documentation in af.h
af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg) {
int res = AF_UNKNOWN;
af_instance_t* filt = s->last;
@@ -647,6 +643,8 @@
/**
* \brief calculate greatest common divisior of a and b.
+ * \ingroup af_filter
+ *
* Extended for negative and 0 values. If both are 0 the result is 1.
* The sign of the result will be so that it has the same sign as b.
*/
@@ -669,6 +667,8 @@
/**
* \brief cancel down a fraction f
+ * \param f fraction to cancel down
+ * \ingroup af_filter
*/
void af_frac_cancel(frac_t *f) {
int gcd = af_gcd(f->n, f->d);
@@ -678,7 +678,11 @@
/**
* \brief multiply out by in and store result in out.
- * the resulting fraction wil be cancelled down
+ * \param out [inout] fraction to multiply by in
+ * \param in [in] fraction to multiply out by
+ * \ingroup af_filter
+ *
+ * the resulting fraction will be cancelled down
* if in and out were.
*/
void af_frac_mul(frac_t *out, const frac_t *in) {
Index: af.h
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- af.h 24 Jun 2005 10:50:53 -0000 1.27
+++ af.h 1 Oct 2005 12:55:34 -0000 1.28
@@ -124,69 +124,126 @@
// Export functions
*/
-/* Initialize the stream "s". This function creates a new filter list
- if necessary according to the values set in input and output. Input
- and output should contain the format of the current movie and the
- formate of the preferred output respectively. The function is
- reentrant i.e. if called with an already initialized stream the
- stream will be reinitialized. If the binary parameter
- "force_output" is set, the output format will be converted to the
- format given in "s", otherwise the output fromat in the last filter
- will be copied "s". The return value is 0 if success and -1 if
- failure */
+/**
+ * \defgroup af_chain Audio filter chain functions
+ * \{
+ * \param s filter chain
+ */
+
+/**
+ * \brief Initialize the stream "s".
+ * \return 0 on success, -1 on failure
+ *
+ * This function creates a new filter list if necessary, according
+ * to the values set in input and output. Input and output should contain
+ * the format of the current movie and the format of the preferred output
+ * respectively.
+ * Filters to convert to the preferred output format are inserted
+ * automatically, except when they are set to 0.
+ * The function is reentrant i.e. if called with an already initialized
+ * stream the stream will be reinitialized.
+ */
int af_init(af_stream_t* s);
-// Uninit and remove all filters
+/**
+ * \brief Uninit and remove all filters from audio filter chain
+ */
void af_uninit(af_stream_t* s);
-/* Add filter during execution. This function adds the filter "name"
- to the stream s. The filter will be inserted somewhere nice in the
- list of filters. The return value is a pointer to the new filter,
- If the filter couldn't be added the return value is NULL. */
+/**
+ * \brief This function adds the filter "name" to the stream s.
+ * \param name name of filter to add
+ * \return pointer to the new filter, NULL if insert failed
+ *
+ * The filter will be inserted somewhere nice in the
+ * list of filters (i.e. at the beginning unless the
+ * first filter is the format filter (why??).
+ */
af_instance_t* af_add(af_stream_t* s, char* name);
-// Uninit and remove the filter "af"
+/**
+ * \brief Uninit and remove the filter "af"
+ * \param af filter to remove
+ */
void af_remove(af_stream_t* s, af_instance_t* af);
-/* Find filter in the dynamic filter list using it's name This
- function is used for finding already initialized filters */
+/**
+ * \brief find filter in chain by name
+ * \param name name of the filter to find
+ * \return first filter with right name or NULL if not found
+ *
+ * This function is used for finding already initialized filters
+ */
af_instance_t* af_get(af_stream_t* s, char* name);
-// Filter data chunk through the filters in the list
+/**
+ * \brief filter data chunk through the filters in the list
+ * \param data data to play
+ * \return resulting data
+ * \ingroup af_chain
+ */
af_data_t* af_play(af_stream_t* s, af_data_t* data);
-// send control to all filters, starting with the last until
-// one accepts the command with AF_OK.
-// Returns the accepting filter or NULL if none was found.
+/**
+ * \brief send control to all filters, starting with the last until
+ * one accepts the command with AF_OK.
+ * \param cmd filter control command
+ * \param arg argument for filter command
+ * \return the accepting filter or NULL if none was found
+ */
af_instance_t *af_control_any_rev (af_stream_t* s, int cmd, void* arg);
-/* Calculate how long the output from the filters will be given the
- input length "len". The calculated length is >= the actual
- length */
+/**
+ * \brief Calculate how long the output from the filters will be for a given
+ * input length.
+ * \param len input lenght for which to calculate output length
+ * \return calculated output length, will always be >= the resulting
+ * length when actually calling af_play.
+ */
int af_outputlen(af_stream_t* s, int len);
-/* Calculate how long the input to the filters should be to produce a
- certain output length, i.e. the return value of this function is
- the input length required to produce the output length "len". The
- calculated length is <= the actual length */
+/**
+ * \brief Calculate how long the input to the filters should be to produce a
+ * certain output length
+ * \param len wanted output length
+ * \return input length required to produce the output length "len". Possibly
+ * smaller to avoid overflow of output buffer
+ */
int af_inputlen(af_stream_t* s, int len);
-/* Calculate how long the input IN to the filters should be to produce
+/**
+ * \brief calculate required input length for desired output size
+ * \param len desired minimum output length
+ * \param max_outsize maximum output length
+ * \param max_insize maximum input length
+ * \return input length or -1 on error
+ *
+ Calculate how long the input IN to the filters should be to produce
a certain output length OUT but with the following three constraints:
1. IN <= max_insize, where max_insize is the maximum possible input
block length
2. OUT <= max_outsize, where max_outsize is the maximum possible
output block length
3. If possible OUT >= len.
- Return -1 in case of error */
+ */
int af_calc_insize_constrained(af_stream_t* s, int len,
int max_outsize,int max_insize);
-/* Calculate the total delay caused by the filters */
+/**
+ * \brief Calculate the total delay caused by the filters
+ * \return delay in seconds
+ */
double af_calc_delay(af_stream_t* s);
+/** \} */ // end of af_chain group
+
// Helper functions and macros used inside the audio filters
+/**
+ * \defgroup af_filter Audio filter helper functions
+ * \{
+ */
+
/* Helper function called by the macro with the same name only to be
called from inside filters */
int af_resize_local_buffer(af_instance_t* af, af_data_t* data);
@@ -196,31 +253,87 @@
needed */
int af_lencalc(frac_t mul, af_data_t* data);
-/* Helper function used to convert to gain value from dB. Returns
- AF_OK if of and AF_ERROR if fail */
+/**
+ * \brief convert dB to gain value
+ * \param n number of values to convert
+ * \param in [in] values in dB, <= -200 will become 0 gain
+ * \param out [out] gain values
+ * \param k input values are divided by this
+ * \param mi minimum dB value, input will be clamped to this
+ * \param ma maximum dB value, input will be clamped to this
+ * \return AF_ERROR on error, AF_OK otherwise
+ */
int af_from_dB(int n, float* in, float* out, float k, float mi, float ma);
-/* Helper function used to convert from gain value to dB. Returns
- AF_OK if of and AF_ERROR if fail */
+
+/**
+ * \brief convert gain value to dB
+ * \param n number of values to convert
+ * \param in [in] gain values, 0 wil become -200 dB
+ * \param out [out] values in dB
+ * \param k output values will be multiplied by this
+ * \return AF_ERROR on error, AF_OK otherwise
+ */
int af_to_dB(int n, float* in, float* out, float k);
-/* Helper function used to convert from ms to sample time*/
+
+/**
+ * \brief convert milliseconds to sample time
+ * \param n number of values to convert
+ * \param in [in] values in milliseconds
+ * \param out [out] sample time values
+ * \param rate sample rate
+ * \param mi minimum ms value, input will be clamped to this
+ * \param ma maximum ms value, input will be clamped to this
+ * \return AF_ERROR on error, AF_OK otherwise
+ */
int af_from_ms(int n, float* in, int* out, int rate, float mi, float ma);
-/* Helper function used to convert from sample time to ms */
+
+/**
+ * \brief convert sample time to milliseconds
+ * \param n number of values to convert
+ * \param in [in] sample time values
+ * \param out [out] values in milliseconds
+ * \param rate sample rate
+ * \return AF_ERROR on error, AF_OK otherwise
+ */
int af_to_ms(int n, int* in, float* out, int rate);
-/* Helper function for testing the output format */
+
+/**
+ * \brief test if output format matches
+ * \param af audio filter
+ * \param out needed format, will be overwritten by available
+ * format if they do not match
+ * \return AF_FALSE if formats do not match, AF_OK if they match
+ *
+ * compares the format, bps, rate and nch values of af->data with out
+ */
int af_test_output(struct af_instance_s* af, af_data_t* out);
+/**
+ * \brief soft clipping function using sin()
+ * \param a input value
+ * \return clipped value
+ */
float af_softclip(float a);
+/** \} */ // end of af_filter group, but more functions of this group below
+
/** Print a list of all available audio filters */
void af_help(void);
-/* Fill the missing parameters in the af_data_t structure.
- Used for stuffing bps with a value based on format. */
+/**
+ * \brief fill the missing parameters in the af_data_t structure
+ * \param data structure to fill
+ * \ingroup af_filter
+ *
+ * Currently only sets bps based on format
+ */
void af_fix_parameters(af_data_t *data);
-/* Memory reallocation macro: if a local buffer is used (i.e. if the
+/** Memory reallocation macro: if a local buffer is used (i.e. if the
filter doesn't operate on the incoming buffer this macro must be
- called to ensure the buffer is big enough. */
+ called to ensure the buffer is big enough.
+ * \ingroup af_filter
+ */
#define RESIZE_LOCAL_BUFFER(a,d)\
((a->data->len < af_lencalc(a->mul,d))?af_resize_local_buffer(a,d):AF_OK)
@@ -257,19 +370,22 @@
extern af_msg_cfg_t af_msg_cfg; // Message
-#define AF_MSG_FATAL -3 // Fatal error exit immediately
-#define AF_MSG_ERROR -2 // Error return gracefully
-#define AF_MSG_WARN -1 // Print warning but do not exit (can be suppressed)
-#define AF_MSG_INFO 0 // Important information
-#define AF_MSG_VERBOSE 1 // Print this if verbose is enabled
-#define AF_MSG_DEBUG0 2 // Print if very verbose
-#define AF_MSG_DEBUG1 3 // Print if very very verbose
+//! \addtogroup af_filter
+//! \{
+#define AF_MSG_FATAL -3 ///< Fatal error exit immediately
+#define AF_MSG_ERROR -2 ///< Error return gracefully
+#define AF_MSG_WARN -1 ///< Print warning but do not exit (can be suppressed)
+#define AF_MSG_INFO 0 ///< Important information
+#define AF_MSG_VERBOSE 1 ///< Print this if verbose is enabled
+#define AF_MSG_DEBUG0 2 ///< Print if very verbose
+#define AF_MSG_DEBUG1 3 ///< Print if very very verbose
-/* Macro for printing error messages */
+//! Macro for printing error messages
#ifndef af_msg
#define af_msg(lev, args... ) \
(((lev)<AF_MSG_WARN)?(fprintf(af_msg_cfg.err?af_msg_cfg.err:stderr, ## args )): \
(((lev)<=af_msg_cfg.level)?(fprintf(af_msg_cfg.msg?af_msg_cfg.msg:stdout, ## args )):0))
#endif
+//! \}
#endif /* __aop_h__ */
1
0
01 Oct '05
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv22138
Modified Files:
vo_gl.c vo_gl2.c
Log Message:
documentation update.
Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- vo_gl.c 25 Sep 2005 16:41:28 -0000 1.103
+++ vo_gl.c 1 Oct 2005 12:53:49 -0000 1.104
@@ -740,10 +740,11 @@
" Requires GLX_SGI_swap_control support to work.\n"
" yuv=<n>\n"
" 0: use software YUV to RGB conversion.\n"
- " 1: use register combiners (nVidia only).\n"
+ " 1: use register combiners (nVidia only, for older cards).\n"
" 2: use fragment program.\n"
" 3: use fragment program with gamma correction.\n"
" 4: use fragment program with gamma correction via lookup.\n"
+ " 5: use ATI-specific method (for older cards).\n"
" customprog=<filename>\n"
" use a custom YUV conversion program\n"
" customtex=<filename>\n"
Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- vo_gl2.c 25 Sep 2005 16:33:03 -0000 1.81
+++ vo_gl2.c 1 Oct 2005 12:53:49 -0000 1.82
@@ -1097,10 +1097,11 @@
" Do not call glFinish() before swapping buffers\n"
" yuv=<n>\n"
" 0: use software YUV to RGB conversion.\n"
- " 1: use register combiners (nVidia only).\n"
+ " 1: use register combiners (nVidia only, for older cards).\n"
" 2: use fragment program.\n"
" 3: use fragment program with gamma correction.\n"
" 4: use fragment program with gamma correction via lookup.\n"
+ " 5: use ATI-specific method (for older cards).\n"
"\n" );
return -1;
}
1
0
[MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.29, 1.30 gl_common.h, 1.20, 1.21
by syncmail@mplayerhq.hu 01 Oct '05
by syncmail@mplayerhq.hu 01 Oct '05
01 Oct '05
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv22313
Modified Files:
gl_common.c gl_common.h
Log Message:
Support for ATI specific YUV->RGB conversion.
Index: gl_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- gl_common.c 25 Sep 2005 16:41:28 -0000 1.29
+++ gl_common.c 1 Oct 2005 12:49:28 -0000 1.30
@@ -35,6 +35,15 @@
void (APIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum,
GLenum, GLenum, GLboolean, GLboolean,
GLboolean);
+void (APIENTRY *BeginFragmentShader)(void);
+void (APIENTRY *EndFragmentShader)(void);
+void (APIENTRY *SampleMap)(GLuint, GLuint, GLenum);
+void (APIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint, GLuint, GLuint);
+void (APIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint);
+void (APIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *);
void (APIENTRY *ActiveTexture)(GLenum);
void (APIENTRY *BindTexture)(GLenum, GLuint);
void (APIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat);
@@ -274,6 +283,12 @@
CombinerOutput = getProcAddress("glCombinerOutput");
if (!CombinerOutput)
CombinerOutput = getProcAddress("glCombinerOutputNV");
+ BeginFragmentShader = getProcAddress("glBeginFragmentShaderATI");
+ EndFragmentShader = getProcAddress("glEndFragmentShaderATI");
+ SampleMap = getProcAddress("glSampleMapATI");
+ ColorFragmentOp2 = getProcAddress("glColorFragmentOp2ATI");
+ ColorFragmentOp3 = getProcAddress("glColorFragmentOp3ATI");
+ SetFragmentShaderConstant = getProcAddress("glSetFragmentShaderConstantATI");
ActiveTexture = getProcAddress("glActiveTexture");
if (!ActiveTexture)
ActiveTexture = getProcAddress("glActiveTextureARB");
@@ -480,6 +495,28 @@
glTexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data);
}
+static void fillUVcoeff(GLfloat *ucoef, GLfloat *vcoef,
+ float uvcos, float uvsin) {
+ int i;
+ ucoef[0] = 0 * uvcos + 1.403 * uvsin;
+ vcoef[0] = 0 * uvsin + 1.403 * uvcos;
+ ucoef[1] = -0.344 * uvcos + -0.714 * uvsin;
+ vcoef[1] = -0.344 * uvsin + -0.714 * uvcos;
+ ucoef[2] = 1.770 * uvcos + 0 * uvsin;
+ vcoef[2] = 1.770 * uvsin + 0 * uvcos;
+ ucoef[3] = 0;
+ vcoef[3] = 0;
+ // Coefficients (probably) must be in [0, 1] range, whereas they originally
+ // are in [-2, 2] range, so here comes the trick:
+ // First put them in the [-0.5, 0.5] range, then add 0.5.
+ // This can be undone with the HALF_BIAS and SCALE_BY_FOUR arguments
+ // for CombinerInput and CombinerOutput (or the respective ATI variants)
+ for (i = 0; i < 4; i++) {
+ ucoef[i] = ucoef[i] * 0.25 + 0.5;
+ vcoef[i] = vcoef[i] * 0.25 + 0.5;
+ }
+}
+
/**
* \brief Setup register combiners for YUV to RGB conversion.
* \param uvcos used for saturation and hue adjustment
@@ -502,23 +539,7 @@
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n");
return;
}
- ucoef[0] = 0 * uvcos + 1.403 * uvsin;
- vcoef[0] = 0 * uvsin + 1.403 * uvcos;
- ucoef[1] = -0.344 * uvcos + -0.714 * uvsin;
- vcoef[1] = -0.344 * uvsin + -0.714 * uvcos;
- ucoef[2] = 1.770 * uvcos + 0 * uvsin;
- vcoef[2] = 1.770 * uvsin + 0 * uvcos;
- ucoef[3] = 0;
- vcoef[3] = 0;
- // Coefficients (probably) must be in [0, 1] range, whereas they originally
- // are in [-2, 2] range, so here comes the trick:
- // First put them in the [-0.5, 0.5] range, then add 0.5.
- // This can be undone with the HALF_BIAS and SCALE_BY_FOUR arguments
- // for CombinerInput and CombinerOutput
- for (i = 0; i < 4; i++) {
- ucoef[i] = ucoef[i] * 0.25 + 0.5;
- vcoef[i] = vcoef[i] * 0.25 + 0.5;
- }
+ fillUVcoeff(ucoef, vcoef, uvcos, uvsin);
CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef);
CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef);
@@ -552,6 +573,53 @@
CombinerParameteri(GL_NUM_GENERAL_COMBINERS_NV, 2);
}
+/**
+ * \brief Setup ATI version of register combiners for YUV to RGB conversion.
+ * \param uvcos used for saturation and hue adjustment
+ * \param uvsin used for saturation and hue adjustment
+ *
+ * ATI called this fragment shader, but the name is confusing in the
+ * light of a very different OpenGL 2.0 extension with the same name
+ */
+static void glSetupYUVCombinersATI(float uvcos, float uvsin) {
+ GLfloat ucoef[4];
+ GLfloat vcoef[4];
+ GLint i;
+ glGetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i);
+ if (i < 3)
+ mp_msg(MSGT_VO, MSGL_ERR,
+ "[gl] 3 registers needed for YUV combiner (ATI) support (found %i)\n", i);
+ glGetIntegerv (GL_MAX_TEXTURE_UNITS, &i);
+ if (i < 3)
+ mp_msg(MSGT_VO, MSGL_ERR,
+ "[gl] 3 texture units needed for YUV combiner (ATI) support (found %i)\n", i);
+ if (!BeginFragmentShader || !EndFragmentShader ||
+ !SetFragmentShaderConstant || !SampleMap ||
+ !ColorFragmentOp2 || !ColorFragmentOp3) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n");
+ return;
+ }
+ fillUVcoeff(ucoef, vcoef, uvcos, uvsin);
+ BeginFragmentShader();
+ SetFragmentShaderConstant(GL_CON_0_ATI, ucoef);
+ SetFragmentShaderConstant(GL_CON_1_ATI, vcoef);
+ SampleMap(GL_REG_0_ATI, GL_TEXTURE0, GL_SWIZZLE_STR_ATI);
+ SampleMap(GL_REG_1_ATI, GL_TEXTURE1, GL_SWIZZLE_STR_ATI);
+ SampleMap(GL_REG_2_ATI, GL_TEXTURE2, GL_SWIZZLE_STR_ATI);
+ // UV first, like this green component cannot overflow
+ ColorFragmentOp2(GL_MUL_ATI, GL_REG_1_ATI, GL_NONE, GL_NONE,
+ GL_REG_1_ATI, GL_NONE, GL_BIAS_BIT_ATI,
+ GL_CON_0_ATI, GL_NONE, GL_BIAS_BIT_ATI);
+ ColorFragmentOp3(GL_MAD_ATI, GL_REG_2_ATI, GL_NONE, GL_4X_BIT_ATI,
+ GL_REG_2_ATI, GL_NONE, GL_BIAS_BIT_ATI,
+ GL_CON_1_ATI, GL_NONE, GL_BIAS_BIT_ATI,
+ GL_REG_1_ATI, GL_NONE, GL_NONE);
+ ColorFragmentOp2(GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE,
+ GL_REG_0_ATI, GL_NONE, GL_NONE,
+ GL_REG_2_ATI, GL_NONE, GL_NONE);
+ EndFragmentShader();
+}
+
static const char *yuv_prog_template =
"!!ARBfp1.0\n"
"OPTION ARB_precision_hint_fastest;"
@@ -713,6 +781,9 @@
case YUV_CONVERSION_COMBINERS:
glSetupYUVCombiners(uvcos, uvsin);
break;
+ case YUV_CONVERSION_COMBINERS_ATI:
+ glSetupYUVCombinersATI(uvcos, uvsin);
+ break;
case YUV_CONVERSION_FRAGMENT_LOOKUP:
{
unsigned char lookup_data[4 * LOOKUP_RES];
@@ -752,6 +823,14 @@
ActiveTexture(GL_TEXTURE0);
glEnable(GL_REGISTER_COMBINERS_NV);
break;
+ case YUV_CONVERSION_COMBINERS_ATI:
+ ActiveTexture(GL_TEXTURE1);
+ glEnable(target);
+ ActiveTexture(GL_TEXTURE2);
+ glEnable(target);
+ ActiveTexture(GL_TEXTURE0);
+ glEnable(GL_FRAGMENT_SHADER_ATI);
+ break;
case YUV_CONVERSION_FRAGMENT_LOOKUP:
case YUV_CONVERSION_FRAGMENT_POW:
case YUV_CONVERSION_FRAGMENT:
@@ -777,6 +856,14 @@
ActiveTexture(GL_TEXTURE0);
glDisable(GL_REGISTER_COMBINERS_NV);
break;
+ case YUV_CONVERSION_COMBINERS_ATI:
+ ActiveTexture(GL_TEXTURE1);
+ glDisable(target);
+ ActiveTexture(GL_TEXTURE2);
+ glDisable(target);
+ ActiveTexture(GL_TEXTURE0);
+ glDisable(GL_FRAGMENT_SHADER_ATI);
+ break;
case YUV_CONVERSION_FRAGMENT_LOOKUP:
case YUV_CONVERSION_FRAGMENT_POW:
case YUV_CONVERSION_FRAGMENT:
Index: gl_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- gl_common.h 27 Sep 2005 08:33:33 -0000 1.20
+++ gl_common.h 1 Oct 2005 12:49:28 -0000 1.21
@@ -76,6 +76,45 @@
#ifndef GL_SPARE0_NV
#define GL_SPARE0_NV 0x852E
#endif
+#ifndef GL_FRAGMENT_SHADER_ATI
+#define GL_FRAGMENT_SHADER_ATI 0x8920
+#endif
+#ifndef GL_NUM_FRAGMENT_REGISTERS_ATI
+#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
+#endif
+#ifndef GL_REG_0_ATI
+#define GL_REG_0_ATI 0x8921
+#endif
+#ifndef GL_REG_1_ATI
+#define GL_REG_1_ATI 0x8922
+#endif
+#ifndef GL_REG_2_ATI
+#define GL_REG_2_ATI 0x8923
+#endif
+#ifndef GL_CON_0_ATI
+#define GL_CON_0_ATI 0x8941
+#endif
+#ifndef GL_CON_1_ATI
+#define GL_CON_1_ATI 0x8942
+#endif
+#ifndef GL_ADD_ATI
+#define GL_ADD_ATI 0x8963
+#endif
+#ifndef GL_MUL_ATI
+#define GL_MUL_ATI 0x8964
+#endif
+#ifndef GL_MAD_ATI
+#define GL_MAD_ATI 0x8968
+#endif
+#ifndef GL_SWIZZLE_STR_ATI
+#define GL_SWIZZLE_STR_ATI 0x8976
+#endif
+#ifndef GL_4X_BIT_ATI
+#define GL_4X_BIT_ATI 2
+#endif
+#ifndef GL_BIAS_BIT_ATI
+#define GL_BIAS_BIT_ATI 8
+#endif
#ifndef GL_MAX_TEXTURE_UNITS
#define GL_MAX_TEXTURE_UNITS 0x84E2
#endif
@@ -171,6 +210,8 @@
#define YUV_CONVERSION_FRAGMENT_POW 3
//! use a fragment program with additional table lookup for YUV conversion
#define YUV_CONVERSION_FRAGMENT_LOOKUP 4
+//! use ATI specific register combiners ("fragment program")
+#define YUV_CONVERSION_COMBINERS_ATI 5
/** \} */
void glSetupYUVConversion(GLenum target, int type,
float brightness, float contrast,
@@ -210,6 +251,15 @@
extern void (APIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum,
GLenum, GLenum, GLboolean, GLboolean,
GLboolean);
+extern void (APIENTRY *BeginFragmentShader)(void);
+extern void (APIENTRY *EndFragmentShader)(void);
+extern void (APIENTRY *SampleMap)(GLuint, GLuint, GLenum);
+extern void (APIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint, GLuint, GLuint);
+extern void (APIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint, GLuint, GLuint,
+ GLuint, GLuint, GLuint);
+extern void (APIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *);
extern void (APIENTRY *ActiveTexture)(GLenum);
extern void (APIENTRY *BindTexture)(GLenum, GLuint);
extern void (APIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat);
1
0
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv10612
Modified Files:
ad_realaud.c
Log Message:
Check for eof instead of decoding the same data over and over.
The whole code could use a lot more checks on return values...
Index: ad_realaud.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_realaud.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ad_realaud.c 21 Jul 2005 17:03:43 -0000 1.36
+++ ad_realaud.c 1 Oct 2005 12:35:18 -0000 1.37
@@ -432,6 +432,7 @@
#if 1
if(sh->a_in_buffer_len<=0){
+ if (sh->ds->eof) return 0;
// fill the buffer!
if (sh->format == mmioFOURCC('1','4','_','4')) {
demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign);
1
0
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv1561
Modified Files:
AUTHORS
Log Message:
Add Compn, expert at wrangling useful bugreports from users ;-)
Patch by himself (tempn at twmi rr com).
Index: AUTHORS
===================================================================
RCS file: /cvsroot/mplayer/main/AUTHORS,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- AUTHORS 25 Sep 2005 16:59:19 -0000 1.162
+++ AUTHORS 1 Oct 2005 11:16:02 -0000 1.163
@@ -174,6 +174,11 @@
* x264's encoding guide
* superficial clarity fixes for mpcf.txt
+Compn <patriotact(a)gmail.com>
+ * #mplayer user wrangler (2003+)
+ * minor samples/bugs/win32 finder/tester
+ * small docs patches
+
Comstedt, Marcus <marcus(a)idonex.se>
* initial Solaris 8 x86 support
* configure fixes
1
0
CVS change done by Oded Shimon CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv32021
Modified Files:
mp_msg.c mp_msg.h
Log Message:
mp_msg cleanup.
Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- mp_msg.c 3 Sep 2005 19:27:48 -0000 1.27
+++ mp_msg.c 29 Sep 2005 05:21:12 -0000 1.28
@@ -8,14 +8,10 @@
#include "config.h"
#if defined(FOR_MENCODER) || defined(CODECS2HTML)
-#undef ENABLE_GUI_CODE
-#elif defined(HAVE_NEW_GUI)
-#define ENABLE_GUI_CODE HAVE_NEW_GUI
-#else
-#undef ENABLE_GUI_CODE
+#undef HAVE_NEW_GUI
#endif
-#if ENABLE_GUI_CODE
+#ifdef HAVE_NEW_GUI
#include "Gui/interface.h"
extern int use_gui;
#endif
@@ -26,8 +22,6 @@
static int mp_msg_levels[MSGT_MAX]; // verbose level of this module
-#if 1
-
void mp_msg_init(){
#ifdef USE_I18N
#ifdef MP_DEBUG
@@ -57,21 +51,20 @@
return lev <= mp_msg_levels[mod];
}
-void mp_msg_c( int x, const char *format, ... ){
-#if 1
+void mp_msg(int mod, int lev, const char *format, ... ){
va_list va;
char tmp[MSGSIZE_MAX];
- if((x&255)>mp_msg_levels[x>>8]) return; // do not display
+ if (lev > mp_msg_levels[mod]) return; // do not display
va_start(va, format);
vsnprintf(tmp, MSGSIZE_MAX, mp_gettext(format), va);
va_end(va);
tmp[MSGSIZE_MAX-2] = '\n';
tmp[MSGSIZE_MAX-1] = 0;
-#if ENABLE_GUI_CODE
+#ifdef HAVE_NEW_GUI
if(use_gui)
- guiMessageBox(x&255, tmp);
+ guiMessageBox(lev, tmp);
#endif
#ifdef MSG_USE_COLORS
@@ -139,83 +132,21 @@
"NETST",
"MUXER"};
- int c=v_colors[(x & 255)];
- int c2=((x>>8)+1)%15+1;
+ int c=v_colors[lev];
+ int c2=(mod+1)%15+1;
static int header=1;
- FILE *stream= (x & 255) <= MSGL_WARN ? stderr : stdout;
+ FILE *stream= (lev) <= MSGL_WARN ? stderr : stdout;
if(header){
- fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[x>>8]);
+ fprintf(stream, "\033[%d;3%dm%9s\033[0;37m: ",c2>>3,c2&7, mod_text[mod]);
}
fprintf(stream, "\033[%d;3%dm",c>>3,c&7);
header= tmp[strlen(tmp)-1] == '\n'
/*||tmp[strlen(tmp)-1] == '\r'*/;
}
#endif
- if ((x & 255) <= MSGL_WARN){
+ if (lev <= MSGL_WARN){
fprintf(stderr, "%s", tmp);fflush(stderr);
} else {
printf("%s", tmp);fflush(stdout);
}
-
-#else
- va_list va;
- if((x&255)>mp_msg_levels[x>>8]) return; // do not display
- va_start(va, format);
-#if ENABLE_GUI_CODE
- if(use_gui){
- char tmp[16*80];
- vsnprintf( tmp,8*80,format,va ); tmp[8*80-1]=0;
- switch( x&255 ) {
- case MSGL_FATAL:
- fprintf( stderr,"%s",tmp );
- fflush(stderr);
- gtkMessageBox( GTK_MB_FATAL|GTK_MB_SIMPLE,tmp );
- break;
- case MSGL_ERR:
- fprintf( stderr,"%s",tmp );
- fflush(stderr);
- gtkMessageBox( GTK_MB_ERROR|GTK_MB_SIMPLE,tmp );
- break;
- case MSGL_WARN:
- fprintf( stderr, "%s",tmp );
- fflush(stdout);
- gtkMessageBox( GTK_MB_WARNING|GTK_MB_SIMPLE,tmp );
- break;
- default:
- fprintf(stderr, "%s",tmp );
- fflush(stdout);
- }
- } else
-#endif
- if((x&255)<=MSGL_ERR){
-// fprintf(stderr,"%%%%%% ");
- vfprintf(stderr,format, va);
- fflush(stderr);
- } else {
-// printf("%%%%%% ");
- vfprintf(stderr,format, va);
- fflush(stdout);
- }
- va_end(va);
-#endif
-}
-
-#else
-
-FILE *mp_msg_file[MSGT_MAX]; // print message to this file (can be stdout/err)
-static FILE* mp_msg_last_file=NULL;
-
-// how to handle errors->stderr messages->stdout ?
-void mp_msg( int x, const char *format, ... ){
- if((x&255)>mp_msg_levels[x>>8] || !mp_msg_file[x>>8]) return; // do not display
- va_list va;
- va_start(va, format);
- vfprintf(mp_msg_file[x>>8],format, va);
- if(mp_msg_last_file!=mp_msg_file[x>>8]){
- fflush(mp_msg_file[x>>8]);
- mp_msg_last_file=mp_msg_file[x>>8];
- }
- va_end(va);
}
-
-#endif
Index: mp_msg.h
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mp_msg.h 20 Jan 2005 13:22:52 -0000 1.33
+++ mp_msg.h 29 Sep 2005 05:21:12 -0000 1.34
@@ -114,26 +114,17 @@
#endif
#ifdef __GNUC__
-void mp_msg_c( int x, const char *format, ... ) __attribute__ ((format (printf, 2, 3)));
-#define mp_msg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
-
-#ifdef MP_DEBUG
-#define mp_dbg(mod,lev, args... ) mp_msg_c(((mod)<<8)|(lev), ## args )
-#else
-// these messages are only usefull for developers, disable them
-#define mp_dbg(mod,lev, args... )
-#endif
+void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4)));
#else // not GNU C
-void mp_msg_c( int x, const char *format, ... );
-#define mp_msg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
+void mp_msg(int mod, int lev, const char *format, ... );
+#endif
#ifdef MP_DEBUG
-#define mp_dbg(mod,lev, ... ) mp_msg_c(((mod)<<8)|(lev), __VA_ARGS__)
+#define mp_dbg(mod,lev, ... ) mp_msg(mod, lev, __VA_ARGS__)
#else
// these messages are only usefull for developers, disable them
#define mp_dbg(mod,lev, ... )
#endif
-#endif
#endif
#endif
3
3