Mercurial > libdvdnav.hg
annotate settings.c @ 132:f22458f928b8 src
PGC based positioning
author | mroi |
---|---|
date | Sun, 23 Mar 2003 15:24:31 +0000 |
parents | b6834e6359cf |
children | 5897ff629f7c |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000 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 #ifdef HAVE_CONFIG_H | |
25 #include "config.h" | |
26 #endif | |
27 | |
28 #include "dvdnav_internal.h" | |
29 | |
30 #include "vm.h" | |
31 | |
32 /* Characteristics/setting API calls */ | |
33 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
34 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int *region) { |
114 | 35 if(!this || !region) { |
36 printerr("Passed a NULL this pointer."); | |
0 | 37 return S_ERR; |
38 } | |
39 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
40 (*region) = this->vm->state.registers.SPRM[20]; |
0 | 41 return S_OK; |
42 } | |
43 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
44 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int mask) { |
114 | 45 if(!this) { |
46 printerr("Passed a NULL this pointer."); | |
0 | 47 return S_ERR; |
48 } | |
49 | |
114 | 50 pthread_mutex_lock(&this->vm_lock); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
51 this->vm->state.registers.SPRM[20] = (mask & 0xff); |
114 | 52 pthread_mutex_unlock(&this->vm_lock); |
0 | 53 return S_OK; |
54 } | |
55 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
56 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int use_readahead) { |
114 | 57 if(!this) { |
58 printerr("Passed a NULL this pointer."); | |
59 return S_ERR; | |
60 } | |
0 | 61 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
62 this->use_read_ahead = use_readahead; |
0 | 63 return S_OK; |
64 } | |
65 | |
114 | 66 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int *flag) { |
67 if(!this || !flag) { | |
68 printerr("Passed a NULL this pointer."); | |
0 | 69 return S_ERR; |
70 } | |
71 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
72 (*flag) = this->use_read_ahead; |
0 | 73 return S_OK; |
74 } | |
75 | |
44 | 76 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
114 | 77 if(!this || !code) { |
78 printerr("Passed a NULL this pointer."); | |
44 | 79 return S_ERR; |
93 | 80 } |
44 | 81 |
82 if(!code[0] || !code[1]) { | |
114 | 83 printerr("Passed illegal language code."); |
44 | 84 return S_ERR; |
85 } | |
86 | |
87 pthread_mutex_lock(&this->vm_lock); | |
88 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
89 pthread_mutex_unlock(&this->vm_lock); | |
90 return S_OK; | |
91 } | |
92 | |
93 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
94 return set_language_register(this, code, 0); | |
95 } | |
96 | |
97 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
98 return set_language_register(this, code, 16); | |
99 } | |
100 | |
101 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
102 return set_language_register(this, code, 18); | |
103 } | |
132 | 104 |
105 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int pgc) { | |
106 if(!this) { | |
107 printerr("Passed a NULL this pointer."); | |
108 return S_ERR; | |
109 } | |
110 | |
111 this->pgc_based = pgc; | |
112 return S_OK; | |
113 } | |
114 | |
115 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int *flag) { | |
116 if(!this || !flag) { | |
117 printerr("Passed a NULL this pointer."); | |
118 return S_ERR; | |
119 } | |
120 | |
121 (*flag) = this->pgc_based; | |
122 return S_OK; | |
123 } |