~ubuntu-branches/debian/wheezy/vlc/wheezy

« back to all changes in this revision

Viewing changes to extras/libdvdread/dvd_reader.h

Tags: upstream-0.7.2.final
Import upstream version 0.7.2.final

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * Copyright (C) 2001 Billy Biggs <vektor@dumbterm.net>,
3
 
 *                    H�kan Hjort <d95hjort@dtek.chalmers.se>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or (at
8
 
 * your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful, but
11
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
 
 */
19
 
 
20
 
#ifndef DVD_READER_H_INCLUDED
21
 
#define DVD_READER_H_INCLUDED
22
 
 
23
 
#include <sys/types.h>
24
 
#include <inttypes.h>
25
 
 
26
 
/**
27
 
 * The length of one Logical Block of a DVD Video.
28
 
 */
29
 
#define DVD_VIDEO_LB_LEN 2048
30
 
 
31
 
/**
32
 
 * Maximum length of filenames for UDF.
33
 
 */
34
 
#define MAX_UDF_FILE_NAME_LEN 2048
35
 
 
36
 
#ifdef __cplusplus
37
 
extern "C" {
38
 
#endif
39
 
 
40
 
typedef struct dvd_reader_s dvd_reader_t;
41
 
typedef struct dvd_file_s dvd_file_t;
42
 
 
43
 
/**
44
 
 * Opens a block device of a DVD-ROM file, or an image file, or a directory
45
 
 * name for a mounted DVD or HD copy of a DVD.  Returns 0 if we can't get any
46
 
 * of those methods to work.
47
 
 *
48
 
 * If the given file is a block device, or is the mountpoint for a block
49
 
 * device, then that device is used for CSS authentication using libdvdcss.
50
 
 * If no device is available, then no CSS authentication is performed, 
51
 
 * and we hope that the image is decrypted.
52
 
 *
53
 
 * If the path given is a directory, then the files in that directory may be in
54
 
 * any one of these formats:
55
 
 *
56
 
 *   path/VIDEO_TS/VTS_01_1.VOB
57
 
 *   path/video_ts/vts_01_1.vob
58
 
 *   path/VTS_01_1.VOB
59
 
 *   path/vts_01_1.vob
60
 
 */
61
 
dvd_reader_t *DVDOpen( const char *path );
62
 
 
63
 
/**
64
 
 * Closes and cleans up the DVD reader object.  You must close all open files
65
 
 * before calling this function.
66
 
 */
67
 
void DVDClose( dvd_reader_t *dvd );
68
 
 
69
 
/**
70
 
 * INFO_FILE       : VIDEO_TS.IFO     (manager)
71
 
 *                   VTS_XX_0.IFO     (title)
72
 
 *
73
 
 * INFO_BACKUP_FILE: VIDEO_TS.BUP     (manager)
74
 
 *                   VTS_XX_0.BUP     (title)
75
 
 *
76
 
 * MENU_VOBS       : VIDEO_TS.VOB     (manager)
77
 
 *                   VTS_XX_0.VOB     (title)
78
 
 *
79
 
 * TITLE_VOBS      : VTS_XX_[1-9].VOB (title)
80
 
 *                   All files in the title set are opened and read as a single
81
 
 *                   file.
82
 
 */
83
 
typedef enum {
84
 
    DVD_READ_INFO_FILE,
85
 
    DVD_READ_INFO_BACKUP_FILE,
86
 
    DVD_READ_MENU_VOBS,
87
 
    DVD_READ_TITLE_VOBS
88
 
} dvd_read_domain_t;
89
 
 
90
 
/**
91
 
 * Opens a file on the DVD given the title number and domain.  If the title
92
 
 * number is 0, the video manager information is opened
93
 
 * (VIDEO_TS.[IFO,BUP,VOB]).  Returns a file structure which may be used for
94
 
 * reads, or 0 if the file was not found.
95
 
 */
96
 
dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum, 
97
 
                         dvd_read_domain_t domain );
98
 
 
99
 
/**
100
 
 * Closes a file and frees the associated structure.
101
 
 */
102
 
void DVDCloseFile( dvd_file_t *dvd_file );
103
 
 
104
 
/**
105
 
 * Reads block_count number of blocks from the file at the given block offset.
106
 
 * Returns number of blocks read on success, -1 on error.  This call is only
107
 
 * for reading VOB data, and should not be used when reading the IFO files.  
108
 
 * When reading from an encrypted drive, blocks are decrypted using libdvdcss 
109
 
 * where required.
110
 
 */
111
 
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
112
 
                       size_t block_count, unsigned char *data );
113
 
 
114
 
/**
115
 
 * Seek to the given position in the file.  Returns the resulting position in
116
 
 * bytes from the beginning of the file.  The seek position is only used for
117
 
 * byte reads from the file, the block read call always reads from the given
118
 
 * offset.
119
 
 */
120
 
int DVDFileSeek( dvd_file_t *dvd_file, int offset );
121
 
 
122
 
/**
123
 
 * Reads the given number of bytes from the file.  This call can only be used
124
 
 * on the information files, and may not be used for reading from a VOB.  This
125
 
 * reads from and increments the currrent seek position for the file.
126
 
 */
127
 
ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size );
128
 
 
129
 
/**
130
 
 * Returns the file size in blocks.
131
 
 */
132
 
ssize_t DVDFileSize( dvd_file_t *dvd_file );
133
 
 
134
 
#ifdef __cplusplus
135
 
};
136
 
#endif
137
 
#endif /* DVD_READER_H_INCLUDED */