Mercurial > libdvdnav.hg
comparison settings.c @ 114:b6834e6359cf src
big libdvdnav cleanup, quoting the ChangeLog:
* some bugfixes
* code cleanup
* build process polishing
* more sensible event order in get_next_block to ensure useful event delivery
* VOBU level resume
* fixed: seeking in a multiangle feature briefly showed the wrong angle
author | mroi |
---|---|
date | Thu, 20 Feb 2003 15:32:21 +0000 |
parents | e74cba5129a6 |
children | f22458f928b8 |
comparison
equal
deleted
inserted
replaced
113:ec2df154be56 | 114:b6834e6359cf |
---|---|
23 | 23 |
24 #ifdef HAVE_CONFIG_H | 24 #ifdef HAVE_CONFIG_H |
25 #include "config.h" | 25 #include "config.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #include <dvdnav.h> | |
29 #include "dvdnav_internal.h" | 28 #include "dvdnav_internal.h" |
30 | 29 |
31 #include "vm.h" | 30 #include "vm.h" |
32 | 31 |
33 /* Characteristics/setting API calls */ | 32 /* Characteristics/setting API calls */ |
34 | 33 |
35 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int *region) { | 34 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int *region) { |
36 if(!this) { | 35 if(!this || !region) { |
37 printerr("Passed a NULL this pointer"); | 36 printerr("Passed a NULL this pointer."); |
38 return S_ERR; | |
39 } | |
40 | |
41 if(!region) { | |
42 printerr("Passed a NULL region pointer"); | |
43 return S_ERR; | |
44 } | |
45 | |
46 if(!this->vm) { | |
47 printerr("VM not yet initialised"); | |
48 return S_ERR; | 37 return S_ERR; |
49 } | 38 } |
50 | 39 |
51 (*region) = this->vm->state.registers.SPRM[20]; | 40 (*region) = this->vm->state.registers.SPRM[20]; |
52 | |
53 return S_OK; | 41 return S_OK; |
54 } | 42 } |
55 | 43 |
56 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int mask) { | 44 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int mask) { |
57 if(!this) | 45 if(!this) { |
58 return S_ERR; | 46 printerr("Passed a NULL this pointer."); |
59 | |
60 if(!this->vm) { | |
61 printerr("VM not yet initialised"); | |
62 return S_ERR; | 47 return S_ERR; |
63 } | 48 } |
64 | 49 |
50 pthread_mutex_lock(&this->vm_lock); | |
65 this->vm->state.registers.SPRM[20] = (mask & 0xff); | 51 this->vm->state.registers.SPRM[20] = (mask & 0xff); |
66 | 52 pthread_mutex_unlock(&this->vm_lock); |
67 return S_OK; | 53 return S_OK; |
68 } | 54 } |
69 | 55 |
70 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int use_readahead) { | 56 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int use_readahead) { |
71 if(!this) | 57 if(!this) { |
72 return S_ERR; | 58 printerr("Passed a NULL this pointer."); |
59 return S_ERR; | |
60 } | |
73 | 61 |
74 this->use_read_ahead = use_readahead; | 62 this->use_read_ahead = use_readahead; |
75 | |
76 return S_OK; | 63 return S_OK; |
77 } | 64 } |
78 | 65 |
79 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int* flag) { | 66 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int *flag) { |
80 if(!this) { | 67 if(!this || !flag) { |
81 printerr("Passed a NULL this pointer"); | 68 printerr("Passed a NULL this pointer."); |
82 return S_ERR; | |
83 } | |
84 | |
85 if(!flag) { | |
86 printerr("Passed a NULL flag pointer"); | |
87 return S_ERR; | 69 return S_ERR; |
88 } | 70 } |
89 | 71 |
90 (*flag) = this->use_read_ahead; | 72 (*flag) = this->use_read_ahead; |
91 return S_OK; | 73 return S_OK; |
92 } | 74 } |
93 | 75 |
94 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { | 76 static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) { |
95 if(!this ) { | 77 if(!this || !code) { |
96 printerr("Passed a NULL this pointer"); | 78 printerr("Passed a NULL this pointer."); |
97 return S_ERR; | 79 return S_ERR; |
98 } | 80 } |
99 | 81 |
100 if(!code) { | |
101 printerr("Passed a NULL code pointer"); | |
102 return S_ERR; | |
103 } | |
104 | |
105 if(!code[0] || !code[1]) { | 82 if(!code[0] || !code[1]) { |
106 printerr("Passed illegal language code"); | 83 printerr("Passed illegal language code."); |
107 return S_ERR; | |
108 } | |
109 | |
110 if(!this->vm) { | |
111 printerr("VM not yet initialised"); | |
112 return S_ERR; | 84 return S_ERR; |
113 } | 85 } |
114 | 86 |
115 pthread_mutex_lock(&this->vm_lock); | 87 pthread_mutex_lock(&this->vm_lock); |
116 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; | 88 this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1]; |