annotate dvdread/dvd_input.c @ 27076:3dccfe530193

cosmetic: give coherent indentation
author ben
date Fri, 20 Jun 2008 20:07:36 +0000
parents dcf5fe229d37
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
1 /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
2 /*
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
3 * Copyright (C) 2002 Samuel Hocevar <sam@zoy.org>,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
4 * Håkan Hjort <d95hjort@dtek.chalmers.se>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
5 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
9 * (at your option) any later version.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
10 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
14 * GNU General Public License for more details.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
15 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
19 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
20
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
21 #include "config.h"
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
22
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
23 #include <stdio.h>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
24 #include <stdlib.h>
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
25 #define __USE_GNU /* to get O_DIRECT in linux */
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
26 #include <fcntl.h>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
27 #include <unistd.h>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
28
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
29 #include "dvd_reader.h"
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
30 #include "dvd_input.h"
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
31
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
32 #include "dvdread_internal.h"
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
33
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
34 /* The function pointers that is the exported interface of this file. */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
35 dvd_input_t (*dvdinput_open) (const char *);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
36 int (*dvdinput_close) (dvd_input_t);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
37 int (*dvdinput_seek) (dvd_input_t, int);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
38 int (*dvdinput_title) (dvd_input_t, int);
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
39 /**
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
40 * pointer must be aligned to 2048 bytes
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
41 * if reading from a raw/O_DIRECT file
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
42 */
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
43 int (*dvdinput_read) (dvd_input_t, void *, int, int);
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
44
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
45 char * (*dvdinput_error) (dvd_input_t);
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
46
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
47 #ifdef HAVE_DVDCSS_DVDCSS_H
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
48 /* linking to libdvdcss */
20983
4da452b25fd5 Drop some unnecessary local changes.
diego
parents: 20981
diff changeset
49 #include <dvdcss/dvdcss.h>
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
50 #define DVDcss_open(a) dvdcss_open((char*)(a))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
51 #define DVDcss_close dvdcss_close
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
52 #define DVDcss_seek dvdcss_seek
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
53 #define DVDcss_title dvdcss_title
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
54 #define DVDcss_read dvdcss_read
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
55 #define DVDcss_error dvdcss_error
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
56 #else
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
57 /* dlopening libdvdcss */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
58 #include <dlfcn.h>
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
59 typedef struct dvdcss_s *dvdcss_handle;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
60 static dvdcss_handle (*DVDcss_open) (const char *);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
61 static int (*DVDcss_close) (dvdcss_handle);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
62 static int (*DVDcss_seek) (dvdcss_handle, int, int);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
63 static int (*DVDcss_title) (dvdcss_handle, int);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
64 static int (*DVDcss_read) (dvdcss_handle, void *, int, int);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
65 static char * (*DVDcss_error) (dvdcss_handle);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
66 #endif
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
67
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
68 /* The DVDinput handle, add stuff here for new input methods. */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
69 struct dvd_input_s {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
70 /* libdvdcss handle */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
71 dvdcss_handle dvdcss;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
72
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
73 /* dummy file input */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
74 int fd;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
75 };
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
76
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
77
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
78 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
79 * initialize and open a DVD device or file.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
80 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
81 static dvd_input_t css_open(const char *target)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
82 {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
83 dvd_input_t dev;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
84
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
85 /* Allocate the handle structure */
11776
12615e408fb9 Fix (possible) memory corruption. dvd_input_t is pointer to struct dvd_input_s and not a struct.
lumag
parents: 7033
diff changeset
86 dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
87 if(dev == NULL) {
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
88 /* malloc has set errno to ENOMEM */
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
89 return NULL;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
90 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
91
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
92 /* Really open it with libdvdcss */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
93 dev->dvdcss = DVDcss_open(target);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
94 if(dev->dvdcss == 0) {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
95 free(dev);
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
96 dev = NULL;
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
97 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
98
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
99 return dev;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
100 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
101
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
102 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
103 * return the last error message
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
104 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
105 static char *css_error(dvd_input_t dev)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
106 {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
107 return DVDcss_error(dev->dvdcss);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
108 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
109
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
110 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
111 * seek into the device.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
112 */
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
113 static int css_seek(dvd_input_t dev, int blocks)
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
114 {
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
115 /* DVDINPUT_NOFLAGS should match the DVDCSS_NOFLAGS value. */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
116 return DVDcss_seek(dev->dvdcss, blocks, DVDINPUT_NOFLAGS);
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
117 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
118
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
119 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
120 * set the block for the begining of a new title (key).
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
121 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
122 static int css_title(dvd_input_t dev, int block)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
123 {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
124 return DVDcss_title(dev->dvdcss, block);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
125 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
126
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
127 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
128 * read data from the device.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
129 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
130 static int css_read(dvd_input_t dev, void *buffer, int blocks, int flags)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
131 {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
132 return DVDcss_read(dev->dvdcss, buffer, blocks, flags);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
133 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
134
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
135 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
136 * close the DVD device and clean up the library.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
137 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
138 static int css_close(dvd_input_t dev)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
139 {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
140 int ret;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
141
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
142 ret = DVDcss_close(dev->dvdcss);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
143
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
144 if(ret < 0)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
145 return ret;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
146
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
147 free(dev);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
148
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
149 return 0;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
150 }
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
151
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
152 /* Need to use O_BINARY for WIN32 */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
153 #ifndef O_BINARY
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
154 #ifdef _O_BINARY
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
155 #define O_BINARY _O_BINARY
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
156 #else
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
157 #define O_BINARY 0
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
158 #endif
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
159 #endif
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
160
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
161 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
162 * initialize and open a DVD device or file.
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
163 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
164 static dvd_input_t file_open(const char *target)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
165 {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
166 dvd_input_t dev;
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
167 char *use_odirect;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
168 int oflags;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
169
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
170 oflags = O_RDONLY | O_BINARY;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
171 use_odirect = getenv("DVDREAD_USE_DIRECT");
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
172 if(use_odirect) {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
173 #ifndef O_DIRECT
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
174 #define O_DIRECT 0
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
175 #endif
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
176 oflags |= O_DIRECT;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
177 }
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
178 /* Allocate the library structure */
17786
f0f54034c7e9 fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents: 15874
diff changeset
179 dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
180 if(dev == NULL) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
181 return NULL;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
182 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
183
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
184 /* Open the device */
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
185 dev->fd = open(target, oflags);
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
186 if(dev->fd < 0) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
187 free(dev);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
188 return NULL;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
189 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
190
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
191 return dev;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
192 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
193
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
194 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
195 * return the last error message
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
196 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
197 static char *file_error(dvd_input_t dev)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
198 {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
199 /* use strerror(errno)? */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
200 return (char *)"unknown error";
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
201 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
202
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
203 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
204 * seek into the device.
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
205 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
206 static int file_seek(dvd_input_t dev, int blocks)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
207 {
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
208 off_t pos = (off_t)blocks * (off_t)DVD_VIDEO_LB_LEN;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
209
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
210 pos = lseek(dev->fd, pos, SEEK_SET);
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
211 if(pos < 0) {
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
212 return pos;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
213 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
214 /* assert pos % DVD_VIDEO_LB_LEN == 0 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
215 return (int) (pos / DVD_VIDEO_LB_LEN);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
216 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
217
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
218 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
219 * set the block for the begining of a new title (key).
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
220 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
221 static int file_title(dvd_input_t dev, int block)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
222 {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
223 return -1;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
224 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
225
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
226 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
227 * read data from the device.
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
228 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
229 static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
230 {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
231 size_t len;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
232 ssize_t ret;
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
233 unsigned char *buf = buffer;
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
234
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
235 len = (size_t)blocks * DVD_VIDEO_LB_LEN;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
236
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
237 while(len > 0) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
238
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
239 ret = read(dev->fd, buf, len);
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
240
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
241 if(ret < 0) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
242 /* One of the reads failed, too bad. We won't even bother
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
243 * returning the reads that went ok, and as in the posix spec
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
244 * the file postition is left unspecified after a failure. */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
245 return ret;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
246 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
247
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
248 if(ret == 0) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
249 /* Nothing more to read. Return the whole blocks, if any, that we got.
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
250 and adjust the file possition back to the previous block boundary. */
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
251 size_t bytes = (size_t)blocks * DVD_VIDEO_LB_LEN - len;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
252 off_t over_read = -(bytes % DVD_VIDEO_LB_LEN);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
253 /*off_t pos =*/ lseek(dev->fd, over_read, SEEK_CUR);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
254 /* should have pos % 2048 == 0 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
255 return (int) (bytes / DVD_VIDEO_LB_LEN);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
256 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
257
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
258 buf+=ret;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
259 len -= ret;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
260 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
261
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
262 return blocks;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
263 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
264
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
265 /**
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
266 * close the DVD device and clean up.
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
267 */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
268 static int file_close(dvd_input_t dev)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
269 {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
270 int ret;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
271
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
272 ret = close(dev->fd);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
273
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
274 if(ret < 0)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
275 return ret;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
276
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
277 free(dev);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
278
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
279 return 0;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
280 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
281
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
282
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
283 static void *dvdcss_library = NULL;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
284 static int dvdcss_library_init = 0;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
285
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
286 /**
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
287 * Free any objects allocated by dvdinput_setup.
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
288 * Should only be called when libdvdread is not to be used any more.
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
289 * Closes dlopened libraries.
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
290 */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
291 void dvdinput_free(void)
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
292 {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
293 #ifdef HAVE_DVDCSS_DVDCSS_H
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
294 /* linked statically, nothing to free */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
295 return;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
296 #else
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
297 if(dvdcss_library) {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
298 dlclose(dvdcss_library);
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
299 dvdcss_library = NULL;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
300 }
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
301 dvdcss_library_init = 0;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
302 return;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
303 #endif
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
304 }
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
305
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
306
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
307 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
308 * Setup read functions with either libdvdcss or minimal DVD access.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
309 */
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
310 int dvdinput_setup(void)
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
311 {
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
312 char **dvdcss_version = NULL;
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
313 int verbose;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
314
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
315 /* dlopening libdvdcss */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
316 if(dvdcss_library_init) {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
317 /* libdvdcss is already dlopened, function ptrs set */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
318 if(dvdcss_library) {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
319 return 1; /* css available */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
320 } else {
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
321 return 0; /* css not available */
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
322 }
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
323 }
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
324
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
325 verbose = get_verbose();
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
326
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
327 #ifdef HAVE_DVDCSS_DVDCSS_H
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
328 /* linking to libdvdcss */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
329 dvdcss_library = &dvdcss_library; /* Give it some value != NULL */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
330 /* the DVDcss_* functions have been #defined at the top */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
331 dvdcss_version = &dvdcss_interface_2;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
332
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
333 #else
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
334
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
335 dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY);
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
336
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
337 if(dvdcss_library != NULL) {
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
338 #if defined(__OpenBSD__) && !defined(__ELF__)
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
339 #define U_S "_"
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
340 #else
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
341 #define U_S
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
342 #endif
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
343 DVDcss_open = (dvdcss_handle (*)(const char*))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
344 dlsym(dvdcss_library, U_S "dvdcss_open");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
345 DVDcss_close = (int (*)(dvdcss_handle))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
346 dlsym(dvdcss_library, U_S "dvdcss_close");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
347 DVDcss_title = (int (*)(dvdcss_handle, int))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
348 dlsym(dvdcss_library, U_S "dvdcss_title");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
349 DVDcss_seek = (int (*)(dvdcss_handle, int, int))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
350 dlsym(dvdcss_library, U_S "dvdcss_seek");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
351 DVDcss_read = (int (*)(dvdcss_handle, void*, int, int))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
352 dlsym(dvdcss_library, U_S "dvdcss_read");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
353 DVDcss_error = (char* (*)(dvdcss_handle))
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
354 dlsym(dvdcss_library, U_S "dvdcss_error");
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
355
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
356 dvdcss_version = (char **)dlsym(dvdcss_library, U_S "dvdcss_interface_2");
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
357
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
358 if(dlsym(dvdcss_library, U_S "dvdcss_crack")) {
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
359 if(verbose >= 0) {
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
360 fprintf(stderr,
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
361 "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
362 "libdvdread: You should get the latest version from "
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
363 "http://www.videolan.org/\n" );
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
364 }
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
365 dlclose(dvdcss_library);
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
366 dvdcss_library = NULL;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
367 } else if(!DVDcss_open || !DVDcss_close || !DVDcss_title || !DVDcss_seek
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
368 || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
369 if(verbose >= 0) {
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
370 fprintf(stderr, "libdvdread: Missing symbols in libdvdcss.so.2, "
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
371 "this shouldn't happen !\n");
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
372 }
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
373 dlclose(dvdcss_library);
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
374 dvdcss_library = NULL;
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
375 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
376 }
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
377 #endif /* HAVE_DVDCSS_DVDCSS_H */
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
378
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
379 dvdcss_library_init = 1;
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
380
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
381 if(dvdcss_library) {
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
382 /*
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
383 char *psz_method = getenv( "DVDCSS_METHOD" );
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
384 char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
385 fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
386 fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
387 */
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
388 if(verbose >= 1) {
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
389 fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
390 *dvdcss_version);
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
391 }
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
392 /* libdvdcss wrapper functions */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
393 dvdinput_open = css_open;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
394 dvdinput_close = css_close;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
395 dvdinput_seek = css_seek;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
396 dvdinput_title = css_title;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
397 dvdinput_read = css_read;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
398 dvdinput_error = css_error;
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
399 return 1;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
400
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
401 } else {
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
402 if(verbose >= 1) {
24050
1542693b2a30 Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents: 24047
diff changeset
403 fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
24047
de28f9e8cb00 Sync libdvdread with version 0.9.5 (functional changes).
diego
parents: 20983
diff changeset
404 }
15874
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
405 /* libdvdcss replacement functions */
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
406 dvdinput_open = file_open;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
407 dvdinput_close = file_close;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
408 dvdinput_seek = file_seek;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
409 dvdinput_title = file_title;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
410 dvdinput_read = file_read;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
411 dvdinput_error = file_error;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
412 return 0;
483e955893b8 update libdvdread to v0.9.4
aurel
parents: 14938
diff changeset
413 }
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
414 }