Discussion:
[libdvdcss-devel] Improve some error and debug messages.
Diego Biurrun
2014-11-18 17:13:24 UTC
Permalink
libdvdcss | branch: master | Diego Biurrun <***@biurrun.de> | Mon Nov 17 21:58:21 2014 +0100| [dde02c78d8e40828fb077ef69d5112edf5cc714d] | committer: Diego Biurrun

Improve some error and debug messages.
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=dde02c78d8e40828fb077ef69d5112edf5cc714d
---

src/css.c | 24 ++++++++++++------------
src/device.c | 13 ++++++-------
src/libdvdcss.c | 4 ++--
3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/css.c b/src/css.c
index 79cbefe..3f4a33b 100644
--- a/src/css.c
+++ b/src/css.c
@@ -124,7 +124,7 @@ int dvdcss_test( dvdcss_t dvdcss )
if( i_ret < 0 )
{
/* Since it's the first ioctl we try to issue, we add a notice */
- print_error( dvdcss, "css error: could not get \"copyright\""
+ print_error( dvdcss, "CSS error: could not get \"copyright\""
" information, make sure there is a DVD in the drive,"
" and that you have used the correct device node." );

@@ -138,7 +138,7 @@ int dvdcss_test( dvdcss_t dvdcss )

if( i_ret < 0 )
{
- print_error( dvdcss, "css error: could not get RPC (Regional Playback "
+ print_error( dvdcss, "CSS error: could not get RPC (Regional Playback "
"Control) status. Assuming RPC-I drive." );
i_type = i_mask = i_rpc = 0;
}
@@ -164,7 +164,7 @@ int dvdcss_test( dvdcss_t dvdcss )

if( i_copyright && i_rpc == 1 && i_type == 0 )
{
- print_error( dvdcss, "css error: drive will prevent access to "
+ print_error( dvdcss, "CSS error: drive will prevent access to "
"scrambled data" );
return -3;
}
@@ -354,8 +354,8 @@ int dvdcss_disckey( dvdcss_t dvdcss )
if( GetASF( dvdcss ) != 1 )
{
/* Region mismatch (or region not set) is the most likely source. */
- print_error( dvdcss,
- "ASF not 1 after reading disc key (region mismatch?)" );
+ print_error( dvdcss, "authentication success flag (ASF) not 1 after "
+ "reading disc key (region mismatch?)" );
ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
return -1;
}
@@ -404,7 +404,7 @@ int dvdcss_disckey( dvdcss_t dvdcss )

default:

- print_debug( dvdcss, "disc key needs not be decrypted" );
+ print_debug( dvdcss, "disc key does not need to be decrypted" );
memset( p_disc_key, 0, DVD_KEY_SIZE );
break;
}
@@ -608,8 +608,8 @@ static int GetBusKey( dvdcss_t dvdcss )
* and try again. */
for( i = 0; i_ret == -1 && i < 4 ; ++i )
{
- print_debug( dvdcss, "ioctl ReportAgid failed, "
- "invalidating AGID %d", i );
+ print_debug( dvdcss, "ioctl ReportAgid failed, invalidating "
+ "authentication grant ID (AGID) %d", i );

/* This is really _not good_, should be handled by the OS.
* Invalidating an AGID could make another process fail somewhere
@@ -617,7 +617,7 @@ static int GetBusKey( dvdcss_t dvdcss )
dvdcss->css.i_agid = i;
ioctl_InvalidateAgid( dvdcss->i_fd, &dvdcss->css.i_agid );

- print_debug( dvdcss, "requesting AGID" );
+ print_debug( dvdcss, "requesting authentication grant ID (AGID)" );
i_ret = ioctl_ReportAgid( dvdcss->i_fd, &dvdcss->css.i_agid );
}

@@ -1544,7 +1544,7 @@ static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
else if( !b_read_error )
{
print_debug( dvdcss, "read error at block %i, resorting to "
- "secret arcanes to recover", i_pos );
+ "arcane secrets to recover", i_pos );

/* Reset the drive before trying to continue */
dvdcss_close_device( dvdcss );
@@ -1556,12 +1556,12 @@ static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
break;
}

- /* Stop when we find a non MPEG stream block.
+ /* Stop when we find a non-MPEG stream block.
* (We must have reached the end of the stream).
* For now, allow all blocks that begin with a start code. */
if( memcmp( p_buf, p_packstart, 3 ) )
{
- print_debug( dvdcss, "non MPEG block found at block %i "
+ print_debug( dvdcss, "block %i is a non-MPEG block "
"(end of title)", i_pos );
break;
}
diff --git a/src/device.c b/src/device.c
index da4ecc4..75c1e6b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -371,7 +371,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
else
#endif /* defined( WIN32 ) || defined( __OS2__ ) */
{
- print_debug( dvdcss, "using libc for access" );
+ print_debug( dvdcss, "using libc API for access" );
dvdcss->pf_seek = libc_seek;
dvdcss->pf_read = libc_read;
dvdcss->pf_readv = libc_readv;
@@ -416,9 +416,8 @@ static int libc_open ( dvdcss_t dvdcss, const char *psz_device )

if( dvdcss->i_fd == -1 )
{
- print_debug( dvdcss, "cannot open %s (%s)",
- psz_device, strerror(errno) );
- print_error( dvdcss, "failed to open device" );
+ print_error( dvdcss, "failed to open device %s (%s)",
+ psz_device, strerror(errno) );
return -1;
}

@@ -451,7 +450,7 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )

if( dvdcss->p_handle == INVALID_HANDLE_VALUE )
{
- print_error( dvdcss, "failed opening device" );
+ print_error( dvdcss, "failed to open device %s", psz_device );
return -1;
}

@@ -478,7 +477,7 @@ static int os2_open ( dvdcss_t dvdcss, const char *psz_device )

if( rc )
{
- print_error( dvdcss, "failed to open device" );
+ print_error( dvdcss, "failed to open device %s", psz_device );
return -1;
}

@@ -702,7 +701,7 @@ static int win2k_readv ( dvdcss_t dvdcss, const struct iovec *p_iovec,
dvdcss->p_readv_buffer = malloc( dvdcss->i_readv_buf_size );
if( !dvdcss->p_readv_buffer )
{
- print_error( dvdcss, " failed (readv)" );
+ print_error( dvdcss, "scatter input (readv) failed" );
dvdcss->i_pos = -1;
return -1;
}
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4bc6821..59a6e16 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -182,8 +182,8 @@ static int set_access_method( dvdcss_t dvdcss )
}
else
{
- print_error( dvdcss, "unknown decrypt method, please choose "
- "from 'title', 'key' or 'disc'" );
+ print_error( dvdcss, "unknown decryption method %s, please choose "
+ "from 'title', 'key' or 'disc'", psz_method );
return -1;
}
return 0;

Loading...