[libdvdcss-devel] [PATCH 3/3] css: Print drive region(s) as debug information
Diego Biurrun
diego at biurrun.de
Mon Nov 17 22:13:39 CET 2014
---
Suggestions for a more elegant way to print this welcome.
src/css.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/css.c b/src/css.c
index caad8f0..d361693 100644
--- a/src/css.c
+++ b/src/css.c
@@ -101,7 +101,9 @@ static int dvdcss_titlekey ( struct dvdcss *, int, dvd_key );
int dvdcss_test( struct dvdcss *dvdcss )
{
const char *psz_type, *psz_rpc;
- int i_ret, i_copyright, i_type, i_mask, i_rpc;
+ char psz_region[16];
+ char *p_region = psz_region;
+ int i_ret, i_copyright, i_type, i_mask, i_rpc, i_region;
i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
@@ -159,8 +161,17 @@ int dvdcss_test( struct dvdcss *dvdcss )
default: psz_type = "unknown status"; break;
}
- print_debug( dvdcss, "drive region mask 0x%x, %s, %s",
- i_mask, psz_rpc, psz_type );
+ for( i_region = 0; i_region < 8; i_region++ )
+ {
+ if( !( i_mask & ( 1 << i_region ) ) )
+ {
+ sprintf(p_region, " %d", i_region + 1);
+ p_region += 2;
+ }
+ }
+
+ print_debug( dvdcss, "drive region(s)%s, region mask 0x%x, %s, %s",
+ psz_region, i_mask, psz_rpc, psz_type );
if( i_copyright && i_rpc == 1 && i_type == 0 )
{
--
2.1.0
More information about the libdvdcss-devel
mailing list