comparison navigation.c @ 90:eeabf5a51b2b src

Improve chapter selection functions.
author jcdutton
date Tue, 03 Sep 2002 07:50:45 +0000
parents 794d2e16a4d4
children e29110f67f3a
comparison
equal deleted inserted replaced
89:0fbef4901e2c 90:eeabf5a51b2b
54 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts; 54 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts;
55 55
56 return S_OK; 56 return S_OK;
57 } 57 }
58 58
59 /* This function should not be used. FIXME: Suggest alternative */
59 dvdnav_status_t dvdnav_get_number_of_programs(dvdnav_t *this, int *programs) { 60 dvdnav_status_t dvdnav_get_number_of_programs(dvdnav_t *this, int *programs) {
60 if(!this) 61 if(!this)
61 return S_ERR; 62 return S_ERR;
62 63
63 if(!programs) { 64 if(!programs) {
68 (*programs) = this->vm->state.pgc->nr_of_programs; 69 (*programs) = this->vm->state.pgc->nr_of_programs;
69 70
70 return S_OK; 71 return S_OK;
71 } 72 }
72 73
74 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part) {
75 if(!this || !this->vm)
76 return S_ERR;
77
78 if(!title || !part) {
79 printerr("Passed a NULL pointer");
80 return S_ERR;
81 }
82
83 return vm_get_current_title_part(this->vm, title, part);
84 }
85
73 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) { 86 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) {
74 int num_titles;
75 87
76 if(!this) { 88 if(!this) {
77 return S_ERR; 89 return S_ERR;
78 } 90 }
79 91
80 /* Check number of titles */ 92 return dvdnav_part_play(this, title, 1);
81 dvdnav_get_number_of_titles(this, &num_titles);
82 if((title > num_titles) || (title <= 0)) {
83 printerrf("Invalid title passed (%i, maximum %i)", title,
84 num_titles);
85 return S_ERR;
86 }
87
88 vm_start_title(this->vm, title);
89
90 return S_OK;
91 } 93 }
92 94
93 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) { 95 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) {
94 int num_titles, num_progs;
95 96
96 if(!this) { 97 if(!this) {
97 return S_ERR; 98 return S_ERR;
98 } 99 }
99 100
100 /* Check number of titles */ 101 return vm_jump_title_part(this->vm, title, part);
101 dvdnav_get_number_of_titles(this, &num_titles);
102 if((title > num_titles) || (title <= 0)) {
103 printerrf("Invalid title passed (%i, maximum %i)", title,
104 num_titles);
105 return S_ERR;
106 }
107
108 vm_start_title(this->vm, title);
109
110
111 /* Check number of parts */
112 num_progs = this->vm->state.pgc->nr_of_programs;
113 if((part > num_progs) || (part <= 0)) {
114 printerrf("Invalid program passed (%i, maximum %i)", part,
115 num_progs);
116 return S_ERR;
117 }
118
119 vm_jump_prog(this->vm, part);
120
121 return S_OK;
122 } 102 }
123 103
124 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title, 104 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title,
125 int part, int parts_to_play) { 105 int part, int parts_to_play) {
126 /* Perform jump as per usual */ 106 /* Perform jump as per usual */