1 /*****************************************************************************
2  * libdvdcss.h: private DVD reading library data
3  *****************************************************************************
4  * Copyright (C) 1998-2001 VideoLAN
5  *
6  * Authors: Stéphane Borel <stef@via.ecp.fr>
7  *          Sam Hocevar <sam@zoy.org>
8  *
9  * libdvdcss is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * libdvdcss is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  *****************************************************************************/
23 
24 #ifndef DVDCSS_LIBDVDCSS_H
25 #define DVDCSS_LIBDVDCSS_H
26 
27 #include <limits.h>
28 
29 #include "dvdcss/dvdcss.h"
30 #include "css.h"
31 #include "device.h"
32 
33 /*****************************************************************************
34  * libdvdcss method: used like init flags
35  *****************************************************************************/
36 enum dvdcss_method {
37     DVDCSS_METHOD_KEY,
38     DVDCSS_METHOD_DISC,
39     DVDCSS_METHOD_TITLE,
40 };
41 /*****************************************************************************
42  * The libdvdcss structure
43  *****************************************************************************/
44 struct dvdcss_s
45 {
46     /* File descriptor */
47     char * psz_device;
48     int    i_fd;
49     int    i_pos;
50 
51     /* File handling */
52     int ( * pf_seek )  ( dvdcss_t, int );
53     int ( * pf_read )  ( dvdcss_t, void *, int );
54     int ( * pf_readv ) ( dvdcss_t, const struct iovec *, int );
55 
56     /* Decryption stuff */
57     enum dvdcss_method i_method;
58     struct css   css;
59     int          b_ioctls;
60     int          b_scrambled;
61     struct dvd_title *p_titles;
62 
63     /* Key cache directory and pointer to the filename */
64     char   psz_cachefile[PATH_MAX];
65     char * psz_block;
66 
67     /* Error management */
68     const char *psz_error;
69     int    b_errors;
70     int    b_debug;
71 
72 #ifdef _WIN32
73     int    b_file;
74     char * p_readv_buffer;
75     int    i_readv_buf_size;
76 #endif /* _WIN32 */
77 
78     void                *p_stream;
79     dvdcss_stream_cb    *p_stream_cb;
80 };
81 
82 /*****************************************************************************
83  * Functions used across the library
84  *****************************************************************************/
85 void print_error ( dvdcss_t, const char *, ... );
86 void print_debug ( const dvdcss_t, const char *, ... );
87 
88 #endif /* DVDCSS_LIBDVDCSS_H */
89