Mercurial > libdvdnav.hg
annotate settings.c @ 290:54b6a000f6da src
decoder.h needs inclusion of sys/time.h
author | nicodvb |
---|---|
date | Sat, 21 Apr 2007 22:01:34 +0000 |
parents | ce4230602517 |
children | e1769287ee6a |
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 | |
286
6fac6a613ea5
moved inclusion of inttypes.h from dvd_types.h to the including .c files
nicodvb
parents:
285
diff
changeset
|
28 #include <inttypes.h> |
288
ce4230602517
moved away from dvdnav_internal.h inclusion of various system headers
nicodvb
parents:
286
diff
changeset
|
29 #include <string.h> |
290 | 30 #include <sys/time.h> |
285
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
31 #include "dvd_types.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
32 #include "nav_types.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
33 #include "ifo_types.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
34 #include "remap.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
35 #include "vm/decoder.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
36 #include "vm/vm.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
37 #include "vm/vmcmd.h" |
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
218
diff
changeset
|
38 #include "dvdnav.h" |
0 | 39 #include "dvdnav_internal.h" |
40 | |
41 /* Characteristics/setting API calls */ | |
42 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
43 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int32_t *region) { |
114 | 44 if(!this || !region) { |
45 printerr("Passed a NULL this pointer."); | |
193 | 46 return DVDNAV_STATUS_ERR; |
0 | 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]; |
193 | 50 return DVDNAV_STATUS_OK; |
0 | 51 } |
52 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
53 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int32_t mask) { |
114 | 54 if(!this) { |
55 printerr("Passed a NULL this pointer."); | |
193 | 56 return DVDNAV_STATUS_ERR; |
0 | 57 } |
58 | |
114 | 59 pthread_mutex_lock(&this->vm_lock); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
60 this->vm->state.registers.SPRM[20] = (mask & 0xff); |
114 | 61 pthread_mutex_unlock(&this->vm_lock); |
193 | 62 return DVDNAV_STATUS_OK; |
0 | 63 } |
64 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
65 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int32_t use_readahead) { |
114 | 66 if(!this) { |
67 printerr("Passed a NULL this pointer."); | |
193 | 68 return DVDNAV_STATUS_ERR; |
114 | 69 } |
0 | 70 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
71 this->use_read_ahead = use_readahead; |
193 | 72 return DVDNAV_STATUS_OK; |
0 | 73 } |
74 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
75 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int32_t *flag) { |
114 | 76 if(!this || !flag) { |
77 printerr("Passed a NULL this pointer."); | |
193 | 78 return DVDNAV_STATUS_ERR; |
0 | 79 } |
80 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
81 (*flag) = this->use_read_ahead; |
193 | 82 return DVDNAV_STATUS_OK; |
0 | 83 } |
84 | |
44 | 85 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
114 | 86 if(!this || !code) { |
87 printerr("Passed a NULL this pointer."); | |
193 | 88 return DVDNAV_STATUS_ERR; |
93 | 89 } |
44 | 90 |
91 if(!code[0] || !code[1]) { | |
114 | 92 printerr("Passed illegal language code."); |
193 | 93 return DVDNAV_STATUS_ERR; |
44 | 94 } |
95 | |
96 pthread_mutex_lock(&this->vm_lock); | |
97 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
98 pthread_mutex_unlock(&this->vm_lock); | |
193 | 99 return DVDNAV_STATUS_OK; |
44 | 100 } |
101 | |
102 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
103 return set_language_register(this, code, 0); | |
104 } | |
105 | |
106 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
107 return set_language_register(this, code, 16); | |
108 } | |
109 | |
110 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
111 return set_language_register(this, code, 18); | |
112 } | |
132 | 113 |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
114 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int32_t pgc) { |
132 | 115 if(!this) { |
116 printerr("Passed a NULL this pointer."); | |
193 | 117 return DVDNAV_STATUS_ERR; |
132 | 118 } |
119 | |
120 this->pgc_based = pgc; | |
193 | 121 return DVDNAV_STATUS_OK; |
132 | 122 } |
123 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
124 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int32_t *flag) { |
132 | 125 if(!this || !flag) { |
126 printerr("Passed a NULL this pointer."); | |
193 | 127 return DVDNAV_STATUS_ERR; |
132 | 128 } |
129 | |
130 (*flag) = this->pgc_based; | |
193 | 131 return DVDNAV_STATUS_OK; |
132 | 132 } |