libdvdcss.h 2.94 KB
Newer Older
Sam Hocevar's avatar
 
Sam Hocevar committed
1
/*****************************************************************************
2
 * libdvdcss.h: private DVD reading library data
Sam Hocevar's avatar
 
Sam Hocevar committed
3
4
5
 *****************************************************************************
 * Copyright (C) 1998-2001 VideoLAN
 *
6
 * Authors: Stéphane Borel <stef@via.ecp.fr>
7
 *          Sam Hocevar <sam@zoy.org>
Sam Hocevar's avatar
 
Sam Hocevar committed
8
 *
9
 * libdvdcss is free software; you can redistribute it and/or modify
Sam Hocevar's avatar
 
Sam Hocevar committed
10
11
12
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
13
 *
14
 * libdvdcss is distributed in the hope that it will be useful,
Sam Hocevar's avatar
 
Sam Hocevar committed
15
16
17
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
Diego Biurrun's avatar
Diego Biurrun committed
19
20
21
 * You should have received a copy of the GNU General Public License along
 * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Sam Hocevar's avatar
 
Sam Hocevar committed
22
23
 *****************************************************************************/

24
25
26
#ifndef DVDCSS_LIBDVDCSS_H
#define DVDCSS_LIBDVDCSS_H

Diego Biurrun's avatar
Diego Biurrun committed
27
#include <limits.h>
28

29
30
#include "dvdcss/dvdcss.h"
#include "css.h"
31
#include "device.h"
32

33
34
35
36
37
38
39
40
/*****************************************************************************
 * libdvdcss method: used like init flags
 *****************************************************************************/
enum dvdcss_method {
    DVDCSS_METHOD_KEY,
    DVDCSS_METHOD_DISC,
    DVDCSS_METHOD_TITLE,
};
Sam Hocevar's avatar
 
Sam Hocevar committed
41
42
43
44
45
46
/*****************************************************************************
 * The libdvdcss structure
 *****************************************************************************/
struct dvdcss_s
{
    /* File descriptor */
47
48
    char * psz_device;
    int    i_fd;
49
    int    i_pos;
Sam Hocevar's avatar
 
Sam Hocevar committed
50

51
52
53
    /* File handling */
    int ( * pf_seek )  ( dvdcss_t, int );
    int ( * pf_read )  ( dvdcss_t, void *, int );
54
    int ( * pf_readv ) ( dvdcss_t, const struct iovec *, int );
55

Sam Hocevar's avatar
 
Sam Hocevar committed
56
    /* Decryption stuff */
57
    enum dvdcss_method i_method;
58
    struct css   css;
59
60
    int          b_ioctls;
    int          b_scrambled;
61
    struct dvd_title *p_titles;
Sam Hocevar's avatar
 
Sam Hocevar committed
62

63
64
65
66
    /* Key cache directory and pointer to the filename */
    char   psz_cachefile[PATH_MAX];
    char * psz_block;

Sam Hocevar's avatar
 
Sam Hocevar committed
67
    /* Error management */
Diego Biurrun's avatar
Diego Biurrun committed
68
    const char *psz_error;
69
70
    int    b_errors;
    int    b_debug;
Sam Hocevar's avatar
 
Sam Hocevar committed
71

72
#ifdef WIN32
73
    int    b_file;
74
75
    char * p_readv_buffer;
    int    i_readv_buf_size;
76
#endif /* WIN32 */
Sam Hocevar's avatar
 
Sam Hocevar committed
77
78
79
80
81
};

/*****************************************************************************
 * Functions used across the library
 *****************************************************************************/
82
#define print_debug( dvdcss, ... ) \
83
84
85
    if( dvdcss->b_debug ) \
    { \
        fprintf( stderr, "libdvdcss debug: " ); \
86
        fprintf( stderr, __VA_ARGS__ ); \
87
88
89
        fprintf( stderr, "\n" ); \
    }

Diego Biurrun's avatar
Diego Biurrun committed
90
void print_error ( dvdcss_t, const char * );
Sam Hocevar's avatar
 
Sam Hocevar committed
91

92
#endif /* DVDCSS_LIBDVDCSS_H */