Mercurial > libdvdnav.hg
annotate settings.c @ 99:c5e47a98c883 src
fix possible unlock on not locked mutex
author | mroi |
---|---|
date | Wed, 18 Sep 2002 14:26:42 +0000 |
parents | e74cba5129a6 |
children | b6834e6359cf |
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) { |
93 | 36 if(!this) { |
37 printerr("Passed a NULL this pointer"); | |
38 return S_ERR; | |
39 } | |
0 | 40 |
41 if(!region) { | |
93 | 42 printerr("Passed a NULL region pointer"); |
0 | 43 return S_ERR; |
44 } | |
45 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
46 if(!this->vm) { |
0 | 47 printerr("VM not yet initialised"); |
48 return S_ERR; | |
49 } | |
50 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
51 (*region) = this->vm->state.registers.SPRM[20]; |
0 | 52 |
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_region_mask(dvdnav_t *this, int mask) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
57 if(!this) |
0 | 58 return S_ERR; |
59 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
60 if(!this->vm) { |
0 | 61 printerr("VM not yet initialised"); |
62 return S_ERR; | |
63 } | |
64 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
65 this->vm->state.registers.SPRM[20] = (mask & 0xff); |
0 | 66 |
67 return S_OK; | |
68 } | |
69 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
70 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
|
71 if(!this) |
0 | 72 return S_ERR; |
73 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
74 this->use_read_ahead = use_readahead; |
0 | 75 |
76 return S_OK; | |
77 } | |
78 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
79 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int* flag) { |
93 | 80 if(!this) { |
81 printerr("Passed a NULL this pointer"); | |
82 return S_ERR; | |
83 } | |
0 | 84 |
85 if(!flag) { | |
93 | 86 printerr("Passed a NULL flag pointer"); |
0 | 87 return S_ERR; |
88 } | |
89 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
90 (*flag) = this->use_read_ahead; |
0 | 91 return S_OK; |
92 } | |
93 | |
44 | 94 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
93 | 95 if(!this ) { |
96 printerr("Passed a NULL this pointer"); | |
44 | 97 return S_ERR; |
93 | 98 } |
44 | 99 |
93 | 100 if(!code) { |
101 printerr("Passed a NULL code pointer"); | |
102 return S_ERR; | |
103 } | |
104 | |
44 | 105 if(!code[0] || !code[1]) { |
106 printerr("Passed illegal language code"); | |
107 return S_ERR; | |
108 } | |
109 | |
110 if(!this->vm) { | |
111 printerr("VM not yet initialised"); | |
112 return S_ERR; | |
113 } | |
114 | |
115 pthread_mutex_lock(&this->vm_lock); | |
116 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
117 pthread_mutex_unlock(&this->vm_lock); | |
118 return S_OK; | |
119 } | |
120 | |
121 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
122 return set_language_register(this, code, 0); | |
123 } | |
124 | |
125 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
126 return set_language_register(this, code, 16); | |
127 } | |
128 | |
129 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
130 return set_language_register(this, code, 18); | |
131 } |