libdvdcss.h 2.87 KB
Newer Older
1
/*****************************************************************************
2
 * libdvdcss.h: private DVD reading library data
3 4 5
 *****************************************************************************
 * Copyright (C) 1998-2001 VideoLAN
 *
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 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,
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.
22 23
 *****************************************************************************/

24 25 26
#ifndef DVDCSS_LIBDVDCSS_H
#define DVDCSS_LIBDVDCSS_H

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,
};
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;
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

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;
62

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

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

72
#ifdef _WIN32
73
    int    b_file;
74 75
    char * p_readv_buffer;
    int    i_readv_buf_size;
76
#endif /* _WIN32 */
77 78 79

    void                *p_stream;
    dvdcss_stream_cb    *p_stream_cb;
80 81 82 83 84
};

/*****************************************************************************
 * Functions used across the library
 *****************************************************************************/
85 86
void print_error ( dvdcss_t, const char *, ... );
void print_debug ( const dvdcss_t, const char *, ... );
87

88
#endif /* DVDCSS_LIBDVDCSS_H */