Mercurial > libdvdnav.hg
annotate settings.c @ 51:bcc3af5643b9 src
Slight changes to comply with
http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC83
author | jcdutton |
---|---|
date | Wed, 03 Jul 2002 00:24:47 +0000 |
parents | c50cb59dbb19 |
children | e74cba5129a6 |
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.h> | |
29 #include "dvdnav_internal.h" | |
30 | |
31 #include "vm.h" | |
32 | |
33 /* Characteristics/setting API calls */ | |
34 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
35 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int *region) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
36 if(!this) |
0 | 37 return S_ERR; |
38 | |
39 if(!region) { | |
40 printerr("Passed a NULL pointer"); | |
41 return S_ERR; | |
42 } | |
43 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
44 if(!this->vm) { |
0 | 45 printerr("VM not yet initialised"); |
46 return S_ERR; | |
47 } | |
48 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
49 (*region) = this->vm->state.registers.SPRM[20]; |
0 | 50 |
51 return S_OK; | |
52 } | |
53 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
54 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int mask) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
55 if(!this) |
0 | 56 return S_ERR; |
57 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
58 if(!this->vm) { |
0 | 59 printerr("VM not yet initialised"); |
60 return S_ERR; | |
61 } | |
62 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
63 this->vm->state.registers.SPRM[20] = (mask & 0xff); |
0 | 64 |
65 return S_OK; | |
66 } | |
67 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
68 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int use_readahead) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
69 if(!this) |
0 | 70 return S_ERR; |
71 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
72 this->use_read_ahead = use_readahead; |
0 | 73 |
74 return S_OK; | |
75 } | |
76 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
77 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int* flag) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
78 if(!this) |
0 | 79 return S_ERR; |
80 | |
81 if(!flag) { | |
82 printerr("Passed a NULL pointer"); | |
83 return S_ERR; | |
84 } | |
85 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
86 (*flag) = this->use_read_ahead; |
0 | 87 return S_OK; |
88 } | |
89 | |
44 | 90 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
91 if(!this) | |
92 return S_ERR; | |
93 | |
94 if(!code[0] || !code[1]) { | |
95 printerr("Passed illegal language code"); | |
96 return S_ERR; | |
97 } | |
98 | |
99 if(!this->vm) { | |
100 printerr("VM not yet initialised"); | |
101 return S_ERR; | |
102 } | |
103 | |
104 pthread_mutex_lock(&this->vm_lock); | |
105 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
106 pthread_mutex_unlock(&this->vm_lock); | |
107 return S_OK; | |
108 } | |
109 | |
110 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
111 return set_language_register(this, code, 0); | |
112 } | |
113 | |
114 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
115 return set_language_register(this, code, 16); | |
116 } | |
117 | |
118 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
119 return set_language_register(this, code, 18); | |
120 } |