Skip to content
This repository
Browse code

Merge pull request #2128 from Paxxi/libdvd

updated libdvdcss, read and nav to the latest versions - 4.2.0
  • Loading branch information...
commit 6a384a18007a0a72df4ca444489de9823469a8d9 2 parents 94c518f + 57e27af
Voyager1 authored February 08, 2013

Showing 130 changed files with 4,402 additions and 1,397 deletions. Show diff stats Hide diff stats

  1. 5  .gitignore
  2. 4  lib/libdvd/build-xbmc-win32.sh
  3. 2  lib/libdvd/includes/dvdnav/.ignoreme
  4. 20  lib/libdvd/libdvdcss/AUTHORS
  5. 323  lib/libdvd/libdvdcss/ChangeLog
  6. 8  lib/libdvd/libdvdcss/INSTALL
  7. 2  lib/libdvd/libdvdcss/Makefile.am
  8. 18  lib/libdvd/libdvdcss/NEWS
  9. 24  lib/libdvd/libdvdcss/README
  10. 2  lib/libdvd/libdvdcss/bootstrap
  11. 8  lib/libdvd/libdvdcss/configure.ac
  12. 4  lib/libdvd/libdvdcss/doc/doxygen.cfg.in
  13. 2  lib/libdvd/libdvdcss/doc/footer.html
  14. 2  lib/libdvd/libdvdcss/doc/header.html
  15. 8  lib/libdvd/libdvdcss/src/bsdi_dvd.h
  16. 16  lib/libdvd/libdvdcss/src/common.h
  17. 73  lib/libdvd/libdvdcss/src/css.c
  18. 15  lib/libdvd/libdvdcss/src/css.h
  19. 11  lib/libdvd/libdvdcss/src/csstables.h
  20. 135  lib/libdvd/libdvdcss/src/device.c
  21. 16  lib/libdvd/libdvdcss/src/device.h
  22. 8  lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h
  23. 12  lib/libdvd/libdvdcss/src/error.c
  24. 12  lib/libdvd/libdvdcss/src/ioctl.c
  25. 15  lib/libdvd/libdvdcss/src/ioctl.h
  26. 56  lib/libdvd/libdvdcss/src/libdvdcss.c
  27. 17  lib/libdvd/libdvdcss/src/libdvdcss.h
  28. 13  lib/libdvd/libdvdnav/ChangeLog
  29. 4  lib/libdvd/libdvdnav/Makefile
  30. 2  lib/libdvd/libdvdnav/README
  31. 2  lib/libdvd/libdvdnav/autogen.sh
  32. 27  lib/libdvd/libdvdnav/configure.ac
  33. 2  lib/libdvd/libdvdnav/configure2
  34. 23  lib/libdvd/libdvdnav/examples/menus.c
  35. 4  lib/libdvd/libdvdnav/m4/Makefile.am
  36. 5  lib/libdvd/libdvdnav/msvc/config.h
  37. 3  lib/libdvd/libdvdnav/msvc/contrib/dlfcn.c
  38. 4  lib/libdvd/libdvdnav/msvc/contrib/getopt.c
  39. 4  lib/libdvd/libdvdnav/msvc/contrib/timer/timer.c
  40. 7  lib/libdvd/libdvdnav/msvc/include/dlfcn.h
  41. 15  lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h
  42. 4  lib/libdvd/libdvdnav/msvc/include/getopt.h
  43. 4  lib/libdvd/libdvdnav/msvc/include/inttypes.h
  44. 3  lib/libdvd/libdvdnav/msvc/include/os_types.h
  45. 4  lib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h
  46. 4  lib/libdvd/libdvdnav/msvc/include/pthreads/sched.h
  47. 4  lib/libdvd/libdvdnav/msvc/include/sys/time.h
  48. 4  lib/libdvd/libdvdnav/msvc/include/unistd.h
  49. 4  lib/libdvd/libdvdnav/src/Makefile.am
  50. 51  lib/libdvd/libdvdnav/src/dvdnav.c
  51. 17  lib/libdvd/libdvdnav/src/{ → dvdnav}/dvd_types.h
  52. 71  lib/libdvd/libdvdnav/src/{ → dvdnav}/dvdnav.h
  53. 15  lib/libdvd/libdvdnav/src/{ → dvdnav}/dvdnav_events.h
  54. 31  lib/libdvd/libdvdnav/src/dvdnav_internal.h
  55. 16  lib/libdvd/libdvdnav/src/highlight.c
  56. 92  lib/libdvd/libdvdnav/src/navigation.c
  57. 12  lib/libdvd/libdvdnav/src/read_cache.c
  58. 15  lib/libdvd/libdvdnav/src/read_cache.h
  59. 13  lib/libdvd/libdvdnav/src/remap.c
  60. 14  lib/libdvd/libdvdnav/src/remap.h
  61. 68  lib/libdvd/libdvdnav/src/searching.c
  62. 12  lib/libdvd/libdvdnav/src/settings.c
  63. 14  lib/libdvd/libdvdnav/src/vm/decoder.c
  64. 17  lib/libdvd/libdvdnav/src/vm/decoder.h
  65. 183  lib/libdvd/libdvdnav/src/vm/vm.c
  66. 21  lib/libdvd/libdvdnav/src/vm/vm.h
  67. 14  lib/libdvd/libdvdnav/src/vm/vmcmd.c
  68. 17  lib/libdvd/libdvdnav/src/vm/vmcmd.h
  69. 2  lib/libdvd/libdvdnav/version.h
  70. 36  lib/libdvd/libdvdnav/version.sh
  71. 18  lib/libdvd/libdvdread/ChangeLog
  72. 18  lib/libdvd/libdvdread/Makefile
  73. 2  lib/libdvd/libdvdread/README
  74. 2  lib/libdvd/libdvdread/autogen.sh
  75. 29  lib/libdvd/libdvdread/configure.ac
  76. 16  lib/libdvd/libdvdread/configure2
  77. 4  lib/libdvd/libdvdread/m4/Makefile.am
  78. 5  lib/libdvd/libdvdread/msvc/config.h
  79. 3  lib/libdvd/libdvdread/msvc/contrib/dlfcn.c
  80. 4  lib/libdvd/libdvdread/msvc/contrib/getopt.c
  81. 4  lib/libdvd/libdvdread/msvc/contrib/timer/timer.c
  82. 7  lib/libdvd/libdvdread/msvc/include/dlfcn.h
  83. 15  lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h
  84. 4  lib/libdvd/libdvdread/msvc/include/getopt.h
  85. 4  lib/libdvd/libdvdread/msvc/include/inttypes.h
  86. 3  lib/libdvd/libdvdread/msvc/include/os_types.h
  87. 10  lib/libdvd/libdvdread/msvc/include/pthreads/pthread.h
  88. 4  lib/libdvd/libdvdread/msvc/include/pthreads/sched.h
  89. 6  lib/libdvd/libdvdread/msvc/include/sys/time.h
  90. 8  lib/libdvd/libdvdread/msvc/include/unistd.h
  91. 4  lib/libdvd/libdvdread/src/Makefile.am
  92. 18  lib/libdvd/libdvdread/src/bitreader.c
  93. 24  lib/libdvd/libdvdread/src/bswap.h
  94. 27  lib/libdvd/libdvdread/src/dvd_input.c
  95. 27  lib/libdvd/libdvdread/src/dvd_input.h
  96. 334  lib/libdvd/libdvdread/src/dvd_reader.c
  97. 112  lib/libdvd/libdvdread/src/dvd_udf.c
  98. 21  lib/libdvd/libdvdread/src/{ → dvdread}/bitreader.h
  99. 70  lib/libdvd/libdvdread/src/{ → dvdread}/dvd_reader.h
  100. 36  lib/libdvd/libdvdread/src/{ → dvdread}/dvd_udf.h
  101. 28  lib/libdvd/libdvdread/src/dvdread/ifo_print.h
  102. 26  lib/libdvd/libdvdread/src/{ → dvdread}/ifo_read.h
  103. 32  lib/libdvd/libdvdread/src/{ → dvdread}/ifo_types.h
  104. 32  lib/libdvd/libdvdread/src/{ → dvdread}/nav_print.h
  105. 22  lib/libdvd/libdvdread/src/{ → dvdread}/nav_read.h
  106. 19  lib/libdvd/libdvdread/src/{ → dvdread}/nav_types.h
  107. 36  lib/libdvd/libdvdread/src/dvdread_internal.h
  108. 174  lib/libdvd/libdvdread/src/ifo_print.c
  109. 53  lib/libdvd/libdvdread/src/ifo_print.h
  110. 232  lib/libdvd/libdvdread/src/ifo_read.c
  111. 6  lib/libdvd/libdvdread/src/md5.c
  112. 8  lib/libdvd/libdvdread/src/md5.h
  113. 16  lib/libdvd/libdvdread/src/nav_print.c
  114. 22  lib/libdvd/libdvdread/src/nav_read.c
  115. 2  lib/libdvd/libdvdread/version.h
  116. 545  lib/libdvd/patches/cores.diff
  117. 365  lib/libdvd/patches/libdvdcss.diff
  118. 766  lib/libdvd/patches/libdvdnav.diff
  119. 296  lib/libdvd/patches/libdvdread.diff
  120. 17  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/decoder.h
  121. 74  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_reader.h
  122. 22  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h
  123. 126  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav.h
  124. 16  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_events.h
  125. 45  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_internal.h
  126. 205  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/ifo_types.h
  127. 19  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/nav_types.h
  128. 14  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/remap.h
  129. 30  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h
  130. 17  xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vmcmd.h
5  .gitignore
@@ -631,6 +631,11 @@ lib/cmyth/Makefile
631 631
 /lib/libdvd/includes/dvdread/ifo_read.h
632 632
 /lib/libdvd/includes/dvdread/nav_types.h
633 633
 
  634
+# /lib/libdvd/includes/dvdnav
  635
+/lib/libdvd/includes/dvdnav/dvd_types.h
  636
+/lib/libdvd/includes/dvdnav/dvdnav.h
  637
+/lib/libdvd/includes/dvdnav/dvdnav_events.h
  638
+
634 639
 # /lib/libdvd/libdvdcss/
635 640
 /lib/libdvd/libdvdcss/.auto/
636 641
 /lib/libdvd/libdvdcss/Makefile.in
4  lib/libdvd/build-xbmc-win32.sh
@@ -47,7 +47,7 @@ echo "***** Building libdvdread *****"
47 47
       --extra-cflags="-DHAVE_DVDCSS_DVDCSS_H -D_XBMC -DNDEBUG -D_MSC_VER -I`pwd`/../includes" \
48 48
       --disable-debug
49 49
 mkdir -p ../includes/dvdread
50  
-cp ../libdvdread/src/*.h ../includes/dvdread
  50
+cp ../libdvdread/src/dvdread/*.h ../includes/dvdread
51 51
 make $MAKEFLAGS
52 52
 cd ..
53 53
 
@@ -65,6 +65,8 @@ echo "***** Building libdvdnav *****"
65 65
       --extra-cflags="-D_XBMC -DNDEBUG -I`pwd`/../includes" \
66 66
       --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
67 67
       --disable-debug
  68
+mkdir -p ../includes/dvdnav
  69
+cp ../libdvdnav/src/dvdnav/*.h ../includes/dvdnav
68 70
 make $MAKEFLAGS
69 71
 gcc \
70 72
       -shared \
2  lib/libdvd/includes/dvdnav/.ignoreme
... ...
@@ -0,0 +1,2 @@
  1
+Dummy file so that this directory shows up for git users.
  2
+Ignore this file.
20  lib/libdvd/libdvdcss/AUTHORS
@@ -2,7 +2,7 @@
2 2
 # 
3 3
 # Authors and contributors are listed alphabetically.
4 4
 # 
5  
-# The fields are: name (N), email (E), web-address (W), CVS account login (C),
  5
+# The fields are: name (N), email (E), web-address (W), CVS/SVN account login (C),
6 6
 # PGP key ID and fingerprint (P), description (D), and snail-mail address (S).
7 7
 
8 8
 N: Billy Biggs 
@@ -20,6 +20,7 @@ D: cache bug fix for discs with identical content but different keys
20 20
 
21 21
 N: Håkan Hjort
22 22
 E: d95hjort@dtek.chalmers.se
  23
+C: hjort
23 24
 D: Solaris port of the DVD ioctls
24 25
 D: libdvdcss enhancements
25 26
 
@@ -39,6 +40,15 @@ C: jlj
39 40
 D: Win32 port
40 41
 D: Fixes to the Darwin port
41 42
 
  43
+N: KO Myung-Hun
  44
+E: komh@chollian.net
  45
+D: OS/2 port
  46
+
  47
+N: Jean-Baptiste Kempf
  48
+C: jb
  49
+E: jb@videolan.org
  50
+D: maintainer
  51
+
42 52
 N: Markus Kuespert
43 53
 E: ltlBeBoy@beosmail.com
44 54
 D: BeOS port of the DVD ioctls
@@ -47,6 +57,14 @@ N: Pascal Levesque
47 57
 E: Pascal.Levesque@mindready.com
48 58
 D: QNX port
49 59
 
  60
+N: Steve Lhomme
  61
+E: steve.lhomme@free.fr
  62
+D: win32 improvements
  63
+
  64
+N: Christophe Massiot
  65
+E: massiot@via.ecp.fr
  66
+D: former maintainer
  67
+
50 68
 N: Steven M. Schultz
51 69
 E: sms@TO.GD-ES.COM
52 70
 D: BSD/OS port
323  lib/libdvd/libdvdcss/ChangeLog
... ...
@@ -1,4 +1,327 @@
1 1
 ------------------------------------------------------------------------
  2
+r251 | jb | 2012-03-11 13:33:49 +0000 (Sun, 11 Mar 2012) | 3 lines
  3
+Changed paths:
  4
+   M /trunk/NEWS
  5
+   M /trunk/configure.ac
  6
+   M /trunk/doc/doxygen.cfg.in
  7
+
  8
+Prepare 1.2.12
  9
+
  10
+
  11
+------------------------------------------------------------------------
  12
+r250 | jb | 2012-03-11 12:37:40 +0000 (Sun, 11 Mar 2012) | 3 lines
  13
+Changed paths:
  14
+   M /trunk/AUTHORS
  15
+
  16
+Update Authors file
  17
+
  18
+
  19
+------------------------------------------------------------------------
  20
+r249 | jb | 2012-02-18 16:22:03 +0000 (Sat, 18 Feb 2012) | 4 lines
  21
+Changed paths:
  22
+   M /trunk/src/css.c
  23
+
  24
+If unsure, assume the drive is of RPC-I type
  25
+
  26
+This can happen when patched drives do not answer to ioctl_ReportRPC correctly
  27
+
  28
+------------------------------------------------------------------------
  29
+r247 | jb | 2011-11-14 10:40:05 +0000 (Mon, 14 Nov 2011) | 3 lines
  30
+Changed paths:
  31
+   M /trunk/ChangeLog
  32
+
  33
+Update Changelog
  34
+
  35
+
  36
+------------------------------------------------------------------------
  37
+r246 | jb | 2011-11-14 10:27:32 +0000 (Mon, 14 Nov 2011) | 3 lines
  38
+Changed paths:
  39
+   M /trunk/NEWS
  40
+   M /trunk/configure.ac
  41
+   M /trunk/doc/doxygen.cfg.in
  42
+   M /trunk/msvc/config.h
  43
+
  44
+Bumping version to 1.2.11
  45
+
  46
+
  47
+------------------------------------------------------------------------
  48
+r245 | jb | 2011-11-14 10:26:47 +0000 (Mon, 14 Nov 2011) | 3 lines
  49
+Changed paths:
  50
+   M /trunk/INSTALL
  51
+   M /trunk/README
  52
+
  53
+Update README and INSTALL to be a bit less out-of-date
  54
+
  55
+
  56
+------------------------------------------------------------------------
  57
+r244 | jb | 2011-10-26 05:10:24 +0000 (Wed, 26 Oct 2011) | 3 lines
  58
+Changed paths:
  59
+   M /trunk/Makefile.am
  60
+
  61
+Fix "doc" Makefile target
  62
+
  63
+
  64
+------------------------------------------------------------------------
  65
+r243 | jb | 2011-10-26 05:01:11 +0000 (Wed, 26 Oct 2011) | 12 lines
  66
+Changed paths:
  67
+   M /trunk/src/common.h
  68
+
  69
+Win32: Drop #define of snprintf() to _snprintf() if the former is undefined.
  70
+
  71
+This workaround was added for MinGW originally, but nowadays MinGW supports
  72
+snprintf() directly so it has become unnecessary.
  73
+
  74
+Furthermore this can play havoc with Cygwin which does not have a _snprintf()
  75
+declaration and gives implicit function declaration warnings. Depending on
  76
+compiler flags, this can be a fatal error.
  77
+
  78
+Patch by Diego Biurrun - diego at biurrun d0t de
  79
+
  80
+
  81
+------------------------------------------------------------------------
  82
+r242 | jb | 2011-10-26 04:59:23 +0000 (Wed, 26 Oct 2011) | 8 lines
  83
+Changed paths:
  84
+   M /trunk/src/device.c
  85
+
  86
+Win32: consistently use snprintf() instead of _snprintf()
  87
+
  88
+Both functions are available on Cygwin and MinGW nowadays so there is
  89
+no need to be inconsistent anymore.
  90
+
  91
+Patch by Diego Biurrun - diego at biurrun d0t de
  92
+
  93
+
  94
+------------------------------------------------------------------------
  95
+r241 | jb | 2011-08-16 10:41:24 +0000 (Tue, 16 Aug 2011) | 4 lines
  96
+Changed paths:
  97
+   M /trunk/INSTALL
  98
+   M /trunk/README
  99
+
  100
+Fix typos in README and INSTALL
  101
+
  102
+Patch by bryce, ref http://trac.videolan.org/vlc/ticket/5200
  103
+
  104
+------------------------------------------------------------------------
  105
+r240 | jb | 2011-03-23 15:00:06 +0000 (Wed, 23 Mar 2011) | 3 lines
  106
+Changed paths:
  107
+   M /trunk/src/libdvdcss.h
  108
+
  109
+Remove excessive whitespace
  110
+
  111
+
  112
+------------------------------------------------------------------------
  113
+r239 | jb | 2011-03-23 14:59:36 +0000 (Wed, 23 Mar 2011) | 5 lines
  114
+Changed paths:
  115
+   M /trunk/src/css.c
  116
+
  117
+Fix a small memleak
  118
+
  119
+Reported by Thélesphonse Bigorneault
  120
+
  121
+
  122
+------------------------------------------------------------------------
  123
+r238 | jb | 2011-02-09 22:48:29 +0000 (Wed, 09 Feb 2011) | 3 lines
  124
+Changed paths:
  125
+   M /trunk/doc/doxygen.cfg.in
  126
+
  127
+Update documentation version
  128
+
  129
+
  130
+------------------------------------------------------------------------
  131
+r237 | reimar | 2010-09-25 14:21:47 +0000 (Sat, 25 Sep 2010) | 3 lines
  132
+Changed paths:
  133
+   M /trunk/src/libdvdcss.c
  134
+
  135
+Ensure dvdcss->css.p_disc_key is always initialized,
  136
+even if _dvdcss_disckey fails.
  137
+
  138
+------------------------------------------------------------------------
  139
+r236 | jb | 2010-08-02 15:59:13 +0000 (Mon, 02 Aug 2010) | 9 lines
  140
+Changed paths:
  141
+   M /trunk/src/css.h
  142
+   M /trunk/src/device.h
  143
+   M /trunk/src/libdvdcss.h
  144
+
  145
+Make libdvdcss headers self-sufficient
  146
+
  147
+This patch adds required #includes to libdvdcss headers so that they can be used
  148
+without other headers as prerequisites.
  149
+This leaves out limits.h and stdint.h, for the moment, since they aren't on all systems.
  150
+
  151
+Patch by Diego Biurrun - diego at biurrun d0t de
  152
+
  153
+
  154
+------------------------------------------------------------------------
  155
+r235 | jb | 2010-08-02 15:41:14 +0000 (Mon, 02 Aug 2010) | 8 lines
  156
+Changed paths:
  157
+   M /trunk/src/common.h
  158
+   M /trunk/src/css.h
  159
+   M /trunk/src/csstables.h
  160
+   M /trunk/src/device.h
  161
+   M /trunk/src/ioctl.h
  162
+   M /trunk/src/libdvdcss.h
  163
+
  164
+Add multiple inclusion guards to header files
  165
+
  166
+Most header files in libdvdcss lack multiple inclusion guards, although they are
  167
+a sensible thing to have for header files. This adds them where currently missing.
  168
+
  169
+Patch by Diego Biurrun - diego at biurrun d0t de
  170
+
  171
+
  172
+------------------------------------------------------------------------
  173
+r234 | jb | 2010-08-02 15:38:08 +0000 (Mon, 02 Aug 2010) | 7 lines
  174
+Changed paths:
  175
+   M /trunk/src/bsdi_dvd.h
  176
+
  177
+Use filename as multiple inclusion guard
  178
+
  179
+For some reason bsdi_dvd.h does not use the (full) filename as multiple
  180
+inclusion guard.
  181
+
  182
+Patch by Diego Biurrun - diego at biurrun d0t de
  183
+
  184
+------------------------------------------------------------------------
  185
+r233 | jb | 2010-08-02 14:04:16 +0000 (Mon, 02 Aug 2010) | 7 lines
  186
+Changed paths:
  187
+   M /trunk/doc/doxygen.cfg.in
  188
+
  189
+Shut up doxygen run
  190
+
  191
+Doxygen is terribly verbose by default and spams the console with useless by
  192
+the metric ton. This patch makes its output more terse and thus more sensible.
  193
+
  194
+Patch by Diego Biurrun - diego at biurrun d0t de
  195
+
  196
+------------------------------------------------------------------------
  197
+r232 | jb | 2010-08-02 13:56:10 +0000 (Mon, 02 Aug 2010) | 4 lines
  198
+Changed paths:
  199
+   M /trunk/src
  200
+
  201
+svn:ignore src/libdvdcss.pc
  202
+
  203
+As tipped by Diego
  204
+
  205
+------------------------------------------------------------------------
  206
+r231 | jb | 2010-05-10 10:03:06 +0000 (Mon, 10 May 2010) | 5 lines
  207
+Changed paths:
  208
+   M /trunk/src/css.c
  209
+
  210
+Try other methods also if GetBusKey fails instead of failing completely
  211
+
  212
+Patch from MPlayer, from Reimar Döffinger, forwarded by Diego Biurrun
  213
+
  214
+
  215
+------------------------------------------------------------------------
  216
+r230 | sam | 2009-09-02 22:07:32 +0000 (Wed, 02 Sep 2009) | 3 lines
  217
+Changed paths:
  218
+   M /trunk/src/libdvdcss.c
  219
+   M /trunk/src/libdvdcss.h
  220
+
  221
+Remove the RPC-II sanity check and only issue a warning. Capable drives are
  222
+far too common.
  223
+
  224
+------------------------------------------------------------------------
  225
+r229 | sam | 2009-09-02 22:01:07 +0000 (Wed, 02 Sep 2009) | 2 lines
  226
+Changed paths:
  227
+   M /trunk/src/device.c
  228
+
  229
+Use 64-bit IO and binary mode on OS/2. Patch courtesy of KO Myung-Hun.
  230
+
  231
+------------------------------------------------------------------------
  232
+r228 | sam | 2009-05-13 21:28:53 +0000 (Wed, 13 May 2009) | 1 line
  233
+Changed paths:
  234
+   M /trunk/src/css.c
  235
+
  236
+Prepend 0x to the region mask for clarity.
  237
+------------------------------------------------------------------------
  238
+r227 | sam | 2009-05-13 21:00:31 +0000 (Wed, 13 May 2009) | 1 line
  239
+Changed paths:
  240
+   M /trunk/src/libdvdcss.c
  241
+
  242
+Duh, typo in the RPC-II sanity check.
  243
+------------------------------------------------------------------------
  244
+r226 | sam | 2009-05-13 20:54:40 +0000 (Wed, 13 May 2009) | 2 lines
  245
+Changed paths:
  246
+   M /trunk/src/libdvdcss.c
  247
+   M /trunk/src/libdvdcss.h
  248
+
  249
+Add support for the DVDCSS_IGNORE_RPC environment variable in order to
  250
+bypass our new RPC-II sanity check.
  251
+------------------------------------------------------------------------
  252
+r225 | sam | 2009-05-13 20:54:39 +0000 (Wed, 13 May 2009) | 1 line
  253
+Changed paths:
  254
+   M /trunk/src/css.c
  255
+
  256
+Add a debug message in the copyright information retrieval.
  257
+------------------------------------------------------------------------
  258
+r224 | sam | 2009-05-13 20:54:37 +0000 (Wed, 13 May 2009) | 3 lines
  259
+Changed paths:
  260
+   M /trunk/src/css.c
  261
+   M /trunk/src/libdvdcss.c
  262
+
  263
+Check drive's RPC status before trying to access a scrambled disc. Patch
  264
+provided by Ori Avtalion <ori@avtalion.name> and refactored by Sam Hocevar
  265
+<sam@hocevar.net>.
  266
+------------------------------------------------------------------------
  267
+r223 | sam | 2009-05-13 20:54:35 +0000 (Wed, 13 May 2009) | 1 line
  268
+Changed paths:
  269
+   M /trunk/src/libdvdcss.c
  270
+
  271
+Fix a potential format string crash.
  272
+------------------------------------------------------------------------
  273
+r221 | sam | 2009-02-09 00:45:44 +0000 (Mon, 09 Feb 2009) | 1 line
  274
+Changed paths:
  275
+   M /trunk/src/css.c
  276
+   M /trunk/src/device.c
  277
+   M /trunk/src/error.c
  278
+   M /trunk/src/ioctl.c
  279
+   M /trunk/src/libdvdcss.c
  280
+
  281
+Remove occurrences of "this program" from the license headers.
  282
+------------------------------------------------------------------------
  283
+r220 | sam | 2009-02-09 00:45:33 +0000 (Mon, 09 Feb 2009) | 1 line
  284
+Changed paths:
  285
+   M /trunk/AUTHORS
  286
+   M /trunk/configure.ac
  287
+   M /trunk/src/device.c
  288
+   M /trunk/src/device.h
  289
+   M /trunk/src/libdvdcss.c
  290
+   M /trunk/src/libdvdcss.h
  291
+
  292
+Adding OS/2 support, courtesy of KO Myung-Hun <komh@chollian.net>.
  293
+------------------------------------------------------------------------
  294
+r219 | jb | 2009-02-09 00:03:47 +0000 (Mon, 09 Feb 2009) | 5 lines
  295
+Changed paths:
  296
+   M /trunk/src/common.h
  297
+   M /trunk/src/css.c
  298
+   M /trunk/src/css.h
  299
+   M /trunk/src/csstables.h
  300
+   M /trunk/src/device.c
  301
+   M /trunk/src/device.h
  302
+   M /trunk/src/dvdcss/dvdcss.h
  303
+   M /trunk/src/error.c
  304
+   M /trunk/src/ioctl.c
  305
+   M /trunk/src/ioctl.h
  306
+   M /trunk/src/libdvdcss.c
  307
+   M /trunk/src/libdvdcss.h
  308
+
  309
+Update the FSF address.
  310
+
  311
+Patch by Diego Biurrun
  312
+
  313
+
  314
+------------------------------------------------------------------------
  315
+r218 | sam | 2008-08-29 19:00:14 +0000 (Fri, 29 Aug 2008) | 2 lines
  316
+Changed paths:
  317
+   M /trunk/ChangeLog
  318
+   M /trunk/NEWS
  319
+   M /trunk/configure.ac
  320
+   M /trunk/msvc/config.h
  321
+
  322
+  * Bump version number to 1.2.10.
  323
+  * Update NEWS and ChangeLog.
  324
+------------------------------------------------------------------------
2 325
 r217 | sam | 2008-08-29 18:57:52 +0000 (Fri, 29 Aug 2008) | 2 lines
3 326
 Changed paths:
4 327
    M /trunk/src/Makefile.am
8  lib/libdvd/libdvdcss/INSTALL
@@ -10,6 +10,12 @@ A typical way to configure libdvdcss is:
10 10
 
11 11
 See `./configure --help' for more information.
12 12
 
  13
+
  14
+If you got libdvdcss from its version control system, please bootstrap first:
  15
+ 
  16
+   ./bootstrap
  17
+
  18
+
13 19
 Building libdvdcss
14 20
 ==================
15 21
 
@@ -34,7 +40,7 @@ You have two alternatives to build libdvdcss for Win32:
34 40
 
35 41
 - natively on Windows, using MSYS + MINGW (www.mingw.org):
36 42
 
37  
- (MSYS is a minimal build environnement to compile unixish projects under
  43
+ (MSYS is a minimal build environment to compile unixish projects under
38 44
   windoze. It provides all the common unix tools like sh, gmake...)
39 45
 
40 46
  You will need to download and install the latest MSYS (version 1.0.7 as
2  lib/libdvd/libdvdcss/Makefile.am
@@ -8,5 +8,5 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 subdir-objects
8 8
 doc-dummy:
9 9
 
10 10
 doc: doc-dummy
11  
-	$(MAKE) -C doc doc
  11
+	$(MAKE) -C doc
12 12
 
18  lib/libdvd/libdvdcss/NEWS
... ...
@@ -1,4 +1,20 @@
1  
-$Id$
  1
+$Id: NEWS 251 2012-03-11 13:33:49Z jb $
  2
+
  3
+Changes between 1.2.11 and 1.2.12:
  4
+----------------------------------
  5
+
  6
+  * fix regression on RPC-I drives handling.
  7
+
  8
+
  9
+Changes between 1.2.10 and 1.2.11:
  10
+----------------------------------
  11
+
  12
+  * improvements on RPC-II handling.
  13
+  * more robust key retrieval.
  14
+  * fixes for MingW compilation.
  15
+  * fixes for OS/2 compilation.
  16
+  * various bug fixes for small issues, memleaks, crashes and build issues.
  17
+
2 18
 
3 19
 Changes between 1.2.9 and 1.2.10:
4 20
 ---------------------------------
24  lib/libdvd/libdvdcss/README
... ...
@@ -1,13 +1,13 @@
1 1
 README for libdvdcss, a portable abstraction library for DVD decryption
2  
-$Id$
  2
+$Id: README 245 2011-11-14 10:26:47Z jb $
3 3
 
4 4
 
5 5
 Introduction
6 6
 ============
7 7
 
8  
-libdvdcss is part of the VideoLAN project, a full MPEG2 client/server
9  
-solution. The VideoLAN Client can also be used as a standalone program
10  
-to play MPEG2 streams from a hard disk or a DVD.
  8
+libdvdcss is part of the VideoLAN project, a full video client/server
  9
+streaming solution. VLC can also be used as a standalone program
  10
+to play video streams from a hard disk or a DVD.
11 11
 
12 12
 
13 13
 Building and Installing libdvdcss
@@ -23,7 +23,7 @@ variables:
23 23
   DVDCSS_METHOD={title|disc|key}: method for key decryption
24 24
     title: decrypted title key is guessed from the encrypted sectors of
25 25
            the stream. Thus it should work with a file as well as the
26  
-           DVD device. But it sometimes takes much time to decrypt a title
  26
+           DVD device. But it sometimes takes too much time to decrypt a title
27 27
            key and may even fail. With this method, the key is only checked
28 28
            at the beginning of each title, so it won't work if the key
29 29
            changes in the middle of a title.
@@ -33,7 +33,7 @@ variables:
33 33
            compilation time. If you do, the decryption of the disc key
34 34
            will be faster with this method. It is the one that was used by
35 35
            libcss.
36  
-           This is the default method,
  36
+           This is the default method.
37 37
   DVDCSS_VERBOSE={0|1|2}: libdvdcss verbosity
38 38
     0: no error messages, no debug messages (this is the default)
39 39
     1: only error messages
@@ -46,17 +46,11 @@ Troubleshooting
46 46
 A mailing-list has been set up for support and discussion about
47 47
 libdvdcss. Its address is :
48 48
 
49  
-   <libdvdcss@videolan.org>
  49
+   <libdvdcss-devel@videolan.org>
50 50
 
51  
-To subscribe, send a mail to <listar@videolan.org> with the following
52  
-words in the mail body :
53  
-
54  
-   subscribe libdvdcss
55  
-
56  
-To unsubscribe, do the same with the words :
57  
-
58  
-   unsubscribe libdvdcss
  51
+To subscribe or unsubscribe, go to:
59 52
 
  53
+   http://mailman.videolan.org/
60 54
 
61 55
 When reporting bugs, try to be as precise as possible (which OS, which
62 56
 distribution, what plugins you were trying, and so on).
2  lib/libdvd/libdvdcss/bootstrap
... ...
@@ -1,5 +1,5 @@
1 1
 #! /bin/sh
2  
-# $Id: bootstrap 2005 2008-07-16 20:51:50Z sam $
  2
+# $Id: bootstrap 214 2008-08-29 18:57:45Z sam $
3 3
 
4 4
 # bootstrap: generic bootstrap/autogen.sh script for autotools projects
5 5
 #
8  lib/libdvd/libdvdcss/configure.ac
@@ -4,8 +4,8 @@ AC_PREREQ(2.50)
4 4
 AC_CONFIG_AUX_DIR(.auto)
5 5
 AC_CANONICAL_SYSTEM
6 6
 
7  
-AM_INIT_AUTOMAKE(libdvdcss, 1.2.10)
8  
-AC_CONFIG_HEADERS(config.h)
  7
+AM_INIT_AUTOMAKE(libdvdcss, 1.2.12)
  8
+AM_CONFIG_HEADER(config.h)
9 9
 
10 10
 AC_PROG_CC
11 11
 AC_STDC_HEADERS
@@ -38,6 +38,10 @@ case x"${target_os}" in
38 38
   xbeos*)
39 39
     AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
40 40
     ;;
  41
+  xos2*)
  42
+    LDFLAGS="-Zbin-files"
  43
+    AC_DEFINE(SYS_OS2, 1, Have a OS/2 system.)
  44
+    ;;
41 45
   x*msvc*)
42 46
     SYS_MSVC=1
43 47
     ;;
4  lib/libdvd/libdvdcss/doc/doxygen.cfg.in
@@ -31,7 +31,7 @@ PROJECT_NAME           = libdvdcss
31 31
 # This could be handy for archiving the generated documentation or 
32 32
 # if some version control system is used.
33 33
 
34  
-PROJECT_NUMBER         = 1.2.5
  34
+PROJECT_NUMBER         = 1.2.12
35 35
 
36 36
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
37 37
 # base path where the generated documentation will be put. 
@@ -481,7 +481,7 @@ FILE_VERSION_FILTER    =
481 481
 # The QUIET tag can be used to turn on/off the messages that are generated 
482 482
 # by doxygen. Possible values are YES and NO. If left blank NO is used.
483 483
 
484  
-QUIET                  = NO
  484
+QUIET                  = YES
485 485
 
486 486
 # The WARNINGS tag can be used to turn on/off the warning messages that are 
487 487
 # generated by doxygen. Possible values are YES and NO. If left blank 
2  lib/libdvd/libdvdcss/doc/footer.html
... ...
@@ -1,3 +1,3 @@
2  lib/libdvd/libdvdcss/doc/header.html
@@ -7,4 +7,4 @@
7 7
     <link href="/doxygen.css" rel="stylesheet" type="text/css">
8 8
   </head>
9 9
   <body>
10  
-<!-- $Id$ -->
  10
+<!-- $Id: header.html 186 2005-09-04 07:43:15Z robux4 $ -->
8  lib/libdvd/libdvdcss/src/bsdi_dvd.h
... ...
@@ -1,9 +1,9 @@
1 1
 /*
2  
- * $Id$
  2
+ * $Id: bsdi_dvd.h 234 2010-08-02 15:38:08Z jb $
3 3
 */
4 4
 
5  
-#ifndef	DVDCSS_DVD_H
6  
-#define	DVDCSS_DVD_H
  5
+#ifndef DVDCSS_BSDI_DVD_H
  6
+#define DVDCSS_BSDI_DVD_H
7 7
 
8 8
 #include <sys/cdefs.h>
9 9
 #include <machine/endian.h>
@@ -341,4 +341,4 @@ typedef	struct
341 341
 	int	error;
342 342
 } tracktype;
343 343
 
344  
-#endif /* DVDCSS_DVD_H */
  344
+#endif /* DVDCSS_BSDI_DVD_H */
16  lib/libdvd/libdvdcss/src/common.h
@@ -3,7 +3,7 @@
3 3
  * Collection of useful common types and macros definitions
4 4
  *****************************************************************************
5 5
  * Copyright (C) 1998, 1999, 2000 VideoLAN
6  
- * $Id$
  6
+ * $Id: common.h 243 2011-10-26 05:01:11Z jb $
7 7
  *
8 8
  * Authors: Sam Hocevar <sam@via.ecp.fr>
9 9
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -19,11 +19,14 @@
19 19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 20
  * GNU General Public License for more details.
21 21
  *
22  
- * You should have received a copy of the GNU General Public License
23  
- * along with this program; if not, write to the Free Software
24  
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  22
+ * You should have received a copy of the GNU General Public License along
  23
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
  24
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 25
  *****************************************************************************/
26 26
 
  27
+#ifndef DVDCSS_COMMON_H
  28
+#define DVDCSS_COMMON_H
  29
+
27 30
 /*****************************************************************************
28 31
  * Basic types definitions
29 32
  *****************************************************************************/
@@ -73,9 +76,6 @@ typedef __int64 off_t;
73 76
 #       define stat _stati64
74 77
 #   endif
75 78
 
76  
-#   ifndef snprintf
77  
-#       define snprintf _snprintf  /* snprintf not defined in mingw32 (bug?) */
78  
-#   endif
79  
-
80 79
 #endif
81 80
 
  81
+#endif /* DVDCSS_COMMON_H */
73  lib/libdvd/libdvdcss/src/css.c
@@ -2,7 +2,7 @@
2 2
  * css.c: Functions for DVD authentication and descrambling
3 3
  *****************************************************************************
4 4
  * Copyright (C) 1999-2008 VideoLAN
5  
- * $Id$
  5
+ * $Id: css.c 249 2012-02-18 16:22:03Z jb $
6 6
  *
7 7
  * Authors: Stéphane Borel <stef@via.ecp.fr>
8 8
  *          Håkan Hjort <d95hjort@dtek.chalmers.se>
@@ -16,19 +16,19 @@
16 16
  *  - DecVOB
17 17
  *  see http://www.lemuria.org/DeCSS/ by Tom Vogt for more information.
18 18
  *
19  
- * This program is free software; you can redistribute it and/or modify
  19
+ * This library is free software; you can redistribute it and/or modify
20 20
  * it under the terms of the GNU General Public License as published by
21 21
  * the Free Software Foundation; either version 2 of the License, or
22 22
  * (at your option) any later version.
23 23
  *
24  
- * This program is distributed in the hope that it will be useful,
  24
+ * This library is distributed in the hope that it will be useful,
25 25
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 26
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27 27
  * GNU General Public License for more details.
28 28
  *
29  
- * You should have received a copy of the GNU General Public License
30  
- * along with this program; if not, write to the Free Software
31  
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  29
+ * You should have received a copy of the GNU General Public License along
  30
+ * with this library; if not, write to the Free Software Foundation, Inc.,
  31
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 32
  *****************************************************************************/
33 33
 
34 34
 /*****************************************************************************
@@ -89,10 +89,19 @@ static int  AttackPadding   ( uint8_t const[], int, uint8_t * );
89 89
 
90 90
 /*****************************************************************************
91 91
  * _dvdcss_test: check if the disc is encrypted or not
  92
+ *****************************************************************************
  93
+ * Return values:
  94
+ *   1: DVD is scrambled but can be read
  95
+ *   0: DVD is not scrambled and can be read
  96
+ *  -1: could not get "copyright" information
  97
+ *  -2: could not get RPC information (reading the disc might be possible)
  98
+ *  -3: drive is RPC-II, region is not set, and DVD is scrambled: the RPC
  99
+ *      scheme will prevent us from reading the scrambled data
92 100
  *****************************************************************************/
93 101
 int _dvdcss_test( dvdcss_t dvdcss )
94 102
 {
95  
-    int i_ret, i_copyright;
  103
+    char const *psz_type, *psz_rpc;
  104
+    int i_ret, i_copyright, i_type, i_mask, i_rpc;
96 105
 
97 106
     i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
98 107
 
@@ -115,14 +124,51 @@ int _dvdcss_test( dvdcss_t dvdcss )
115 124
     if( i_ret < 0 )
116 125
     {
117 126
         /* Since it's the first ioctl we try to issue, we add a notice */
118  
-        print_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
119  
-                     "make sure there is a DVD in the drive, and that "
120  
-                     "you have used the correct device node." );
  127
+        print_error( dvdcss, "css error: could not get \"copyright\""
  128
+                     " information, make sure there is a DVD in the drive,"
  129
+                     " and that you have used the correct device node." );
  130
+
  131
+        return -1;
  132
+    }
  133
+
  134
+    print_debug( dvdcss, "disc reports copyright information 0x%x",
  135
+                         i_copyright );
121 136
 
122  
-        return i_ret;
  137
+    i_ret = ioctl_ReportRPC( dvdcss->i_fd, &i_type, &i_mask, &i_rpc);
  138
+
  139
+    if( i_ret < 0 )
  140
+    {
  141
+        print_error( dvdcss, "css error: could not get RPC status. Assuming RPC-I drive." );
  142
+        i_type = i_mask = i_rpc = 0;
123 143
     }
124 144
 
125  
-    return i_copyright;
  145
+    switch( i_rpc )
  146
+    {
  147
+        case 0: psz_rpc = "RPC-I"; break;
  148
+        case 1: psz_rpc = "RPC-II"; break;
  149
+        default: psz_rpc = "unknown RPC scheme"; break;
  150
+    }
  151
+
  152
+    switch( i_type )
  153
+    {
  154
+        case 0: psz_type = "no region code set"; break;
  155
+        case 1: psz_type = "region code set"; break;
  156
+        case 2: psz_type = "one region change remaining"; break;
  157
+        case 3: psz_type = "region code set permanently"; break;
  158
+        default: psz_type = "unknown status"; break;
  159
+    }
  160
+
  161
+    print_debug( dvdcss, "drive region mask 0x%x, %s, %s",
  162
+                         i_mask, psz_rpc, psz_type );
  163
+
  164
+    if( i_copyright && i_rpc == 1 && i_type == 0 )
  165
+    {
  166
+        print_error( dvdcss, "css error: drive will prevent access to "
  167
+                             "scrambled data" );
  168
+        return -3;
  169
+    }
  170
+
  171
+    return i_copyright ? 1 : 0;
126 172
 }
127 173
 
128 174
 /*****************************************************************************
@@ -379,7 +425,7 @@ int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
379 425
         /* We need to authenticate again every time to get a new session key */
380 426
         if( GetBusKey( dvdcss ) < 0 )
381 427
         {
382  
-            return -1;
  428
+            i_ret = -1;
383 429
         }
384 430
 
385 431
         /* Get encrypted title key */
@@ -1153,6 +1199,7 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key )
1153 1199
     memset( BigTable, 0 , 16777216 * sizeof(int) );
1154 1200
     if( BigTable == NULL )
1155 1201
     {
  1202
+        free( K1table );
1156 1203
         return -1;
1157 1204
     }
1158 1205
 
15  lib/libdvd/libdvdcss/src/css.h
@@ -2,7 +2,7 @@
2 2
  * css.h: Structures for DVD authentication and unscrambling
3 3
  *****************************************************************************
4 4
  * Copyright (C) 1999-2001 VideoLAN
5  
- * $Id$
  5
+ * $Id: css.h 236 2010-08-02 15:59:13Z jb $
6 6
  *
7 7
  * Author: Stéphane Borel <stef@via.ecp.fr>
8 8
  *
@@ -22,10 +22,16 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 24
  *
25  
- * You should have received a copy of the GNU General Public License
26  
- * along with this program; if not, write to the Free Software
27  
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  25
+ * You should have received a copy of the GNU General Public License along
  26
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
  27
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 28
  *****************************************************************************/
  29
+
  30
+#ifndef DVDCSS_CSS_H
  31
+#define DVDCSS_CSS_H
  32
+
  33
+#include "dvdcss/dvdcss.h"
  34
+
29 35
 #define KEY_SIZE 5
30 36
 
31 37
 typedef uint8_t dvd_key_t[KEY_SIZE];
@@ -54,3 +60,4 @@ int   _dvdcss_disckey     ( dvdcss_t );
54 60
 int   _dvdcss_titlekey    ( dvdcss_t, int , dvd_key_t );
55 61
 int   _dvdcss_unscramble  ( uint8_t *, uint8_t * );
56 62
 
  63
+#endif /* DVDCSS_CSS_H */
11  lib/libdvd/libdvdcss/src/csstables.h
@@ -2,7 +2,7 @@
2 2
  * csstables.h: CSS Tables for DVD unscrambling
3 3
  *****************************************************************************
4 4
  * Copyright (C) 1999-2001 VideoLAN
5  
- * $Id$
  5
+ * $Id: csstables.h 235 2010-08-02 15:41:14Z jb $
6 6
  *
7 7
  * Author: Stéphane Borel <stef@via.ecp.fr>
8 8
  *
@@ -24,11 +24,13 @@
24 24
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 25
  * GNU General Public License for more details.
26 26
  *
27  
- * You should have received a copy of the GNU General Public License
28  
- * along with this program; if not, write to the Free Software
29  
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  27
+ * You should have received a copy of the GNU General Public License along
  28
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
  29
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 30
  *****************************************************************************/
31 31
 
  32
+#ifndef DVDCSS_CSSTABLES_H
  33
+#define DVDCSS_CSSTABLES_H
32 34
 
33 35
 static uint8_t p_css_tab1[ 256 ] =
34 36
 {
@@ -390,3 +392,4 @@ static uint8_t p_crypt_tab3[ 288 ] =
390 392
     0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81
391 393
 };
392 394
 
  395
+#endif /* DVDCSS_CSSTABLES_H */
135  lib/libdvd/libdvdcss/src/device.c
@@ -2,25 +2,25 @@
2 2
  * device.h: DVD device access
3 3
  *****************************************************************************
4 4
  * Copyright (C) 1998-2006 VideoLAN
5  
- * $Id$
  5
+ * $Id: device.c 242 2011-10-26 04:59:23Z jb $
6 6
  *
7 7
  * Authors: Stéphane Borel <stef@via.ecp.fr>
8 8
  *          Sam Hocevar <sam@zoy.org>
9 9
  *          Håkan Hjort <d95hjort@dtek.chalmers.se>
10 10
  *
11  
- * This program is free software; you can redistribute it and/or modify
  11
+ * This library is free software; you can redistribute it and/or modify
12 12
  * it under the terms of the GNU General Public License as published by
13 13
  * the Free Software Foundation; either version 2 of the License, or
14 14
  * (at your option) any later version.
15 15
  *
16  
- * This program is distributed in the hope that it will be useful,
  16
+ * This library is distributed in the hope that it will be useful,
17 17
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 18
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 19
  * GNU General Public License for more details.
20 20
  *
21  
- * You should have received a copy of the GNU General Public License
22  
- * along with this program; if not, write to the Free Software
23  
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  21
+ * You should have received a copy of the GNU General Public License along
  22
+ * with this library; if not, write to the Free Software Foundation, Inc.,
  23
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
  *****************************************************************************/
25 25
 
26 26
 /*
@@ -69,6 +69,14 @@
69 69
 #   include <IOKit/storage/IODVDMedia.h>
70 70
 #endif
71 71
 
  72
+#ifdef SYS_OS2
  73
+#   define INCL_DOS
  74
+#   define INCL_DOSDEVIOCTL
  75
+#   include <os2.h>
  76
+#   include <io.h>                                              /* setmode() */
  77
+#   include <fcntl.h>                                           /* O_BINARY  */
  78
+#endif
  79
+
72 80
 #include "dvdcss/dvdcss.h"
73 81
 
74 82
 #include "common.h"
@@ -95,6 +103,12 @@ static int aspi_read  ( dvdcss_t, void *, int );
95 103
 static int win_readv  ( dvdcss_t, struct iovec *, int );
96 104
 
97 105
 static int aspi_read_internal  ( int, void *, int );
  106
+#elif defined( SYS_OS2 )
  107
+static int os2_open ( dvdcss_t, char const * );
  108
+/* just use macros for libc */
  109
+#   define os2_seek     libc_seek
  110
+#   define os2_read     libc_read
  111
+#   define os2_readv    libc_readv
98 112
 #endif
99 113
 
100 114
 int _dvdcss_use_ioctls( dvdcss_t dvdcss )
@@ -114,6 +128,16 @@ int _dvdcss_use_ioctls( dvdcss_t dvdcss )
114 128
     {
115 129
         return 1;
116 130
     }
  131
+#elif defined( SYS_OS2 )
  132
+    ULONG ulMode;
  133
+
  134
+    if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
  135
+        return 1;  /* What to do?  Be conservative and try to use the ioctls */
  136
+
  137
+    if( ulMode & OPEN_FLAGS_DASD )
  138
+        return 1;
  139
+
  140
+    return 0;
117 141
 #else
118 142
     struct stat fileinfo;
119 143
     int ret;
@@ -161,6 +185,28 @@ void _dvdcss_check ( dvdcss_t dvdcss )
161 185
     kern_return_t kern_result;
162 186
     io_iterator_t media_iterator;
163 187
     CFMutableDictionaryRef classes_to_match;
  188
+#elif defined( SYS_OS2 )
  189
+#pragma pack( 1 )
  190
+    struct
  191
+    {
  192
+        BYTE bCmdInfo;
  193
+        BYTE bDrive;
  194
+    } param;
  195
+
  196
+    struct
  197
+    {
  198
+        BYTE    abEBPB[31];
  199
+        USHORT  usCylinders;
  200
+        BYTE    bDevType;
  201
+        USHORT  usDevAttr;
  202
+    } data;
  203
+#pragma pack()
  204
+
  205
+    ULONG ulParamLen;
  206
+    ULONG ulDataLen;
  207
+    ULONG rc;
  208
+
  209
+    int i;
164 210
 #else
165 211
     char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
166 212
     int i, i_fd;
@@ -274,6 +320,32 @@ void _dvdcss_check ( dvdcss_t dvdcss )
274 320
     }
275 321
 
276 322
     IOObjectRelease( media_iterator );
  323
+#elif defined( SYS_OS2 )
  324
+    for( i = 0; i < 26; i++ )
  325
+    {
  326
+        param.bCmdInfo = 0;
  327
+        param.bDrive = i;
  328
+
  329
+        rc = DosDevIOCtl( ( HFILE )-1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
  330
+                          &param, sizeof( param ), &ulParamLen,
  331
+                          &data, sizeof( data ), &ulDataLen );
  332
+
  333
+        if( rc == 0 )
  334
+        {
  335
+            /* Check for removable and for cylinders */
  336
+            if( ( data.usDevAttr & 1 ) == 0 && data.usCylinders == 0xFFFF )
  337
+            {
  338
+                char psz_dvd[] = "A:";
  339
+
  340
+                psz_dvd[0] += i;
  341
+
  342
+                print_debug( dvdcss, "defaulting to drive `%s'", psz_dvd );
  343
+                free( dvdcss->psz_device );
  344
+                dvdcss->psz_device = strdup( psz_dvd );
  345
+                return;
  346
+            }
  347
+        }
  348
+    }
277 349
 #else
278 350
     for( i = 0; ppsz_devices[i]; i++ )
279 351
     {
@@ -335,6 +407,18 @@ int _dvdcss_open ( dvdcss_t dvdcss )
335 407
         return aspi_open( dvdcss, psz_device );
336 408
     }
337 409
     else
  410
+#elif defined( SYS_OS2 )
  411
+    /* If device is "X:" or "X:\", we are not actually opening a file. */
  412
+    if( psz_device[0] && psz_device[1] == ':' &&
  413
+        ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
  414
+    {
  415
+        print_debug( dvdcss, "using OS2 API for access" );
  416
+        dvdcss->pf_seek  = os2_seek;
  417
+        dvdcss->pf_read  = os2_read;
  418
+        dvdcss->pf_readv = os2_readv;
  419
+        return os2_open( dvdcss, psz_device );
  420
+    }
  421
+    else
338 422
 #endif
339 423
     {
340 424
         print_debug( dvdcss, "using libc for access" );
@@ -345,7 +429,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
345 429
     }
346 430
 }
347 431
 
348  
-#ifndef WIN32
  432
+#if !defined(WIN32) && !defined(SYS_OS2)
349 433
 int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
350 434
 {
351 435
     dvdcss->i_raw_fd = open( psz_device, 0 );
@@ -400,11 +484,13 @@ int _dvdcss_close ( dvdcss_t dvdcss )
400 484
 #else
401 485
     close( dvdcss->i_fd );
402 486
 
  487
+#ifndef SYS_OS2
403 488
     if( dvdcss->i_raw_fd >= 0 )
404 489
     {
405 490
         close( dvdcss->i_raw_fd );
406 491
         dvdcss->i_raw_fd = -1;
407 492
     }
  493
+#endif
408 494
 
409 495
     return 0;
410 496
 #endif
@@ -417,7 +503,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
417 503
  *****************************************************************************/
418 504
 static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
419 505
 {
420  
-#if !defined( WIN32 )
  506
+#if !defined( WIN32 ) && !defined( SYS_OS2 )
421 507
     dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 );
422 508
 #else
423 509
     dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
@@ -444,7 +530,7 @@ static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
444 530
     strcpy(psz_dvd, "cdrom0:");
445 531
 #else
446 532
     char psz_dvd[7];
447  
-    _snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
  533
+    snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
448 534
 
449 535
 #endif
450 536
     /* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
@@ -605,6 +691,37 @@ static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
605 691
 }
606 692
 #endif
607 693
 
  694
+#ifdef SYS_OS2
  695
+static int os2_open ( dvdcss_t dvdcss, char const *psz_device )
  696
+{
  697
+    char  psz_dvd[] = "X:";
  698
+    HFILE hfile;
  699
+    ULONG ulAction;
  700
+    ULONG rc;
  701
+
  702
+    psz_dvd[0] = psz_device[0];
  703
+
  704
+    rc = DosOpenL( ( PSZ )psz_dvd, &hfile, &ulAction, 0, FILE_NORMAL,
  705
+                   OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
  706
+                   OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
  707
+                   NULL );
  708
+
  709
+    if( rc )
  710
+    {
  711
+        print_error( dvdcss, "failed to open device" );
  712
+        return -1;
  713
+    }
  714
+
  715
+    setmode( hfile, O_BINARY );
  716
+
  717
+    dvdcss->i_fd = dvdcss->i_read_fd = hfile;
  718
+
  719
+    dvdcss->i_pos = 0;
  720
+