| 5521 | |
| 5522 | #if defined(_WIN32) |
| 5523 | static void |
| 5524 | handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud) |
| 5525 | { |
| 5526 | guint dtype; |
| 5527 | static gint ins_count = 0; |
| 5528 | static gint rem_count = 0; |
| 5529 | |
| 5530 | // The media change event in windows bounces around a bit |
| 5531 | // so I debounce it here |
| 5532 | // DVD insertion detected. Scan it. |
| 5533 | dtype = GetDriveType(device); |
| 5534 | if (dtype != DRIVE_CDROM) |
| 5535 | return; |
| 5536 | if (insert) |
| 5537 | { |
| 5538 | rem_count = 0; |
| 5539 | ins_count++; |
| 5540 | if (ins_count == 2) |
| 5541 | { |
| 5542 | g_thread_new("Cache Volume Names", |
| 5543 | (GThreadFunc)ghb_cache_volnames, ud); |
| 5544 | if (ghb_dict_get_bool(ud->prefs, "AutoScan") && |
| 5545 | ud->current_dvd_device != NULL && |
| 5546 | strcmp(device, ud->current_dvd_device) == 0) |
| 5547 | { |
| 5548 | show_scan_progress(ud); |
| 5549 | gint preview_count; |
| 5550 | preview_count = ghb_dict_get_int(ud->prefs, "preview_count"); |
| 5551 | ghb_set_scan_source(device); |
| 5552 | start_scan(ud, device, 0, preview_count); |
| 5553 | } |
| 5554 | } |
| 5555 | } |
| 5556 | else |
| 5557 | { |
| 5558 | ins_count = 0; |
| 5559 | rem_count++; |
| 5560 | if (rem_count == 2) |
| 5561 | { |
| 5562 | g_thread_new("Cache Volume Names", |
| 5563 | (GThreadFunc)ghb_cache_volnames, ud); |
| 5564 | if (ud->current_dvd_device != NULL && |
| 5565 | strcmp(device, ud->current_dvd_device) == 0) |
| 5566 | { |
| 5567 | ghb_hb_cleanup(TRUE); |
| 5568 | prune_logs(); |
| 5569 | ghb_set_scan_source("/dev/null"); |
| 5570 | start_scan(ud, "/dev/null", 0, 1); |
| 5571 | } |
| 5572 | } |
| 5573 | } |
| 5574 | } |
| 5575 | |
| 5576 | static gchar |
| 5577 | FindDriveFromMask(ULONG unitmask) |
no test coverage detected