* Initializes a scan of the by calling hb_scan_init * @param h Handle to hb_handle_t * @param path location of VIDEO_TS folder. * @param title_index Desired title to scan. 0 for all titles. * @param preview_count Number of preview images to generate. * @param store_previews Whether or not to write previews to disk. * @param min_duration Ignore titles below a given threshold * @param max_du
| 374 | * @param keep_duplicate_titles |
| 375 | */ |
| 376 | void hb_scan( hb_handle_t * h, hb_list_t * paths, int title_index, |
| 377 | int preview_count, int store_previews, uint64_t min_duration, uint64_t max_duration, |
| 378 | int crop_threshold_frames, int crop_threshold_pixels, |
| 379 | hb_list_t * exclude_extensions, int hw_decode, int keep_duplicate_titles) |
| 380 | { |
| 381 | hb_title_t * title; |
| 382 | |
| 383 | char *single_path = NULL; |
| 384 | int path_count = hb_list_count(paths); |
| 385 | |
| 386 | if (path_count == 1) |
| 387 | { |
| 388 | single_path = hb_list_item(paths, 0); |
| 389 | } |
| 390 | |
| 391 | // Check if scanning is necessary. Only works on Single Path. |
| 392 | if (single_path != NULL && h->title_set.path != NULL && !strcmp(h->title_set.path, single_path)) |
| 393 | { |
| 394 | // Current title_set path matches requested single_path. |
| 395 | // Check if the requested title has already been scanned. |
| 396 | int ii; |
| 397 | for (ii = 0; ii < hb_list_count(h->title_set.list_title); ii++) |
| 398 | { |
| 399 | title = hb_list_item(h->title_set.list_title, ii); |
| 400 | if (title->index == title_index) |
| 401 | { |
| 402 | // In some cases, we don't care what the preview count is. |
| 403 | // E.g. when rescanning at the start of a job. In these |
| 404 | // cases, the caller can set preview_count to -1 to tell |
| 405 | // us to use the same count as the previous scan, if known. |
| 406 | if (preview_count < 0) |
| 407 | { |
| 408 | preview_count = title->preview_count; |
| 409 | } |
| 410 | if (preview_count == title->preview_count) |
| 411 | { |
| 412 | // Title has already been scanned. |
| 413 | hb_lock( h->state_lock ); |
| 414 | h->state.state = HB_STATE_SCANDONE; |
| 415 | hb_unlock( h->state_lock ); |
| 416 | return; |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | if (preview_count < 0) |
| 422 | { |
| 423 | preview_count = 10; |
| 424 | } |
| 425 | |
| 426 | h->scan_die = 0; |
| 427 | |
| 428 | /* Clean up from previous scan */ |
| 429 | hb_remove_previews( h ); |
| 430 | while( ( title = hb_list_item( h->title_set.list_title, 0 ) ) ) |
| 431 | { |
| 432 | hb_list_rem( h->title_set.list_title, title ); |
| 433 | hb_title_close( &title ); |