149 static PyObject * ifoinfo_get_subtitle_track(ifo_handle_t *vtsfile, int ttn, int id) {
150 int subid = id;
151 char language[5];
152 subp_attr_t *attr;
153 video_attr_t *video = &vtsfile->vtsi_mat->vts_video_attr;
154 pgc_t *pgc = vtsfile->vts_pgcit ? vtsfile->vts_pgcit->pgci_srp[ttn].pgc : NULL;
when treating unknown struct ifo_handle_t * from src/disc/ifomodule.c:150 as non-NULL
when treating unknown struct vtsi_mat_t * from src/disc/ifomodule.c:154 as non-NULL
155
when treating unknown struct pgcit_t * from src/disc/ifomodule.c:155 as non-NULL
taking True path
when treating unknown struct pgcit_t * from src/disc/ifomodule.c:155 as non-NULL
when treating unknown struct pgci_srp_t * from src/disc/ifomodule.c:155 as non-NULL
156 if (!pgc || (pgc->subp_control[id] & 0x80000000) == 0)
157 return NULL;
when treating unknown struct pgc_t * from src/disc/ifomodule.c:155 as non-NULL
taking False path
taking True path
158
159 attr = &vtsfile->vtsi_mat->vts_subp_attr[id];
160
161 if ( attr->type == 0
162 && attr->lang_code == 0
163 && attr->zero1 == 0
164 && attr->zero2 == 0
165 && attr->lang_extension == 0 ) {
166 return NULL;
167 }
168
169 if (video->display_aspect_ratio == 0) // 4:3
170 subid = pgc->subp_control[id] >> 24 & 31;
171 else if(video->display_aspect_ratio == 3) // 16:9
172 subid = pgc->subp_control[id] >> 8 & 31;
173
174 /* language code */
175 if (isalpha((int)(attr->lang_code >> 8)) &&
176 isalpha((int)(attr->lang_code & 0xff))) {
177 snprintf(language, 5, "%c%c", attr->lang_code >> 8,
178 attr->lang_code & 0xff);
179 } else {
180 snprintf(language, 5, "%02x%02x",
181 0xff & (unsigned)(attr->lang_code >> 8),
182 0xff & (unsigned)(attr->lang_code & 0xff));
183 }
184
185 return Py_BuildValue("(is)", subid, language);
186 }
187