Diff of /src/libdvdcss.h [104348] .. [d040ac]  Maximize  Restore

Switch to unified view

a/src/libdvdcss.h b/src/libdvdcss.h
1
/*****************************************************************************
1
/*****************************************************************************
2
 * libdvdcss.h: private DVD reading library data
2
 * private.h: private DVD reading library data
3
 *****************************************************************************
3
 *****************************************************************************
4
 * Copyright (C) 1998-2001 VideoLAN
4
 * Copyright (C) 1998-2001 VideoLAN
5
 * $Id$
5
 * $Id: libdvdcss.h,v 1.1 2001/12/22 00:08:13 sam Exp $
6
 *
6
 *
7
 * Authors: StĂŠphane Borel <stef@via.ecp.fr>
7
 * Authors: Stéphane Borel <stef@via.ecp.fr>
8
 *          Sam Hocevar <sam@zoy.org>
8
 *          Samuel Hocevar <sam@zoy.org>
9
 *
9
 *
10
 * This program is free software; you can redistribute it and/or modify
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
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
12
 * the Free Software Foundation; either version 2 of the License, or
13
 * (at your option) any later version.
13
 * (at your option) any later version.
14
 *
14
 * 
15
 * This program is distributed in the hope that it will be useful,
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
18
 * GNU General Public License for more details.
19
 *
19
 *
20
 * You should have received a copy of the GNU General Public License
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
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23
 *****************************************************************************/
23
 *****************************************************************************/
24
24
25
struct iovec;
26
27
/*****************************************************************************
25
/*****************************************************************************
28
 * The libdvdcss structure
26
 * The libdvdcss structure
29
 *****************************************************************************/
27
 *****************************************************************************/
30
struct dvdcss_s
28
struct dvdcss_s
31
{
29
{
32
    /* File descriptor */
30
    /* File descriptor */
33
    char * psz_device;
34
    int    i_fd;
31
    int i_fd;
35
    int    i_read_fd;
36
    int    i_pos;
32
    int i_seekpos;
37
38
    /* File handling */
39
    int ( * pf_seek )  ( dvdcss_t, int );
40
    int ( * pf_read )  ( dvdcss_t, void *, int );
41
    int ( * pf_readv ) ( dvdcss_t, struct iovec *, int );
42
33
43
    /* Decryption stuff */
34
    /* Decryption stuff */
44
    int          i_method;
35
    int          i_method;
45
    css_t        css;
36
    css_t        css;
46
    int          b_ioctls;
37
    boolean_t    b_ioctls;
47
    int          b_scrambled;
38
    boolean_t    b_encrypted;
48
    dvd_title_t *p_titles;
39
    dvd_title_t *p_titles;
49
40
50
    /* Key cache directory and pointer to the filename */
41
    /* Error management */
51
    char   psz_cachefile[PATH_MAX];
42
    char     *psz_error;
52
    char * psz_block;
43
    boolean_t b_errors;
44
    boolean_t b_debug;
53
45
54
    /* Error management */
55
    char * psz_error;
56
    int    b_errors;
57
    int    b_debug;
58
59
#ifdef WIN32
46
#if defined( WIN32 )
60
    int    b_file;
61
    char * p_readv_buffer;
47
    char *p_readv_buffer;
62
    int    i_readv_buf_size;
48
    int  i_readv_buf_size;
63
#endif
49
#else
64
65
#ifndef WIN32
66
    int    i_raw_fd;
50
    int i_raw_fd;
51
    int i_read_fd;
67
#endif
52
#endif
68
};
53
};
69
54
70
/*****************************************************************************
55
/*****************************************************************************
71
 * libdvdcss method: used like init flags
56
 * libdvdcss method: used like init flags
...
...
75
#define DVDCSS_METHOD_TITLE      2
60
#define DVDCSS_METHOD_TITLE      2
76
61
77
/*****************************************************************************
62
/*****************************************************************************
78
 * Functions used across the library
63
 * Functions used across the library
79
 *****************************************************************************/
64
 *****************************************************************************/
80
#define print_error(dvdcss,msg) _print_error(dvdcss,msg)
65
int _dvdcss_seek  ( dvdcss_handle, int i_blocks );
81
#if defined( _MSC_VER )
66
int _dvdcss_read  ( dvdcss_handle, void *p_buffer, int i_blocks );
82
#include <stdarg.h>
83
__forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
84
{
85
  va_list args;
86
67
87
    fprintf( stderr, "libdvdcss debug: " );
68
/*****************************************************************************
88
  va_start( args, msg );
69
 * Error management
89
    vfprintf( stderr, msg, args );
70
 *****************************************************************************/
90
  va_end( args );
71
#if defined( _WIN32 ) && defined( _MSC_VER )
91
    fprintf( stderr, "\n" );
72
#   define DVDCSS_ERROR( x ) fprintf( stderr, "libdvdcss error: %s\n", x );
92
}
73
#   define DVDCSS_DEBUG( x ) fprintf( stderr, "libdvdcss debug: %s\n", x );
93
#else
74
#else
94
#define print_debug(dvdcss,msg,args...) \
75
#   define DVDCSS_ERROR( x... ) fprintf( stderr, "libdvdcss error: %s\n", ##x );
95
    if( dvdcss->b_debug ) \
76
#   define DVDCSS_DEBUG( x... ) fprintf( stderr, "libdvdcss debug: %s\n", ##x );
96
    { \
97
        fprintf( stderr, "libdvdcss debug: " ); \
98
        fprintf( stderr, msg, ##args ); \
99
        fprintf( stderr, "\n" ); \
100
    }
101
#endif
77
#endif
102
78
103
void _print_error ( dvdcss_t, char * );
79
static __inline__ void _dvdcss_error( dvdcss_handle dvdcss, char *psz_string )
80
{
81
    if( dvdcss->b_errors )
82
    {
83
        DVDCSS_ERROR( psz_string );
84
    }
104
85
86
    dvdcss->psz_error = psz_string;
87
}
88
89
static __inline__ void _dvdcss_debug( dvdcss_handle dvdcss, char *psz_string )
90
{
91
    if( dvdcss->b_debug )
92
    {
93
        DVDCSS_DEBUG( psz_string );
94
    }
95
}
96
97

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks