| 187 | } |
| 188 | |
| 189 | hb_title_t * hb_batch_title_scan_single(hb_handle_t *h, char *filename, int title_index) |
| 190 | { |
| 191 | hb_title_t *title; |
| 192 | hb_stream_t *stream; |
| 193 | |
| 194 | if (title_index < 0) |
| 195 | { |
| 196 | return NULL; |
| 197 | } |
| 198 | |
| 199 | if (!hb_is_valid_batch_path(filename)) |
| 200 | { |
| 201 | return NULL; |
| 202 | } |
| 203 | |
| 204 | hb_log("batch: scanning %s", filename); |
| 205 | title = hb_title_init(filename, title_index); |
| 206 | |
| 207 | if (title == NULL) |
| 208 | { |
| 209 | return NULL; |
| 210 | } |
| 211 | |
| 212 | stream = hb_stream_open(h, filename, title, 1); |
| 213 | |
| 214 | if (stream == NULL) |
| 215 | { |
| 216 | hb_title_close(&title); |
| 217 | return NULL; |
| 218 | } |
| 219 | |
| 220 | title = hb_stream_title_scan(stream, title); |
| 221 | hb_stream_close(&stream); |
| 222 | |
| 223 | return title; |
| 224 | } |
| 225 | |
| 226 | int hb_is_valid_batch_path(const char *filename) |
| 227 | { |
no test coverage detected