]> git.sesse.net Git - vlc/blob - extras/libdvdcss/libdvdcss.h
f66915794c766291ca70fbb4c844da19004ea1eb
[vlc] / extras / libdvdcss / libdvdcss.h
1 /*****************************************************************************
2  * private.h: private DVD reading library data
3  *****************************************************************************
4  * Copyright (C) 1998-2001 VideoLAN
5  * $Id: libdvdcss.h,v 1.8 2001/10/13 15:34:21 stef Exp $
6  *
7  * Authors: Stéphane Borel <stef@via.ecp.fr>
8  *          Samuel Hocevar <sam@zoy.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Needed headers
27  *****************************************************************************/
28 #include "css.h"
29
30 /*****************************************************************************
31  * The libdvdcss structure
32  *****************************************************************************/
33 struct dvdcss_s
34 {
35     /* File descriptor */
36     int i_fd;
37     int i_seekpos;
38
39     /* Decryption stuff */
40     int          i_method;
41     css_t        css;
42     boolean_t    b_ioctls;
43     boolean_t    b_encrypted;
44     dvd_title_t *p_titles;
45
46     /* Error management */
47     char     *psz_error;
48     boolean_t b_errors;
49     boolean_t b_debug;
50
51 #if defined( WIN32 )
52     char *p_readv_buffer;
53     int  i_readv_buf_size;
54 #endif
55 };
56
57 /*****************************************************************************
58  * Error management
59  *****************************************************************************/
60 #if defined( _WIN32 ) && defined( _MSC_VER )
61 #   define DVDCSS_ERROR( x ) fprintf( stderr, "libdvdcss error: %s\n", x );
62 #   define DVDCSS_DEBUG( x ) fprintf( stderr, "libdvdcss debug: %s\n", x );
63 #else
64 #   define DVDCSS_ERROR( x... ) fprintf( stderr, "libdvdcss error: %s\n", ##x );
65 #   define DVDCSS_DEBUG( x... ) fprintf( stderr, "libdvdcss debug: %s\n", ##x );
66 #endif
67
68 static __inline__ void _dvdcss_error( dvdcss_handle dvdcss, char *psz_string )
69 {
70     if( dvdcss->b_errors )
71     {
72         DVDCSS_ERROR( psz_string );
73     }
74
75     dvdcss->psz_error = psz_string;
76 }
77
78 static __inline__ void _dvdcss_debug( dvdcss_handle dvdcss, char *psz_string )
79 {
80     if( dvdcss->b_debug )
81     {
82         DVDCSS_DEBUG( psz_string );
83     }
84 }
85
86