[libdvdcss-devel] [Git][videolan/libdvdcss][master] tools/csstest: improve debugging info

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Jun 5 12:58:55 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdcss


Commits:
d0b6a291 by Francois Cartegnie at 2022-06-05T14:52:02+02:00
tools/csstest: improve debugging info

- - - - -


1 changed file:

- test/csstest.c


Changes:

=====================================
test/csstest.c
=====================================
@@ -12,6 +12,8 @@
 
 #include <dvdcss/dvdcss.h>
 
+#define DVDCSS_DSI_PES 0x400
+
 static int  isscrambled( unsigned char * );
 static void dumpsector ( unsigned char * );
 
@@ -67,7 +69,7 @@ int main( int i_argc, char *ppsz_argv[] )
     }
 
     /* Print the sector */
-    printf( "requested sector: " );
+    printf( "requested sector:\t" );
     dumpsector( p_buffer );
 
     /* Check if sector was encrypted */
@@ -93,7 +95,7 @@ int main( int i_argc, char *ppsz_argv[] )
         }
 
         /* Print the decrypted sector */
-        printf( "unscrambled sector: " );
+        printf( "unscrambled sector:\t" );
         dumpsector( p_buffer );
     }
     else
@@ -113,14 +115,21 @@ static int isscrambled( unsigned char *p_buffer )
     return p_buffer[ 0x14 ] & 0x30;
 }
 
+static void dumpmem( unsigned char *p_buffer, int sz )
+{
+    for( ; sz ; sz--, p_buffer++ )
+        printf( "%.2x", *p_buffer );
+}
+
 /* Print parts of a 2048 bytes buffer */
 static void dumpsector( unsigned char *p_buffer )
 {
-    int i_amount = 4;
-    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
+    /* print pack header and first PES bytes up to flags */
+    dumpmem( &p_buffer[0], 21 );
+    printf( "..." );
+    /* print DSI up to block number */
+    dumpmem( &p_buffer[DVDCSS_DSI_PES], 17 );
     printf( "..." );
-    i_amount = 22;
-    p_buffer += 200;
-    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
-    printf( "...\n" );
+    dumpmem( &p_buffer[DVDCSS_BLOCK_SIZE - 8], 8 );
+    printf( "\n" );
 }



View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/d0b6a291c24eda3727ad5c7a14956fc1fc82446d

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdcss/-/commit/d0b6a291c24eda3727ad5c7a14956fc1fc82446d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdcss-devel mailing list