shithub: libdvdcss

Download patch

ref: cabb30c8ff86a6e618567e92ceab8e768e025495
parent: 80a8d0599946bfbe09074f6d0653350270ab01fb
author: Sam Hocevar <sam@videolan.org>
date: Wed Apr 3 18:33:57 EST 2002

* ./test/csstest.c: renamed test.c to csstest.c.

   I hereby declare libdvdcss 1.1.0 ready to ship; it was successfully tested
  on Linux, FreeBSD, MacOS X and BeOS, and compiles on Solaris.


--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@
 1.1.0
 Wed,  3 Apr 2002 18:26:23 +0200
 
+  * ./test/csstest.c: renamed test.c to csstest.c.
+  * ./src/ioctl.c: fixed a Darwin typo recently introduced.
   * ./configure.in: Darwin compile fix (added -no-cpp-precomp).
   * ./libdvdcss.spec: updated specfile for RPM generation.
   * ./missing: commited libtool's latest version of this file.
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 
-noinst_PROGRAMS = test
+noinst_PROGRAMS = csstest
 
-test_SOURCES = test.c
-test_LDADD = $(top_builddir)/src/libdvdcss.la
-test_CFLAGS = -I../src
+csstest_SOURCES = csstest.c
+csstest_LDADD = $(top_builddir)/src/libdvdcss.la
+csstest_CFLAGS = -I../src
 
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -80,15 +80,15 @@
 STRIP = @STRIP@
 VERSION = @VERSION@
 
-noinst_PROGRAMS = test
+noinst_PROGRAMS = csstest
 
-test_SOURCES = test.c
-test_LDADD = $(top_builddir)/src/libdvdcss.la
-test_CFLAGS = -I../src
+csstest_SOURCES = csstest.c
+csstest_LDADD = $(top_builddir)/src/libdvdcss.la
+csstest_CFLAGS = -I../src
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../src/config.h
 CONFIG_CLEAN_FILES = 
-noinst_PROGRAMS =  test$(EXEEXT)
+noinst_PROGRAMS =  csstest$(EXEEXT)
 PROGRAMS =  $(noinst_PROGRAMS)
 
 
@@ -96,9 +96,9 @@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
-test_OBJECTS =  test.$(OBJEXT)
-test_DEPENDENCIES =  $(top_builddir)/src/libdvdcss.la
-test_LDFLAGS = 
+csstest_OBJECTS =  csstest.$(OBJEXT)
+csstest_DEPENDENCIES =  $(top_builddir)/src/libdvdcss.la
+csstest_LDFLAGS = 
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -111,9 +111,9 @@
 
 TAR = tar
 GZIP_ENV = --best
-DEP_FILES =  .deps/test.P
-SOURCES = $(test_SOURCES)
-OBJECTS = $(test_OBJECTS)
+DEP_FILES =  .deps/csstest.P
+SOURCES = $(csstest_SOURCES)
+OBJECTS = $(csstest_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
@@ -173,9 +173,9 @@
 
 maintainer-clean-libtool:
 
-test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES)
-	@rm -f test$(EXEEXT)
-	$(LINK) $(test_LDFLAGS) $(test_OBJECTS) $(test_LDADD) $(LIBS)
+csstest$(EXEEXT): $(csstest_OBJECTS) $(csstest_DEPENDENCIES)
+	@rm -f csstest$(EXEEXT)
+	$(LINK) $(csstest_LDFLAGS) $(csstest_OBJECTS) $(csstest_LDADD) $(LIBS)
 
 tags: TAGS
 
--- /dev/null
+++ b/test/csstest.c
@@ -1,0 +1,91 @@
+/* csstest.c - test program for libdvdcss
+ * 
+ * Samuel Hocevar <sam@zoy.org> - June 2001
+ * Updated on Nov 13th 2001 for libdvdcss version 1.0.0
+ *
+ * This piece of code is public domain */
+
+#include <stdlib.h>
+
+#include <dvdcss/dvdcss.h>
+
+/* Macro to check if a sector is scrambled */
+#define IsSectorScrambled(buf) (((unsigned char*)(buf))[0x14] & 0x30)
+
+/* Print parts of a 2048 bytes buffer */
+void dumpsector( unsigned char * );
+
+int main( int i_argc, char *ppsz_argv[] )
+{
+    dvdcss_handle dvdcss;
+    unsigned char p_buffer[ DVDCSS_BLOCK_SIZE ];
+    unsigned int  i_sector;
+
+    /* Print version number */
+    printf( "cool, I found libdvdcss version %s\n", dvdcss_interface_2 );
+
+    /* Check for 2 arguments */
+    if( i_argc != 3 )
+    {
+        printf( "usage: %s <device> <sector>\n", ppsz_argv[0] );
+        return -1;
+    }
+
+    /* Save the requested sector */
+    i_sector = atoi( ppsz_argv[2] );
+
+    /* Initialize libdvdcss */
+    dvdcss = dvdcss_open( ppsz_argv[1] );
+    if( dvdcss == NULL )
+    {
+        printf( "argh ! couldn't open DVD (%s)\n", ppsz_argv[1] );
+        return -1;
+    }
+
+    /* Set the file descriptor at sector i_sector */
+    dvdcss_seek( dvdcss, i_sector, DVDCSS_NOFLAGS );
+
+    /* Read one sector */
+    dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_NOFLAGS );
+
+    /* Print the sector */
+    printf( "requested sector:\n" );
+    dumpsector( p_buffer );
+
+    /* Check if sector was encrypted */
+    if( IsSectorScrambled( p_buffer ) )
+    {
+        /* Set the file descriptor position to the previous location */
+        /* ... and get the appropriate key for this sector */
+        dvdcss_seek( dvdcss, i_sector, DVDCSS_SEEK_KEY );
+
+        /* Read sector again, and decrypt it on the fly */
+        dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_READ_DECRYPT );
+
+        /* Print the decrypted sector */
+        printf( "unscrambled sector:\n" );
+        dumpsector( p_buffer );
+    }
+    else
+    {
+        printf( "sector is not scrambled\n" );
+    }
+
+    /* Close the device */
+    dvdcss_close( dvdcss );
+
+    return 0;
+}
+
+/* Print parts of a 2048 bytes buffer */
+void dumpsector( unsigned char *p_buffer )
+{
+    int i_amount = 10;
+    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
+    printf( " ... " );
+    i_amount = 25;
+    p_buffer += 200;
+    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
+    printf( " ...\n" );
+}
+
--- a/test/test.c
+++ /dev/null
@@ -1,91 +1,0 @@
-/* csstest.c - test program for libdvdcss
- * 
- * Samuel Hocevar <sam@zoy.org> - June 2001
- * Updated on Nov 13th 2001 for libdvdcss version 1.0.0
- *
- * This piece of code is public domain */
-
-#include <stdlib.h>
-
-#include <dvdcss/dvdcss.h>
-
-/* Macro to check if a sector is scrambled */
-#define IsSectorScrambled(buf) (((unsigned char*)(buf))[0x14] & 0x30)
-
-/* Print parts of a 2048 bytes buffer */
-void dumpsector( unsigned char * );
-
-int main( int i_argc, char *ppsz_argv[] )
-{
-    dvdcss_handle dvdcss;
-    unsigned char p_buffer[ DVDCSS_BLOCK_SIZE ];
-    unsigned int  i_sector;
-
-    /* Print version number */
-    printf( "cool, I found libdvdcss version %s\n", dvdcss_interface_2 );
-
-    /* Check for 2 arguments */
-    if( i_argc != 3 )
-    {
-        printf( "usage: %s <device> <sector>\n", ppsz_argv[0] );
-        return -1;
-    }
-
-    /* Save the requested sector */
-    i_sector = atoi( ppsz_argv[2] );
-
-    /* Initialize libdvdcss */
-    dvdcss = dvdcss_open( ppsz_argv[1] );
-    if( dvdcss == NULL )
-    {
-        printf( "argh ! couldn't open DVD (%s)\n", ppsz_argv[1] );
-        return -1;
-    }
-
-    /* Set the file descriptor at sector i_sector */
-    dvdcss_seek( dvdcss, i_sector, DVDCSS_NOFLAGS );
-
-    /* Read one sector */
-    dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_NOFLAGS );
-
-    /* Print the sector */
-    printf( "requested sector:\n" );
-    dumpsector( p_buffer );
-
-    /* Check if sector was encrypted */
-    if( IsSectorScrambled( p_buffer ) )
-    {
-        /* Set the file descriptor position to the previous location */
-        /* ... and get the appropriate key for this sector */
-        dvdcss_seek( dvdcss, i_sector, DVDCSS_SEEK_KEY );
-
-        /* Read sector again, and decrypt it on the fly */
-        dvdcss_read( dvdcss, p_buffer, 1, DVDCSS_READ_DECRYPT );
-
-        /* Print the decrypted sector */
-        printf( "unscrambled sector:\n" );
-        dumpsector( p_buffer );
-    }
-    else
-    {
-        printf( "sector is not scrambled\n" );
-    }
-
-    /* Close the device */
-    dvdcss_close( dvdcss );
-
-    return 0;
-}
-
-/* Print parts of a 2048 bytes buffer */
-void dumpsector( unsigned char *p_buffer )
-{
-    int i_amount = 10;
-    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
-    printf( " ... " );
-    i_amount = 25;
-    p_buffer += 200;
-    for( ; i_amount ; i_amount--, p_buffer++ ) printf( "%.2x", *p_buffer );
-    printf( " ...\n" );
-}
-