Fix vf_tcdump's compilation
[mplayer/kovensky.git] / libdvdnav / settings.c
blobb05e9bee79cbc6476bf4c761f0c1c5f15011da6f
1 /*
2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net>
4 * This file is part of libdvdnav, a DVD navigation library.
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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
25 #include <inttypes.h>
26 #include <limits.h>
27 #include <string.h>
28 #include <sys/time.h>
29 #include "dvdnav/dvdnav.h"
30 #include <dvdread/nav_types.h>
31 #include <dvdread/ifo_types.h>
32 #include "remap.h"
33 #include "vm/decoder.h"
34 #include "vm/vm.h"
35 #include "dvdnav_internal.h"
37 /* Characteristics/setting API calls */
39 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int32_t *region) {
40 (*region) = this->vm->state.registers.SPRM[20];
41 return DVDNAV_STATUS_OK;
44 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int32_t mask) {
45 pthread_mutex_lock(&this->vm_lock);
46 this->vm->state.registers.SPRM[20] = (mask & 0xff);
47 pthread_mutex_unlock(&this->vm_lock);
48 return DVDNAV_STATUS_OK;
51 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int32_t use_readahead) {
52 this->use_read_ahead = use_readahead;
53 return DVDNAV_STATUS_OK;
56 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int32_t *flag) {
57 (*flag) = this->use_read_ahead;
58 return DVDNAV_STATUS_OK;
61 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) {
62 if(!code[0] || !code[1]) {
63 printerr("Passed illegal language code.");
64 return DVDNAV_STATUS_ERR;
67 pthread_mutex_lock(&this->vm_lock);
68 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1];
69 pthread_mutex_unlock(&this->vm_lock);
70 return DVDNAV_STATUS_OK;
73 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) {
74 return set_language_register(this, code, 0);
77 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) {
78 return set_language_register(this, code, 16);
81 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) {
82 return set_language_register(this, code, 18);
85 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int32_t pgc) {
86 this->pgc_based = pgc;
87 return DVDNAV_STATUS_OK;
90 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int32_t *flag) {
91 (*flag) = this->pgc_based;
92 return DVDNAV_STATUS_OK;