diff options
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/callbacks.c | 11 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 23 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 1 |
3 files changed, 30 insertions, 5 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 36013fa23..ff07928dc 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -2707,6 +2707,8 @@ queue_add(signal_user_data_t *ud) { // Add settings to the queue GValue *settings; + gint titleindex; + gint titlenum; g_debug("queue_add ()"); if (!validate_settings(ud)) @@ -2719,6 +2721,9 @@ queue_add(signal_user_data_t *ud) settings = ghb_value_dup(ud->settings); ghb_settings_set_int(settings, "job_status", GHB_QUEUE_PENDING); ghb_settings_set_int(settings, "job_unique_id", 0); + titleindex = ghb_settings_get_int(settings, "title"); + titlenum = ghb_get_title_number(titleindex); + ghb_settings_set_int(settings, "titlenum", titlenum); ghb_array_append(ud->queue, settings); add_to_queue_list(ud, settings); ghb_save_queue(ud->queue); @@ -2880,11 +2885,11 @@ static void queue_scan(GValue *js) { gchar *path; - gint titleindex; + gint titlenum; path = ghb_settings_get_string( js, "source"); - titleindex = ghb_settings_get_int(js, "title"); - ghb_backend_queue_scan(path, titleindex+1); + titlenum = ghb_settings_get_int(js, "titlenum"); + ghb_backend_queue_scan(path, titlenum); g_free(path); } diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index eb60ad95a..8054320e5 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -683,6 +683,25 @@ ghb_hb_cleanup(gboolean partial) del_tree(dir, !partial); } +gint +ghb_get_title_number(gint titleindex) +{ + hb_list_t * list; + hb_title_t * title; + hb_audio_config_t *audio = NULL; + + if (h_scan == NULL) return 1; + list = hb_get_titles( h_scan ); + if( !hb_list_count( list ) ) + { + /* No valid title, stop right there */ + return NULL; + } + title = hb_list_item( list, titleindex ); + if (title == NULL) return 1; // Bad titleindex + return title->index; +} + static hb_audio_config_t* get_hb_audio(gint titleindex, gint track) { @@ -1682,10 +1701,10 @@ ghb_backend_scan(const gchar *path, gint titleindex) } void -ghb_backend_queue_scan(const gchar *path, gint titleindex) +ghb_backend_queue_scan(const gchar *path, gint titlenum) { g_debug("ghb_backend_queue_scan()"); - hb_scan( h_queue, path, titleindex ); + hb_scan( h_queue, path, titlenum ); hb_status.queue_state |= GHB_STATE_SCANNING; } diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index 19ba4205b..2d04a0090 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -120,6 +120,7 @@ GdkPixbuf* ghb_get_preview_image( gint titleindex, gint index, GValue *settings, gboolean borders); gint ghb_calculate_target_bitrate(GValue *settings, gint titleindex); gchar* ghb_dvd_volname(const gchar *device); +gint ghb_get_title_number(gint titleindex); gint ghb_guess_bitrate(GValue *settings); gboolean ghb_validate_container(signal_user_data_t *ud); |