Mercurial > libdvdnav.hg
annotate settings.c @ 306:9aea3dbbfa91 src
don't call dvdnav functions from within dvdread
author | nicodvb |
---|---|
date | Thu, 02 Aug 2007 21:58:59 +0000 |
parents | 2146ff691bcd |
children | 68736572c62c |
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> |
294
2146ff691bcd
include limits.h; it was included in the previous dvdnav_internal.h and without it players segfault
nicodvb
parents:
293
diff
changeset
|
29 #include <limits.h> |
288
ce4230602517
moved away from dvdnav_internal.h inclusion of various system headers
nicodvb
parents:
286
diff
changeset
|
30 #include <string.h> |
290 | 31 #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
|
32 #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
|
33 #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
|
34 #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
|
35 #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
|
36 #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
|
37 #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
|
38 #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
|
39 #include "dvdnav.h" |
0 | 40 #include "dvdnav_internal.h" |
41 | |
42 /* Characteristics/setting API calls */ | |
43 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
44 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int32_t *region) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
45 (*region) = this->vm->state.registers.SPRM[20]; |
193 | 46 return DVDNAV_STATUS_OK; |
0 | 47 } |
48 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
49 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int32_t mask) { |
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); |
193 | 53 return DVDNAV_STATUS_OK; |
0 | 54 } |
55 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
56 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int32_t use_readahead) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
57 this->use_read_ahead = use_readahead; |
193 | 58 return DVDNAV_STATUS_OK; |
0 | 59 } |
60 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
61 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int32_t *flag) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
0
diff
changeset
|
62 (*flag) = this->use_read_ahead; |
193 | 63 return DVDNAV_STATUS_OK; |
0 | 64 } |
65 | |
44 | 66 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
67 if(!code[0] || !code[1]) { | |
114 | 68 printerr("Passed illegal language code."); |
193 | 69 return DVDNAV_STATUS_ERR; |
44 | 70 } |
71 | |
72 pthread_mutex_lock(&this->vm_lock); | |
73 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
74 pthread_mutex_unlock(&this->vm_lock); | |
193 | 75 return DVDNAV_STATUS_OK; |
44 | 76 } |
77 | |
78 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
79 return set_language_register(this, code, 0); | |
80 } | |
81 | |
82 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
83 return set_language_register(this, code, 16); | |
84 } | |
85 | |
86 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
87 return set_language_register(this, code, 18); | |
88 } | |
132 | 89 |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
90 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int32_t pgc) { |
132 | 91 this->pgc_based = pgc; |
193 | 92 return DVDNAV_STATUS_OK; |
132 | 93 } |
94 | |
218
c2d0cf87a5ee
Some fixes to that libdvdnav compiles under cygwin.
jcdutton
parents:
193
diff
changeset
|
95 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int32_t *flag) { |
132 | 96 (*flag) = this->pgc_based; |
193 | 97 return DVDNAV_STATUS_OK; |
132 | 98 } |