summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/callbacks.c16
-rw-r--r--gtk/src/hb-backend.c2
-rw-r--r--libhb/common.h1
-rw-r--r--libhb/hb.c25
-rw-r--r--libhb/hb_json.c2
-rw-r--r--libhb/scan.c1
6 files changed, 34 insertions, 13 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index b43f85ff5..390abc36e 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2005,6 +2005,15 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
if (title != NULL)
{
+ gint preview_count;
+ preview_count = title->preview_count;
+ if (preview_count < 1)
+ {
+ preview_count = 1;
+ }
+ widget = GHB_WIDGET(ud->builder, "preview_frame");
+ gtk_range_set_range(GTK_RANGE(widget), 1, preview_count);
+
ghb_set_preview_image(ud);
ghb_preview_set_visible(ud);
}
@@ -4096,15 +4105,10 @@ G_MODULE_EXPORT void
pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
ghb_widget_to_setting (ud->prefs, widget);
-// FIXME?
+
ghb_check_dependency(ud, widget, NULL);
const gchar *name = ghb_get_setting_key(widget);
ghb_pref_set(ud->prefs, name);
-
- gint preview_count;
- preview_count = ghb_dict_get_int(ud->prefs, "preview_count");
- widget = GHB_WIDGET(ud->builder, "preview_frame");
- gtk_range_set_range(GTK_RANGE(widget), 1, preview_count);
}
G_MODULE_EXPORT void
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 839b4e052..fb0cc1e96 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2906,7 +2906,7 @@ void
ghb_backend_queue_scan(const gchar *path, gint titlenum)
{
g_debug("ghb_backend_queue_scan()");
- hb_scan( h_queue, path, titlenum, 10, 0, 0 );
+ hb_scan( h_queue, path, titlenum, -1, 0, 0 );
hb_status.queue.state |= GHB_STATE_SCANNING;
}
diff --git a/libhb/common.h b/libhb/common.h
index b540de9de..4f39c8944 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -962,6 +962,7 @@ struct hb_title_s
/* Exact duration (in 1/90000s) */
uint64_t duration;
+ int preview_count;
int has_resolution_change;
hb_geometry_t geometry;
hb_rational_t dar; // aspect ratio for the title's video
diff --git a/libhb/hb.c b/libhb/hb.c
index 2f4a71720..55800c832 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -610,14 +610,29 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
title = hb_list_item(h->title_set.list_title, ii);
if (title->index == title_index)
{
- // Title has already been scanned.
- hb_lock( h->state_lock );
- h->state.state = HB_STATE_SCANDONE;
- hb_unlock( h->state_lock );
- return;
+ // In some cases, we don't care what the preview count is.
+ // E.g. when rescanning at the start of a job. In these
+ // cases, the caller can set preview_count to -1 to tell
+ // us to use the same count as the previous scan, if known.
+ if (preview_count < 0)
+ {
+ preview_count = title->preview_count;
+ }
+ if (preview_count == title->preview_count)
+ {
+ // Title has already been scanned.
+ hb_lock( h->state_lock );
+ h->state.state = HB_STATE_SCANDONE;
+ hb_unlock( h->state_lock );
+ return;
+ }
}
}
}
+ if (preview_count < 0)
+ {
+ preview_count = 10;
+ }
h->scan_die = 0;
diff --git a/libhb/hb_json.c b/libhb/hb_json.c
index a9d104b90..e5c64bb9f 100644
--- a/libhb/hb_json.c
+++ b/libhb/hb_json.c
@@ -751,7 +751,7 @@ void hb_json_job_scan( hb_handle_t * h, const char * json_job )
// If the job wants to use Hardware decode, it must also be
// enabled during scan. So enable it here.
hb_hwd_set_enable(h, use_hwd);
- hb_scan(h, path, title_index, 10, 0, 0);
+ hb_scan(h, path, title_index, -1, 0, 0);
// Wait for scan to complete
hb_state_t state;
diff --git a/libhb/scan.c b/libhb/scan.c
index 2280644ba..8626ccca8 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -240,6 +240,7 @@ static void ScanFunc( void * _data )
hb_title_close( &title );
continue;
}
+ title->preview_count = npreviews;
/* Make sure we found audio rates and bitrates */
for( j = 0; j < hb_list_count( title->list_audio ); )