comparison dvdnav_internal.h @ 0:3ddf0eaece51 src

Initial revision
author richwareham
date Tue, 12 Mar 2002 19:45:53 +0000
parents
children 6061277509ee
comparison
equal deleted inserted replaced
-1:000000000000 0:3ddf0eaece51
1 /*
2 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
3 *
4 * This file is part of libdvdnav, a DVD navigation library.
5 *
6 * libdvdnav is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * libdvdnav is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 *
20 * $Id$
21 *
22 */
23
24 #ifndef DVDNAV_INTERNAL_H_INCLUDED
25 #define DVDNAV_INTERNAL_H_INCLUDED
26
27 #include "dvdnav.h"
28 #include "vm.h"
29
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <unistd.h>
33 #include <limits.h>
34 #include <string.h>
35 #include <pthread.h>
36
37 #include <dvdread/dvd_reader.h>
38 #include <dvdread/ifo_read.h>
39 #include <dvdread/ifo_types.h>
40
41
42 /* Maximum length of an error string */
43 #define MAX_ERR_LEN 255
44
45 /* Use the POSIX PATH_MAX if available */
46 #ifdef PATH_MAX
47 #define MAX_PATH_LEN PATH_MAX
48 #else
49 #define MAX_PATH_LEN 255 /* Arbitary */
50 #endif
51
52 #ifndef DVD_VIDEO_LB_LEN
53 #define DVD_VIDEO_LB_LEN 2048
54 #endif
55
56 /*
57 * These are defined here because they are
58 * not in ifo_types.h, they maybe one day
59 */
60
61 #ifndef audio_status_t
62 typedef struct {
63 #ifdef WORDS_BIGENDIAN
64 unsigned int available : 1;
65 unsigned int zero1 : 4;
66 unsigned int stream_number : 3;
67 uint8_t zero2;
68 #else
69 uint8_t zero2;
70 unsigned int stream_number : 3;
71 unsigned int zero1 : 4;
72 unsigned int available : 1;
73 #endif
74 } ATTRIBUTE_PACKED audio_status_t;
75 #endif
76
77 #ifndef spu_status_t
78 typedef struct {
79 #ifdef WORDS_BIGENDIAN
80 unsigned int available : 1;
81 unsigned int zero1 : 2;
82 unsigned int stream_number_4_3 : 5;
83 unsigned int zero2 : 3;
84 unsigned int stream_number_wide : 5;
85 unsigned int zero3 : 3;
86 unsigned int stream_number_letterbox : 5;
87 unsigned int zero4 : 3;
88 unsigned int stream_number_pan_scan : 5;
89 #else
90 unsigned int stream_number_pan_scan : 5;
91 unsigned int zero4 : 3;
92 unsigned int stream_number_letterbox : 5;
93 unsigned int zero3 : 3;
94 unsigned int stream_number_wide : 5;
95 unsigned int zero2 : 3;
96 unsigned int stream_number_4_3 : 5;
97 unsigned int zero1 : 2;
98 unsigned int available : 1;
99 #endif
100 } ATTRIBUTE_PACKED spu_status_t;
101 #endif
102
103 /* The main DVDNAV type */
104
105 struct dvdnav_s {
106 /* General data */
107 char path[MAX_PATH_LEN]; /* Path to DVD device/dir */
108 dvd_file_t *file; /* Currently opened file */
109 int open_vtsN; /* The domain and number of the... */
110 int open_domain; /* ..currently opened VOB */
111
112 /* Position data */
113 uint32_t vobu_start;
114 uint32_t vobu_length;
115 uint32_t blockN;
116 uint32_t next_vobu;
117 cell_playback_t *cell;
118 uint32_t jmp_blockN;
119 uint32_t jmp_vobu_start;
120 uint32_t seekto_block;
121
122 /* NAV data */
123 pci_t pci;
124 dsi_t dsi;
125
126 /* Flags */
127 int expecting_nav_packet;
128 int at_soc; /* Are we at the start of a cell? */
129 int still_frame; /* >=0 send still frame event with len still_frame
130 * -1 don't send event. */
131 int jumping; /* non-zero if we are in the process of jumping */
132 int seeking; /* non-zero if we are in the process of seeking */
133 int stop; /* Are we stopped? (note not paused, actually stopped) */
134 int highlight_changed; /* The highlight changed */
135 int spu_clut_changed; /* The SPU CLUT changed */
136 int spu_stream_changed; /* The SPU STREAM changed */
137 int audio_stream_changed; /* The AUDIO STREAM changed */
138 int started; /* vm_start has been called? */
139 int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */
140 /* VM */
141 vm_t* vm;
142 pthread_mutex_t vm_lock;
143
144 /* Highlight */
145 int hli_state; /* State of highlight 0 - disabled, 1 - selected,
146 2 - activated */
147 uint16_t hli_bbox[4]; /* Highlight bounding box */
148 uint32_t hli_clut; /* Highlight palette */
149 uint32_t hli_pts; /* Highlight PTS for matching with SPU packet. */
150 uint32_t hli_buttonN; /* Button number for SPU decoder. */
151 /* Read-ahead cache. */
152 uint8_t *cache_buffer;
153 int32_t cache_start_sector; /* -1 means cache invalid */
154 size_t cache_block_count;
155 size_t cache_malloc_size;
156 int cache_valid;
157
158 /* Errors */
159 char err_str[MAX_ERR_LEN];
160 };
161
162 /* Common things we do everytime we do a jump */
163 void dvdnav_do_post_jump(dvdnav_t *self);
164
165 /** USEFUL MACROS **/
166
167 #define printerrf(format, args...) snprintf(self->err_str, MAX_ERR_LEN, format, ## args);
168 #define printerr(str) strncpy(self->err_str, str, MAX_ERR_LEN);
169 /* Save my typing */
170
171 #define S_ERR DVDNAV_STATUS_ERR
172 #define S_OK DVDNAV_STATUS_OK
173
174 #endif /* DVDNAV_INTERNAL_H_INCLUDED */