MythTV  0.26-pre
settings.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net>
00003  *
00004  * This file is part of libdvdnav, a DVD navigation library.
00005  *
00006  * libdvdnav is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * libdvdnav is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
00018  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00019  */
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include "config.h"
00023 #endif
00024 
00025 #include <inttypes.h>
00026 #include <limits.h>
00027 #include <string.h>
00028 #include <sys/time.h>
00029 #include "dvdnav/dvdnav.h"
00030 #include <dvdread/nav_types.h>
00031 #include <dvdread/ifo_types.h>
00032 #include "remap.h"
00033 #include "vm/decoder.h"
00034 #include "vm/vm.h"
00035 #include "dvdnav_internal.h"
00036 
00037 /* Characteristics/setting API calls */
00038 
00039 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int32_t *region) {
00040   (*region) = this->vm->state.registers.SPRM[20];
00041   return DVDNAV_STATUS_OK;
00042 }
00043 
00044 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int32_t mask) {
00045   pthread_mutex_lock(&this->vm_lock);
00046   this->vm->state.registers.SPRM[20] = (mask & 0xff);
00047   pthread_mutex_unlock(&this->vm_lock);
00048   return DVDNAV_STATUS_OK;
00049 }
00050 
00051 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int32_t use_readahead) {
00052   this->use_read_ahead = use_readahead;
00053   return DVDNAV_STATUS_OK;
00054 }
00055 
00056 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int32_t *flag) {
00057   (*flag) = this->use_read_ahead;
00058   return DVDNAV_STATUS_OK;
00059 }
00060 
00061 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) {
00062   if(!code[0] || !code[1]) {
00063     printerr("Passed illegal language code.");
00064     return DVDNAV_STATUS_ERR;
00065   }
00066 
00067   pthread_mutex_lock(&this->vm_lock);
00068   this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1];
00069   pthread_mutex_unlock(&this->vm_lock);
00070   return DVDNAV_STATUS_OK;
00071 }
00072 
00073 dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) {
00074   return set_language_register(this, code, 0);
00075 }
00076 
00077 dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) {
00078   return set_language_register(this, code, 16);
00079 }
00080 
00081 dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) {
00082   return set_language_register(this, code, 18);
00083 }
00084 
00085 dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int32_t pgc) {
00086   this->pgc_based = pgc;
00087   return DVDNAV_STATUS_OK;
00088 }
00089 
00090 dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int32_t *flag) {
00091   (*flag) = this->pgc_based;
00092   return DVDNAV_STATUS_OK;
00093 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends