Mercurial > libdvdread4.hg
comparison settings.c @ 0:427b7da5cbdb src
first split of dvdread; it's just a copy of dvdnav still to be cleaned
author | nicodvb |
---|---|
date | Sun, 01 Jun 2008 08:39:07 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:427b7da5cbdb |
---|---|
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 <inttypes.h> | |
29 #include <limits.h> | |
30 #include <string.h> | |
31 #include <sys/time.h> | |
32 #include "dvd_types.h" | |
33 #include "nav_types.h" | |
34 #include "ifo_types.h" | |
35 #include "remap.h" | |
36 #include "vm/decoder.h" | |
37 #include "vm/vm.h" | |
38 #include "dvdnav.h" | |
39 #include "dvdnav_internal.h" | |
40 | |
41 /* Characteristics/setting API calls */ | |
42 | |
43 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int32_t *region) { | |
44 (*region) = this->vm->state.registers.SPRM[20]; | |
45 return DVDNAV_STATUS_OK; | |
46 } | |
47 | |
48 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int32_t mask) { | |
49 pthread_mutex_lock(&this->vm_lock); | |
50 this->vm->state.registers.SPRM[20] = (mask & 0xff); | |
51 pthread_mutex_unlock(&this->vm_lock); | |
52 return DVDNAV_STATUS_OK; | |
53 } | |
54 | |
55 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int32_t use_readahead) { | |
56 this->use_read_ahead = use_readahead; | |
57 return DVDNAV_STATUS_OK; | |
58 } | |
59 | |
60 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int32_t *flag) { | |
61 (*flag) = this->use_read_ahead; | |
62 return DVDNAV_STATUS_OK; | |
63 } | |
64 | |
65 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { | |
66 if(!code[0] || !code[1]) { | |
67 printerr("Passed illegal language code."); | |
68 return DVDNAV_STATUS_ERR; | |
69 } | |
70 | |
71 pthread_mutex_lock(&this->vm_lock); | |
72 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | |
73 pthread_mutex_unlock(&this->vm_lock); | |
74 return DVDNAV_STATUS_OK; | |
75 } | |
76 | |
77 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) { | |
78 return set_language_register(this, code, 0); | |
79 } | |
80 | |
81 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) { | |
82 return set_language_register(this, code, 16); | |
83 } | |
84 | |
85 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { | |
86 return set_language_register(this, code, 18); | |
87 } | |
88 | |
89 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int32_t pgc) { | |
90 this->pgc_based = pgc; | |
91 return DVDNAV_STATUS_OK; | |
92 } | |
93 | |
94 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int32_t *flag) { | |
95 (*flag) = this->pgc_based; | |
96 return DVDNAV_STATUS_OK; | |
97 } |