コード例 #1
0
static GValue*
get_selected_asettings(signal_user_data_t *ud)
{
    GtkTreeView *treeview;
    GtkTreePath *treepath;
    GtkTreeSelection *selection;
    GtkTreeModel *store;
    GtkTreeIter iter;
    gint *indices;
    gint row;
    GValue *asettings = NULL;
    const GValue *audio_list;
    
    g_debug("get_selected_asettings ()");
    treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
    selection = gtk_tree_view_get_selection (treeview);
    if (gtk_tree_selection_get_selected(selection, &store, &iter))
    {
        // Get the row number
        treepath = gtk_tree_model_get_path (store, &iter);
        indices = gtk_tree_path_get_indices (treepath);
        row = indices[0];
        gtk_tree_path_free(treepath);
        // find audio settings
        if (row < 0) return NULL;
        audio_list = ghb_settings_get_value(ud->settings, "audio_list");
        if (row >= ghb_array_len(audio_list))
            return NULL;
        asettings = ghb_array_get_nth(audio_list, row);
    }
    return asettings;
}
コード例 #2
0
ファイル: subtitlehandler.c プロジェクト: LLNet/HandBrake
static void
subtitle_refresh_list_ui_from_settings(signal_user_data_t *ud, GhbValue *settings)
{
    GhbValue *subtitle_list;
    GhbValue *subsettings;
    gint ii, count, tm_count;
    GtkTreeView  *tv;
    GtkTreeModel *tm;
    GtkTreeIter   ti;

    tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list_view"));
    tm = gtk_tree_view_get_model(tv);

    tm_count = gtk_tree_model_iter_n_children(tm, NULL);

    subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
    count = ghb_array_len(subtitle_list);
    if (count != tm_count)
    {
        ghb_clear_subtitle_list_ui(ud->builder);
        for (ii = 0; ii < count; ii++)
        {
            gtk_tree_store_append(GTK_TREE_STORE(tm), &ti, NULL);
        }
    }
    for (ii = 0; ii < count; ii++)
    {
        g_return_if_fail(tv != NULL);
        gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
        subsettings = ghb_array_get(subtitle_list, ii);
        subtitle_refresh_list_row_ui(tm, &ti, subsettings);
    }
}
コード例 #3
0
ファイル: subtitlehandler.c プロジェクト: LLNet/HandBrake
void
ghb_reset_subtitles(signal_user_data_t *ud, GhbValue *settings)
{
    GhbValue *slist;
    GhbValue *subtitle;
    gint count, ii;
    gint title_id, titleindex;
    const hb_title_t *title;

    g_debug("ghb_reset_subtitles");
    ghb_clear_subtitle_list_settings(ud->settings);
    ghb_clear_subtitle_list_ui(ud->builder);
    title_id = ghb_dict_get_int(ud->settings, "title");
    title = ghb_lookup_title(title_id, &titleindex);
    if (title == NULL)
        return;

    slist = ghb_dict_get_value(settings, "subtitle_list");
    count = ghb_array_len(slist);
    for (ii = 0; ii < count; ii++)
    {
        subtitle = ghb_value_dup(ghb_array_get(slist, ii));
        subtitle_add_to_settings(ud->settings, subtitle);
    }
    subtitle_refresh_list_ui(ud);
}
コード例 #4
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
G_MODULE_EXPORT void
subtitle_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
{
    GtkTreeView *tv;
    GtkTreePath *tp;
    GtkTreeModel *tm;
    GtkTreeSelection *ts;
    GtkTreeIter ti, nextIter;
    gint row;
    gint *indices;
    GValue *subtitle_list;

    tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
    ts = gtk_tree_view_get_selection(tv);
    tm = gtk_tree_view_get_model(tv);
    tp = gtk_tree_path_new_from_string (path);
    if (gtk_tree_path_get_depth(tp) > 1) return;
    if (gtk_tree_model_get_iter(tm, &ti, tp))
    {
        nextIter = ti;
        if (!gtk_tree_model_iter_next(tm, &nextIter))
        {
            nextIter = ti;
            if (gtk_tree_model_get_iter_first(tm, &nextIter))
            {
                gtk_tree_selection_select_iter(ts, &nextIter);
            }
        }
        else
        {
            gtk_tree_selection_select_iter(ts, &nextIter);
        }

        subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");

        // Get the row number
        indices = gtk_tree_path_get_indices (tp);
        row = indices[0];
        if (row < 0 || row >= ghb_array_len(subtitle_list))
        {
            gtk_tree_path_free(tp);
            return;
        }

        // Update our settings list before removing the row from the
        // treeview.  Removing from the treeview sometimes provokes an
        // immediate selection change, so the list needs to be up to date
        // when this happens.
        GValue *old = ghb_array_get_nth(subtitle_list, row);
        ghb_array_remove(subtitle_list, row);
        ghb_value_free(old);

        // Remove the selected item
        gtk_tree_store_remove(GTK_TREE_STORE(tm), &ti);

        ghb_live_reset(ud);
    }
    gtk_tree_path_free(tp);
}
コード例 #5
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
static void subtitle_def_lang_list_init(signal_user_data_t *ud)
{
    GValue *lang_list;

    // Clear selected languages.
    subtitle_def_selected_lang_list_clear(ud);

    lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
    if (lang_list == NULL)
    {
        lang_list = ghb_array_value_new(8);
        ghb_settings_set_value(ud->settings, "SubtitleLanguageList", lang_list);
    }

    int ii, count;
    count = ghb_array_len(lang_list);
    for (ii = 0; ii < count; )
    {
        GValue *lang_val = ghb_array_get_nth(lang_list, ii);
        int idx = ghb_lookup_audio_lang(lang_val);
        if (ii == 0)
        {
            const iso639_lang_t *lang;
            lang = ghb_iso639_lookup_by_int(idx);
            subtitle_update_pref_lang(ud, lang);
        }

        GtkListBox *avail, *selected;
        GtkListBoxRow *row;
        avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_avail_lang"));
        selected = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_selected_lang"));
        row = ghb_find_lang_row(avail, idx);
        if (row)
        {
            GtkWidget *label = gtk_bin_get_child(GTK_BIN(row));
            g_object_ref(G_OBJECT(label));
            gtk_widget_destroy(GTK_WIDGET(row));
            gtk_widget_show(label);
            gtk_list_box_insert(selected, label, -1);
            ii++;
        }
        else
        {
            // Error in list.  Probably duplicate languages.  Remove
            // this item from the list.
            GValue *glang = ghb_array_get_nth(lang_list, ii);
            ghb_array_remove(lang_list, ii);
            ghb_value_free(glang);
            count--;
        }
    }
    if (count == 0)
    {
        subtitle_update_pref_lang(ud, NULL);
    }
}
コード例 #6
0
void
ghb_set_audio(signal_user_data_t *ud, GValue *settings)
{
    gint acodec_code;

    GValue *alist;
    GValue *track, *audio, *acodec, *acodec_actual, *bitrate, *rate, 
            *mix, *drc, *gain, *quality, *enable_quality;
    gint count, ii;
    
    g_debug("set_audio");
    // Clear the audio list
    ghb_clear_audio_list_settings(ud->settings);
    ghb_clear_audio_list_ui(ud->builder);
    alist = ghb_settings_get_value(settings, "audio_list");

    count = ghb_array_len(alist);
    for (ii = 0; ii < count; ii++)
    {
        audio = ghb_array_get_nth(alist, ii);
        track = ghb_settings_get_value(audio, "AudioTrack");
        acodec = ghb_settings_get_value(audio, "AudioEncoder");
        acodec_actual = ghb_settings_get_value(audio, "AudioEncoderActual");
        enable_quality = ghb_settings_get_value(audio, "AudioTrackQualityEnable");
        quality = ghb_settings_get_value(audio, "AudioTrackQuality");
        bitrate = ghb_settings_get_value(audio, "AudioBitrate");
        rate = ghb_settings_get_value(audio, "AudioSamplerate");
        mix = ghb_settings_get_value(audio, "AudioMixdown");
        gain = ghb_settings_get_value(audio, "AudioTrackGain");
        drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
        acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);

        if (acodec_code != 0)
        {
            GValue *asettings = ghb_dict_value_new();
            ghb_settings_set_value(asettings, "AudioTrack", track);
            ghb_settings_set_value(asettings, "AudioEncoder", acodec);
            ghb_settings_set_value(asettings, "AudioEncoderActual", acodec_actual);
            ghb_settings_set_value(asettings, "AudioTrackQualityEnable", enable_quality);
            ghb_settings_set_value(asettings, "AudioTrackQuality", quality);

            // This gets set autimatically if the codec is passthru
            ghb_settings_set_value(asettings, "AudioBitrate", bitrate);
            ghb_settings_set_value(asettings, "AudioSamplerate", rate);
            ghb_settings_set_value(asettings, "AudioMixdown", mix);
            ghb_settings_set_value(asettings, "AudioTrackGain", gain);
            ghb_settings_set_value(asettings, "AudioTrackDRCSlider", drc);

            ghb_add_audio_to_settings(ud->settings, asettings);

            ghb_add_audio_to_ui(ud->builder, asettings);
            ghb_adjust_audio_rate_combos(ud);
        }
    }
    check_list_full(ud);
}
コード例 #7
0
G_MODULE_EXPORT void
audio_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
    GtkTreeView *treeview;
    GtkTreePath *treepath;
    GtkTreeSelection *selection;
    GtkTreeModel *store;
    GtkTreeIter iter, nextIter;
    gint *indices;
    gint row;
    GValue *audio_list;

    g_debug("audio_remove_clicked_cb ()");
    treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
    selection = gtk_tree_view_get_selection (treeview);
    if (gtk_tree_selection_get_selected(selection, &store, &iter))
    {
        nextIter = iter;
        if (!gtk_tree_model_iter_next(store, &nextIter))
        {
            nextIter = iter;
            if (gtk_tree_model_get_iter_first(store, &nextIter))
            {
                gtk_tree_selection_select_iter (selection, &nextIter);
            }
        }
        else
        {
            gtk_tree_selection_select_iter (selection, &nextIter);
        }
        // Get the row number
        treepath = gtk_tree_model_get_path (store, &iter);
        indices = gtk_tree_path_get_indices (treepath);
        row = indices[0];
        gtk_tree_path_free(treepath);
        if (row < 0) return;

        audio_list = ghb_settings_get_value(ud->settings, "audio_list");
        if (row >= ghb_array_len(audio_list))
            return;

        // Update our settings list before removing the row from the
        // treeview.  Removing from the treeview sometimes provokes an
        // immediate selection change, so the list needs to be up to date
        // when this happens.
        GValue *old = ghb_array_get_nth(audio_list, row);
        ghb_value_free(old);
        ghb_array_remove(audio_list, row);

        // Remove the selected item
        gtk_list_store_remove (GTK_LIST_STORE(store), &iter);
        // remove from audio settings list
        widget = GHB_WIDGET (ud->builder, "audio_add");
        gtk_widget_set_sensitive(widget, TRUE);
    }
}
コード例 #8
0
G_MODULE_EXPORT void
audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud)
{
    GtkTreeModel *store;
    GtkTreeIter iter;
    GtkWidget *widget;
    
    GtkTreePath *treepath;
    gint *indices;
    gint row;
    GValue *asettings = NULL;

    const GValue *audio_list;
    g_debug("audio_list_selection_changed_cb ()");
    if (gtk_tree_selection_get_selected(selection, &store, &iter))
    {
        //const gchar *actual_codec, *track, *codec, *bitrate, *sample_rate, *mix;
        //gdouble drc;

        // Get the row number
        treepath = gtk_tree_model_get_path (store, &iter);
        indices = gtk_tree_path_get_indices (treepath);
        row = indices[0];
        gtk_tree_path_free(treepath);
        // find audio settings
        if (row < 0) return;
        audio_list = ghb_settings_get_value(ud->settings, "audio_list");
        if (row >= ghb_array_len(audio_list))
            return;
        asettings = ghb_array_get_nth(audio_list, row);

        block_updates = TRUE;
        ghb_ui_update(ud, "AudioTrack", ghb_settings_get_value(asettings, "AudioTrack"));
        ghb_ui_update(ud, "AudioEncoder", ghb_settings_get_value(asettings, "AudioEncoder"));
        ghb_settings_set_value(ud->settings, "AudioEncoderActual", ghb_settings_get_value(asettings, "AudioEncoderActual"));
        ghb_check_dependency(ud, NULL, "AudioEncoderActual");
        ghb_ui_update(ud, "AudioBitrate", ghb_settings_get_value(asettings, "AudioBitrate"));
        ghb_ui_update(ud, "AudioTrackName", ghb_settings_get_value(asettings, "AudioTrackName"));
        ghb_ui_update(ud, "AudioSamplerate", ghb_settings_get_value(asettings, "AudioSamplerate"));
        ghb_ui_update(ud, "AudioMixdown", ghb_settings_get_value(asettings, "AudioMixdown"));
        ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
        ghb_ui_update(ud, "AudioTrackGain", ghb_settings_get_value(asettings, "AudioTrackGain"));
        ghb_ui_update(ud, "AudioTrackQuality", ghb_settings_get_value(asettings, "AudioTrackQuality"));
        ghb_ui_update(ud, "AudioTrackQualityEnable", ghb_settings_get_value(asettings, "AudioTrackQualityEnable"));
        block_updates = FALSE;
        widget = GHB_WIDGET (ud->builder, "audio_remove");
        gtk_widget_set_sensitive(widget, TRUE);

        ghb_adjust_audio_rate_combos(ud);
    }
    else
    {
        widget = GHB_WIDGET (ud->builder, "audio_remove");
        gtk_widget_set_sensitive(widget, FALSE);
    }
}
コード例 #9
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
G_MODULE_EXPORT void
queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud)
{
    GtkTreeView *treeview;
    GtkTreePath *treepath;
    GtkTreeModel *store;
    GtkTreeIter iter;
    gint row;
    gint *indices;
    gint unique_id;
    GValue *settings;
    gint status;

    g_debug("queue_remove_clicked_cb ()");
    treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
    store = gtk_tree_view_get_model(treeview);
    treepath = gtk_tree_path_new_from_string (path);
    if (gtk_tree_path_get_depth(treepath) > 1) return;
    if (gtk_tree_model_get_iter(store, &iter, treepath))
    {
        // Find the entry in the queue
        indices = gtk_tree_path_get_indices (treepath);
        row = indices[0];
        // Can only free the treepath After getting what I need from
        // indices since this points into treepath somewhere.
        gtk_tree_path_free (treepath);
        if (row < 0) return;
        if (row >= ghb_array_len(ud->queue))
            return;
        settings = ghb_array_get_nth(ud->queue, row);
        status = ghb_settings_get_int(settings, "job_status");
        if (status == GHB_QUEUE_RUNNING)
        {
            // Ask if wants to stop encode.
            if (!ghb_cancel_encode2(ud, NULL))
            {
                return;
            }
            unique_id = ghb_settings_get_int(settings, "job_unique_id");
            ghb_remove_job(unique_id);
        }
        // Remove the selected item
        gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
        // Remove the corresponding item from the queue list
        GValue *old = ghb_array_get_nth(ud->queue, row);
        ghb_value_free(old);
        ghb_array_remove(ud->queue, row);
        ghb_save_queue(ud->queue);
    }
    else
    {   
        gtk_tree_path_free (treepath);
    }
    ghb_update_pending(ud);
}
コード例 #10
0
void
check_list_full(signal_user_data_t *ud)
{
    GValue *audio_list;
    gint count;

    audio_list = ghb_settings_get_value(ud->settings, "audio_list");
    count = ghb_array_len(audio_list);
    GtkWidget * widget = GHB_WIDGET(ud->builder, "audio_add");
    gtk_widget_set_sensitive(widget, count != 99);
}
コード例 #11
0
static gboolean
ghb_add_audio_to_settings(GValue *settings, GValue *asettings)
{
    GValue *audio_list;
    const gchar * track;
    int count;

    audio_list = ghb_settings_get_value(settings, "audio_list");
    if (audio_list == NULL)
    {
        audio_list = ghb_array_value_new(8);
        ghb_settings_set_value(settings, "audio_list", audio_list);
    }
    count = ghb_array_len(audio_list);
    // Don't allow more than 99
    // This is a hard limit imposed by libhb/reader.c:GetFifoForId()
    if (count >= 99)
    {
        ghb_value_free(asettings);
        return FALSE;
    }

    int title_no = ghb_settings_get_int(settings, "title_no");
    int track_no = ghb_settings_get_int(asettings, "AudioTrack");
    track = ghb_audio_track_description(track_no, title_no);
    ghb_settings_set_string(asettings, "AudioTrackDescription", track);

    GValue *aname;
    aname = ghb_dict_lookup(asettings, "AudioTrackName");
    if (aname == NULL)
    {
        ghb_settings_set_string(asettings, "AudioTrackName", "");
    }
    if (ghb_array_len(audio_list) >= 99)
    {
        ghb_value_free(asettings);
        return FALSE;
    }
    ghb_array_append(audio_list, asettings);
    return TRUE;
}
コード例 #12
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
static void
subtitle_add_to_settings(GValue *settings, GValue *subsettings)
{
    // Add the current subtitle settings to the list.
    GValue *subtitle_list;
    gint count;
    gboolean burned, forced, def;
    gint source;

    subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
    if (subtitle_list == NULL)
    {
        subtitle_list = ghb_array_value_new(8);
        ghb_settings_set_value(settings, "subtitle_list", subtitle_list);
    }

    // Validate some settings
    const char *mux_id;
    const hb_container_t *mux;

    mux_id = ghb_settings_get_const_string(settings, "FileFormat");
    mux = ghb_lookup_container_by_name(mux_id);

    source = ghb_settings_get_int(subsettings, "SubtitleSource");
    burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
    if (burned && !hb_subtitle_can_burn(source))
    {
        burned = FALSE;
        ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
    }
    if (!burned && !hb_subtitle_can_pass(source, mux->format))
    {
        burned = TRUE;
        ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
        ghb_settings_set_boolean(subsettings, "SubtitleDefaultTrack", FALSE);
    }
    def = ghb_settings_get_boolean(subsettings, "SubtitleDefaultTrack");
    forced = ghb_settings_get_boolean(subsettings, "SubtitleForced");
    if (forced && !hb_subtitle_can_force(source))
    {
        forced = FALSE;
        ghb_settings_set_boolean(subsettings, "SubtitleForced", forced);
    }

    ghb_array_append(subtitle_list, subsettings);

    // Check consistancy of exclusive flags
    count = ghb_array_len(subtitle_list);
    if (burned)
        ghb_subtitle_exclusive_burn_settings(settings, count-1);
    if (def)
        ghb_subtitle_exclusive_default_settings(settings, count-1);
}
コード例 #13
0
const gchar*
ghb_get_user_audio_lang(GValue *settings, gint titleindex, gint track)
{
    GValue *audio_list, *asettings;
    const gchar *lang;

    audio_list = ghb_settings_get_value(settings, "audio_list");
    if (ghb_array_len(audio_list) <= track)
        return "und";
    asettings = ghb_array_get_nth(audio_list, track);
    track = ghb_settings_get_int(asettings, "AudioTrack");
    lang = ghb_get_source_audio_lang(titleindex, track);
    return lang;
}
コード例 #14
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
G_MODULE_EXPORT void
queue_edit_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
    GtkTreeView *treeview;
    GtkTreeSelection *selection;
    GtkTreeModel *store;
    GtkTreeIter iter;
    gint row;
    gint *indices;
    gint status;

    g_debug("queue_key_press_cb ()");
    treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
    store = gtk_tree_view_get_model(treeview);

    selection = gtk_tree_view_get_selection (treeview);
    if (gtk_tree_selection_get_selected(selection, &store, &iter))
    {
        GtkTreePath *treepath;

        treepath = gtk_tree_model_get_path (store, &iter);
        // Find the entry in the queue
        indices = gtk_tree_path_get_indices (treepath);
        row = indices[0];
        // Can only free the treepath After getting what I need from
        // indices since this points into treepath somewhere.
        gtk_tree_path_free (treepath);
        if (row < 0) return;
        if (row >= ghb_array_len(ud->queue))
            return;
        ghb_queue_edit_settings = ghb_array_get_nth(ud->queue, row);
        status = ghb_settings_get_int(ghb_queue_edit_settings, "job_status");
        if (status == GHB_QUEUE_PENDING)
        {
            // Remove the selected item
            gtk_tree_store_remove(GTK_TREE_STORE(store), &iter);
            // Remove the corresponding item from the queue list
            ghb_array_remove(ud->queue, row);
        }
        else
        {
            ghb_queue_edit_settings = ghb_value_dup(ghb_queue_edit_settings);
        }
        gchar *source;
        source = ghb_settings_get_string(ghb_queue_edit_settings, "source");
        ghb_do_scan(ud, source, 0, FALSE);
        g_free(source);
    }
}
コード例 #15
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
G_MODULE_EXPORT void
queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
{
    GValue *js;
    gboolean running = FALSE;
    gint count, ii;
    gint status;
    gint state;

    state = ghb_get_queue_state();
    if (state & (GHB_STATE_WORKING | GHB_STATE_SEARCHING | 
                 GHB_STATE_SCANNING | GHB_STATE_MUXING))
    {
        ghb_cancel_encode(ud, "You are currently encoding.  "
                                "What would you like to do?");
        return;
    }

    count = ghb_array_len(ud->queue);
    for (ii = 0; ii < count; ii++)
    {
        js = ghb_array_get_nth(ud->queue, ii);
        status = ghb_settings_get_int(js, "job_status");
        if ((status == GHB_QUEUE_RUNNING) || 
            (status == GHB_QUEUE_PENDING))
        {
            running = TRUE;
            break;
        }
    }
    if (!running)
    {
        // The queue has no running or pending jobs.
        // Add current settings to the queue, then run.
        GValue *settings = ghb_value_dup(ud->settings);
        if (!ghb_queue_add(ud, settings, 0))
        {
            ghb_value_free(settings);
            return;
        }
        // Validation of settings may have changed audio list
        ghb_audio_list_refresh(ud);
    }
    if (state == GHB_STATE_IDLE)
    {
        // Add the first pending queue item and start
        ud->current_job = ghb_start_next_job(ud, TRUE);
    }
}
コード例 #16
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
G_MODULE_EXPORT void
subtitle_list_selection_changed_cb(GtkTreeSelection *ts, signal_user_data_t *ud)
{
    GtkTreeModel *tm;
    GtkTreeIter iter;
    GValue *subsettings = NULL;
    int row;

    g_debug("subtitle_list_selection_changed_cb()");
    if (gtk_tree_selection_get_selected(ts, &tm, &iter))
    {
        GtkTreeIter piter;

        if (gtk_tree_model_iter_parent(tm, &piter, &iter))
        {
            GtkTreePath *path;
            GtkTreeView *tv;

            gtk_tree_selection_select_iter(ts, &piter);
            path = gtk_tree_model_get_path(tm, &piter);
            tv = gtk_tree_selection_get_tree_view(ts);
            // Make the parent visible in scroll window if it is not.
            gtk_tree_view_scroll_to_cell(tv, path, NULL, FALSE, 0, 0);
            gtk_tree_path_free(path);
            return;
        }

        GtkTreePath *tp;
        gint *indices;
        GValue *subtitle_list;

        tp = gtk_tree_model_get_path(tm, &iter);
        indices = gtk_tree_path_get_indices(tp);
        row = indices[0];
        gtk_tree_path_free(tp);

        subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
        if (row >= 0 && row < ghb_array_len(subtitle_list))
            subsettings = ghb_array_get_nth(subtitle_list, row);
    }
    subtitle_update_dialog_widgets(ud, subsettings);
    if (subsettings)
    {
        if (ghb_settings_get_boolean(subsettings, "SubtitleBurned"))
        {
            ghb_subtitle_exclusive_burn(ud, row);
        }
    }
}
コード例 #17
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
G_MODULE_EXPORT void
subtitle_remove_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{

    GtkListBox *avail, *selected;
    GtkListBoxRow *row;
    GtkWidget *label;

    avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_avail_lang"));
    selected = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_selected_lang"));
    row = gtk_list_box_get_selected_row(selected);
    if (row != NULL)
    {
        gint index;
        GValue *lang_list;

        index = gtk_list_box_row_get_index(row);

        // Remove from UI selected language list box
        label = gtk_bin_get_child(GTK_BIN(row));
        g_object_ref(G_OBJECT(label));
        int idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx");
        gtk_widget_destroy(GTK_WIDGET(row));
        gtk_widget_show(label);
        // Add to UI available language list box
        gtk_list_box_insert(avail, label, idx);

        // Remove from preset language list
        lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
        GValue *glang = ghb_array_get_nth(lang_list, index);
        ghb_array_remove(lang_list, index);
        ghb_value_free(glang);

        ghb_clear_presets_selection(ud);

        if (ghb_array_len(lang_list) > 0)
        {
            const iso639_lang_t *lang;
            GValue *entry = ghb_array_get_nth(lang_list, 0);
            lang = ghb_iso639_lookup_by_int(ghb_lookup_audio_lang(entry));
            subtitle_update_pref_lang(ud, lang);
        }
        else
        {
            subtitle_update_pref_lang(ud, NULL);
        }
    }
}
コード例 #18
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
void
ghb_subtitle_exclusive_burn_settings(GValue *settings, gint index)
{
    GValue *subtitle_list;
    GValue *subsettings;
    gint ii, count;

    subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
    count = ghb_array_len(subtitle_list);
    for (ii = 0; ii < count; ii++)
    {
        if (ii != index)
        {
            subsettings = ghb_array_get_nth(subtitle_list, ii);
            ghb_settings_set_boolean(subsettings, "SubtitleBurned", FALSE);
        }
    }
}
コード例 #19
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
void
ghb_subtitle_exclusive_default_settings(GValue *settings, gint index)
{
    GValue *subtitle_list;
    GValue *subtitle;
    gint ii, count;

    subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
    count = ghb_array_len(subtitle_list);
    for (ii = 0; ii < count; ii++)
    {
        if (ii != index)
        {
            subtitle = ghb_array_get_nth(subtitle_list, ii);
            ghb_settings_set_boolean(subtitle, "SubtitleDefaultTrack", FALSE);
        }
    }
}
コード例 #20
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
void
ghb_subtitle_prune(signal_user_data_t *ud)
{
    GValue *subtitle_list;
    GValue *subsettings;
    gint ii;
    gboolean one_burned = FALSE;

    subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
    if (subtitle_list == NULL)
        return;

    const char *mux_id;
    const hb_container_t *mux;

    mux_id = ghb_settings_get_const_string(ud->settings, "FileFormat");
    mux = ghb_lookup_container_by_name(mux_id);

    for (ii = 0; ii < ghb_array_len(subtitle_list); )
    {
        gboolean burned;
        int source;

        subsettings = ghb_array_get_nth(subtitle_list, ii);
        burned = ghb_settings_get_boolean(subsettings, "SubtitleBurned");
        source = ghb_settings_get_boolean(subsettings, "SubtitleSource");
        burned = burned || !hb_subtitle_can_pass(source, mux->format);
        if (burned && one_burned)
        {
            GValue *gsub = ghb_array_get_nth(subtitle_list, ii);
            ghb_array_remove(subtitle_list, ii);
            ghb_value_free(gsub);
            continue;
        }
        one_burned = one_burned || burned;
        ghb_settings_set_boolean(subsettings, "SubtitleBurned", burned);
        ii++;
    }
    subsettings = subtitle_get_selected_settings(ud, NULL);
    if (subsettings != NULL)
    {
        subtitle_update_dialog_widgets(ud, subsettings);
    }
}
コード例 #21
0
void
ghb_set_pref_audio_from_settings(signal_user_data_t *ud, GValue *settings)
{
    const GValue *audio_list, *audio;
    gint count, ii;

    // Clear the audio list
    ghb_clear_audio_list_ui(ud->builder);

    audio_list = ghb_settings_get_value(settings, "audio_list");
    count = ghb_array_len(audio_list);
    for (ii = 0; ii < count; ii++)
    {
        audio = ghb_array_get_nth(audio_list, ii);
        ghb_add_audio_to_ui(ud->builder, audio);
        ghb_adjust_audio_rate_combos(ud);
    }
    check_list_full(ud);
}
コード例 #22
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
static gint
find_last_finished(GValue *queue)
{
    GValue *js;
    gint ii, count;
    gint status;
    
    g_debug("find_last_finished");
    count = ghb_array_len(queue);
    for (ii = 0; ii < count; ii++)
    {
        js = ghb_array_get_nth(queue, ii);
        status = ghb_settings_get_int(js, "job_status");
        if (status != GHB_QUEUE_DONE && status != GHB_QUEUE_RUNNING)
        {
            return ii-1;
        }
    }
    return -1;
}
コード例 #23
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
static gboolean subtitle_is_one_burned(GValue *settings)
{
    GValue *subtitle_list, *subsettings;
    int count, ii;

    subtitle_list = ghb_settings_get_value(settings, "subtitle_list");
    if (subtitle_list == NULL)
        return FALSE;

    count = ghb_array_len(subtitle_list);
    for (ii = 0; ii < count; ii++)
    {
        subsettings = ghb_array_get_nth(subtitle_list, ii);
        if (ghb_settings_get_boolean(subsettings, "SubtitleBurned"))
        {
            return TRUE;
        }
    }
    return FALSE;
}
コード例 #24
0
ファイル: subtitlehandler.c プロジェクト: LLNet/HandBrake
void
ghb_subtitle_set_pref_lang(GhbValue *settings)
{
    GhbValue *lang_list;
    gboolean set = FALSE;
    lang_list = ghb_dict_get_value(settings, "SubtitleLanguageList");
    if (ghb_array_len(lang_list) > 0)
    {
        GhbValue *glang = ghb_array_get(lang_list, 0);
        if (glang != NULL)
        {
            ghb_dict_set_string(settings, "PreferredLanguage",
                                    ghb_value_get_string(glang));
            set = TRUE;
        }
    }
    if (!set)
    {
        ghb_dict_set_string(settings, "PreferredLanguage", "und");
    }
}
コード例 #25
0
ファイル: subtitlehandler.c プロジェクト: LLNet/HandBrake
void
ghb_subtitle_exclusive_burn_settings(GhbValue *settings, gint index)
{
    GhbValue *subtitle_list;
    GhbValue *subsettings;
    gint ii, count;

    subtitle_list = ghb_dict_get_value(settings, "subtitle_list");
    subsettings = ghb_array_get(subtitle_list, index);
    if (subsettings != NULL)
    {
        int track = ghb_dict_get_int(subsettings, "SubtitleTrack");
        if (track == -1)
        {
            // Allow 2 tracks to be marked burned when one is
            // foreign audio search.  Extra burned track will be
            // sanitized away if foreign audio search actually finds
            // something.
            return;
        }
    }
    count = ghb_array_len(subtitle_list);
    for (ii = 0; ii < count; ii++)
    {
        if (ii != index)
        {
            subsettings = ghb_array_get(subtitle_list, ii);
            int track = ghb_dict_get_int(subsettings, "SubtitleTrack");
            if (track != -1)
            {
                // Allow 2 tracks to be marked burned when one is
                // foreign audio search.  Extra burned track will be
                // sanitized away if foreign audio search actually finds
                // something.
                ghb_dict_set_bool(subsettings, "SubtitleBurned", FALSE);
            }
        }
    }
}
コード例 #26
0
void
ghb_reset_subtitles(signal_user_data_t *ud, GValue *settings)
{
    GValue *slist;
    GValue *subtitle;
    gint count, ii;
    gint titleindex;

    g_debug("ghb_reset_subtitles");
    ghb_clear_subtitle_list_settings(ud->settings);
    ghb_clear_subtitle_list_ui(ud->builder);
    titleindex = ghb_settings_combo_int(ud->settings, "title");
    if (titleindex < 0)
        return;

    slist = ghb_settings_get_value(settings, "subtitle_list");
    count = ghb_array_len(slist);
    for (ii = 0; ii < count; ii++)
    {
        subtitle = ghb_value_dup(ghb_array_get_nth(slist, ii));
        subtitle_add_to_settings(ud->settings, subtitle);
    }
    subtitle_refresh_list_ui(ud);
}
コード例 #27
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
G_MODULE_EXPORT void
subtitle_add_lang_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
    GtkListBox *avail = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_avail_lang"));
    GtkListBox *selected = GTK_LIST_BOX(GHB_WIDGET(ud->builder, "subtitle_selected_lang"));
    GtkListBoxRow *row;
    GtkWidget *label;

    row = gtk_list_box_get_selected_row(avail);
    if (row != NULL)
    {
        int idx;
        const iso639_lang_t *lang;
        GValue *glang, *lang_list;

        // Remove from UI available language list box
        label = gtk_bin_get_child(GTK_BIN(row));
        g_object_ref(G_OBJECT(label));
        gtk_widget_destroy(GTK_WIDGET(row));
        gtk_widget_show(label);
        // Add to UI selected language list box
        gtk_list_box_insert(selected, label, -1);

        // Add to preset language list
        idx = (intptr_t)g_object_get_data(G_OBJECT(label), "lang_idx");
        lang = ghb_iso639_lookup_by_int(idx);
        glang = ghb_string_value_new(lang->iso639_2);
        lang_list = ghb_settings_get_value(ud->settings, "SubtitleLanguageList");
        if (ghb_array_len(lang_list) == 0)
        {
            subtitle_update_pref_lang(ud, lang);
        }
        ghb_array_append(lang_list, glang);
        ghb_clear_presets_selection(ud);
    }
}
コード例 #28
0
ファイル: subtitlehandler.c プロジェクト: Doluci/HandBrake
void
ghb_set_pref_subtitle_settings(signal_user_data_t *ud, const hb_title_t *title, GValue *settings)
{
    gint track;
    gboolean *used;
    const gchar *audio_lang, *pref_lang = NULL;
    gboolean foreign_audio_search, foreign_audio_subs;
    gboolean one_burned = FALSE;

    const GValue *lang_list;
    gint lang_count, sub_count, ii;
    int behavior;

    behavior = ghb_settings_combo_int(settings,
                                      "SubtitleTrackSelectionBehavior");
    // Clear the subtitle list
    ghb_clear_subtitle_list_settings(settings);

    if (title == NULL)
    {
        // no source title
        return;
    }
    sub_count = hb_list_count(title->list_subtitle);
    if (sub_count == 0)
    {
        // No source subtitles
        return;
    }

    const char *mux_id;
    const hb_container_t *mux;

    mux_id = ghb_settings_get_const_string(settings, "FileFormat");
    mux = ghb_lookup_container_by_name(mux_id);

    // Check to see if we need to add a subtitle track for foreign audio
    // language films. A subtitle track will be added if:
    //
    // The first (default) audio track language does NOT match the users
    // chosen Preferred Language AND the Preferred Language is NOT Any (und).
    //
    audio_lang = ghb_get_user_audio_lang(settings, title, 0);
    foreign_audio_search = ghb_settings_get_boolean(
                                settings, "SubtitleAddForeignAudioSearch");
    foreign_audio_subs = ghb_settings_get_boolean(
                                settings, "SubtitleAddForeignAudioSubtitle");
    lang_list = ghb_settings_get_value(settings, "SubtitleLanguageList");
    lang_count = ghb_array_len(lang_list);
    if (lang_count > 0)
    {
        GValue *glang = ghb_array_get_nth(lang_list, 0);
        pref_lang = g_value_get_string(glang);
    }

    if (pref_lang == NULL || !strncmp(pref_lang, "und", 4))
    {
        foreign_audio_search = foreign_audio_subs = FALSE;
        pref_lang = NULL;
    }

    used = g_malloc0(sub_count * sizeof(gboolean));

    if (foreign_audio_subs &&
        (audio_lang == NULL || strncmp(audio_lang, pref_lang, 4)))
    {
        // Add preferred language subtitle since first audio track
        // is foreign language.
        foreign_audio_search = FALSE;
        track = ghb_find_subtitle_track(title, pref_lang, 0);
        if (track > 0)
        {
            used[track] = TRUE;
            subtitle_add_track(ud, settings, title, track, mux->format,
                               TRUE, FALSE, &one_burned);
        }
    }

    if (foreign_audio_search &&
        (audio_lang != NULL && !strncmp(audio_lang, pref_lang, 4)))
    {
        // Add search for foreign audio segments
        subtitle_add_track(ud, settings, title, -1, mux->format,
                           TRUE, FALSE, &one_burned);
    }

    if (behavior != 0)
    {
        // Find "best" subtitle based on subtitle preferences
        for (ii = 0; ii < lang_count; ii++)
        {
            GValue *glang = ghb_array_get_nth(lang_list, ii);
            const gchar *lang = g_value_get_string(glang);

            int next_track = 0;
            track = ghb_find_subtitle_track(title, lang, next_track);
            while (track >= 0)
            {
                if (!used[track])
                {
                    used[track] = TRUE;
                    subtitle_add_track(ud, settings, title, track, mux->format,
                                       FALSE, FALSE, &one_burned);
                }
                next_track = track + 1;
                if (behavior == 2)
                {
                    track = ghb_find_subtitle_track(title, lang, next_track);
                }
                else
                {
                    break;
                }
            }
        }
    }

    if (ghb_settings_get_boolean(settings, "SubtitleAddCC"))
    {
        for (track = 0; track < sub_count; track++)
        {
            hb_subtitle_t *subtitle = hb_list_item(title->list_subtitle, track);
            if (subtitle->source == CC608SUB || subtitle->source == CC708SUB)
                break;
        }

        if (track < sub_count && !used[track])
        {
            used[track] = TRUE;
            subtitle_add_track(ud, settings, title, track, mux->format,
                               FALSE, FALSE, &one_burned);
        }
    }
    g_free(used);
}
コード例 #29
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
static void
add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
{
    GtkTreeView *treeview;
    GtkTreeIter iter;
    GtkTreeStore *store;
    gchar *info;
    gint status;
    GtkTreeIter citer;
    gchar *dest, *preset, *vol_name, *basename;
    const gchar *vcodec, *container;
    gchar *fps, *vcodec_abbr;
    gint title, start_point, end_point, width, height;
    gint source_width, source_height;
    gboolean pass2 = FALSE, keep_aspect, vqtype, turbo;
    gint pic_par;
    gchar *escape, *escape2;
    
    g_debug("update_queue_list ()");
    if (settings == NULL) return;
    treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list"));
    store = GTK_TREE_STORE(gtk_tree_view_get_model(treeview));
        
    title = ghb_settings_get_int(settings, "titlenum");
    start_point = ghb_settings_get_int(settings, "start_point");
    end_point = ghb_settings_get_int(settings, "end_point");
    vol_name = ghb_settings_get_string(settings, "volume_label");
    dest = ghb_settings_get_string(settings, "destination");
    basename = g_path_get_basename(dest);
    escape = g_markup_escape_text(basename, -1);
    escape2 = g_markup_escape_text(vol_name, -1);

    vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
    if (!vqtype)
        pass2 = ghb_settings_get_boolean(settings, "VideoTwoPass");
    const gchar *points = "Chapters";
    if (ghb_settings_combo_int(settings, "PtoPType") == 0)
        points = "Chapters";
    else if (ghb_settings_combo_int(settings, "PtoPType") == 1)
        points = "Seconds";
    else if (ghb_settings_combo_int(settings, "PtoPType") == 2)
        points = "Frames";
    info = g_strdup_printf 
    (
        "<big><b>%s</b></big> "
        "<small>(Title %d, %s %d through %d, %d Video %s)"
        " --> %s</small>",
         escape2, title, points, start_point, end_point, 
         pass2 ? 2:1, pass2 ? "Passes":"Pass", escape
    );
    g_free(basename);
    g_free(escape);
    g_free(escape2);

    if (piter)
        iter = *piter;
    else
        gtk_tree_store_append(store, &iter, NULL);

    gtk_tree_store_set(store, &iter, 1, info, 2, "hb-queue-delete", -1);
    g_free(info);
    status = ghb_settings_get_int(settings, "job_status");
    switch (status)
    {
        case GHB_QUEUE_PENDING:
            gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
            break;
        case GHB_QUEUE_CANCELED:
            gtk_tree_store_set(store, &iter, 0, "hb-canceled", -1);
            break;
        case GHB_QUEUE_RUNNING:
            gtk_tree_store_set(store, &iter, 0, "hb-working0", -1);
            break;
        case GHB_QUEUE_DONE:
            gtk_tree_store_set(store, &iter, 0, "hb-complete", -1);
            break;
        default:
            gtk_tree_store_set(store, &iter, 0, "hb-queue-job", -1);
            break;
    }

    GString *str = g_string_new("");
    gboolean markers;
    gboolean preset_modified;
    gint mux;
    const GValue *path;

    container = ghb_settings_combo_option(settings, "FileFormat");
    mux = ghb_settings_combo_int(settings, "FileFormat");
    preset_modified = ghb_settings_get_boolean(settings, "preset_modified");
    path = ghb_settings_get_value(settings, "preset");
    preset = ghb_preset_path_string(path);
    markers = ghb_settings_get_boolean(settings, "ChapterMarkers");

    if (preset_modified)
        g_string_append_printf(str, 
            "<b>Modified Preset Based On:</b> <small>%s</small>\n", 
            preset);
    else
        g_string_append_printf(str, 
            "<b>Preset:</b> <small>%s</small>\n", 
            preset);

    if (markers)
    {
        g_string_append_printf(str, 
            "<b>Format:</b> <small>%s Container, Chapter Markers</small>\n", 
            container);
    }
    else
    {
        g_string_append_printf(str, 
            "<b>Format:</b> <small>%s Container</small>\n", container);
    }
    if (mux == HB_MUX_MP4)
    {
        gboolean ipod, http, large;

        ipod = ghb_settings_get_boolean(settings, "Mp4iPodCompatible");
        http = ghb_settings_get_boolean(settings, "Mp4HttpOptimize");
        large = ghb_settings_get_boolean(settings, "Mp4LargeFile");
        if (http || ipod || large)
        {
            g_string_append_printf(str, "<b>MP4 Options:</b><small>");
            if (ipod)
                g_string_append_printf(str, " - iPod 5G Support");
            if (http)
                g_string_append_printf(str, " - Web Optimized");
            if (large)
                g_string_append_printf(str, " - Large File Size (>4GB)");
            g_string_append_printf(str, "</small>\n");
        }
    }
    escape = g_markup_escape_text(dest, -1);
    g_string_append_printf(str, 
        "<b>Destination:</b> <small>%s</small>\n", escape);

    width = ghb_settings_get_int(settings, "scale_width");
    height = ghb_settings_get_int(settings, "scale_height");
    pic_par = ghb_settings_combo_int(settings, "PicturePAR");
    keep_aspect = ghb_settings_get_boolean(settings, "PictureKeepRatio");

    gchar *aspect_desc;
    switch (pic_par)
    {
    case 0:
    {
        if (keep_aspect)
        {
            aspect_desc = "(Aspect Preserved)";
        }
        else
        {
            aspect_desc = "(Aspect Lost)";
        }
    } break;

    case 1:
    {
        aspect_desc = "(Strict Anamorphic)";
    } break;

    case 2:
    {
        aspect_desc = "(Loose Anamorphic)";
    } break;

    case 3:
    {
        aspect_desc = "(Custom Anamorphic)";
    } break;

    default:
    {
        aspect_desc = "(Unknown)";
    } break;
    }
    vqtype = ghb_settings_get_boolean(settings, "vquality_type_constant");
    vcodec = ghb_settings_combo_option(settings, "VideoEncoder");
    vcodec_abbr = ghb_settings_get_string(settings, "VideoEncoder");

    gchar *vq_desc = "Error";
    gchar *vq_units = "";
    gchar *vqstr;
    gdouble vqvalue;
    if (!vqtype)
    {
        // Has to be bitrate
        vqvalue = ghb_settings_get_int(settings, "VideoAvgBitrate");
        vq_desc = "Bitrate:";
        vq_units = "kbps";
        vqstr = g_strdup_printf("%d", (gint)vqvalue);
    }
    else
    {
        // Constant quality
        vqvalue = ghb_settings_get_double(settings, "VideoQualitySlider");
        vq_desc = "Constant Quality:";
        vqstr = g_strdup_printf("%d", (gint)vqvalue);
        if (strcmp(vcodec_abbr, "x264") == 0)
        {
            vq_units = "(RF)";
        }
        else
        {
            vq_units = "(QP)";
        }
    }
    fps = ghb_settings_get_string(settings, "VideoFramerate");
    if (strcmp("source", fps) == 0)
    {
        g_free(fps);
        if (ghb_settings_get_boolean(settings, "VideoFramerateCFR"))
            fps = g_strdup("Same As Source (constant)");
        else
            fps = g_strdup("Same As Source (variable)");
    }
    else
    {
        if (ghb_settings_get_boolean(settings, "VideoFrameratePFR"))
        {
            gchar *tmp;
            tmp = g_strdup_printf("Peak %s (may be lower)", fps);
            g_free(fps);
            fps = tmp;
        }
        else
        {
            gchar *tmp;
            tmp = g_strdup_printf("%s (constant frame rate)", fps);
            g_free(fps);
            fps = tmp;
        }
    }
    source_width = ghb_settings_get_int(settings, "source_width");
    source_height = ghb_settings_get_int(settings, "source_height");
    g_string_append_printf(str,
        "<b>Picture:</b> Source: <small>%d x %d, Output %d x %d %s</small>\n",
         source_width, source_height, width, height, aspect_desc);

    gint decomb, detel;
    gboolean decomb_deint;
    gboolean filters = FALSE;

    decomb_deint = ghb_settings_get_boolean(settings, "PictureDecombDeinterlace");
    decomb = ghb_settings_combo_int(settings, "PictureDecomb");
    g_string_append_printf(str, "<b>Filters:</b><small>");
    detel = ghb_settings_combo_int(settings, "PictureDetelecine");
    if (detel)
    {
        g_string_append_printf(str, " - Detelecine");
        if (detel == 1)
        {
            gchar *cust;
            cust = ghb_settings_get_string(settings, "PictureDetelecineCustom");
            g_string_append_printf(str, ": %s", cust);
            g_free(cust);
        }
        filters = TRUE;
    }
    if (decomb_deint && decomb)
    {
        g_string_append_printf(str, " - Decomb");
        if (decomb == 1)
        {
            gchar *cust;
            cust = ghb_settings_get_string(settings, "PictureDecombCustom");
            g_string_append_printf(str, ": %s", cust);
            g_free(cust);
        }
        filters = TRUE;
    }
    else if (!decomb_deint)
    {
        gint deint = ghb_settings_combo_int(settings, "PictureDeinterlace");
        if (deint)
        {
            if (deint == 1)
            {
                gchar *cust = ghb_settings_get_string(settings,
                                                "PictureDeinterlaceCustom");
                g_string_append_printf(str, " - Deinterlace: %s", cust);
                g_free(cust);
            }
            else
            {
                const gchar *opt = ghb_settings_combo_option(settings,
                                                    "PictureDeinterlace");
                g_string_append_printf(str, " - Deinterlace: %s", opt);
            }
            filters = TRUE;
        }
    }
    gint denoise = ghb_settings_combo_int(settings, "PictureDenoise");
    if (denoise)
    {
        if (denoise == 1)
        {
            gchar *cust = ghb_settings_get_string(settings,
                                                    "PictureDenoiseCustom");
            g_string_append_printf(str, " - Denoise: %s", cust);
            g_free(cust);
        }
        else
        {
            const gchar *opt = ghb_settings_combo_option(settings,
                                                    "PictureDenoise");
            g_string_append_printf(str, " - Denoise: %s", opt);
        }
        filters = TRUE;
    }
    gint deblock = ghb_settings_get_int(settings, "PictureDeblock");
    if (deblock >= 5)
    {
        g_string_append_printf(str, " - Deblock (%d)", deblock);
        filters = TRUE;
    }
    if (ghb_settings_get_boolean(settings, "VideoGrayScale"))
    {
        g_string_append_printf(str, " - Grayscale");
        filters = TRUE;
    }
    if (!filters)
        g_string_append_printf(str, " None");
    g_string_append_printf(str, "</small>\n");

    g_string_append_printf(str,
        "<b>Video:</b> <small>%s, Framerate: %s, %s %s%s</small>\n",
         vcodec, fps, vq_desc, vqstr, vq_units);

    turbo = ghb_settings_get_boolean(settings, "VideoTurboTwoPass");
    if (turbo)
    {
        g_string_append_printf(str, "<b>Turbo:</b> <small>On</small>\n");
    }
    if (strcmp(vcodec_abbr, "x264") == 0 ||
        strcmp(vcodec_abbr, "ffmpeg") == 0)
    {
        gchar *opts = ghb_build_advanced_opts_string(settings);
        g_string_append_printf(str, 
            "<b>Advanced Options:</b> <small>%s</small>\n", opts);
        g_free(opts);
    }
    // Add the audios
    gint count, ii;
    const GValue *audio_list;

    audio_list = ghb_settings_get_value(settings, "audio_list");
    count = ghb_array_len(audio_list);
    for (ii = 0; ii < count; ii++)
    {
        gchar *quality = NULL, *samplerate, *track;
        const gchar *acodec, *mix;
        GValue *asettings;
        gdouble sr;

        asettings = ghb_array_get_nth(audio_list, ii);

        acodec = ghb_settings_combo_option(asettings, "AudioEncoderActual");
        double q = ghb_settings_get_double(asettings, "AudioTrackQuality");
        if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
            q != HB_INVALID_AUDIO_QUALITY)
        {
            int codec = ghb_settings_combo_int(asettings, "AudioEncoderActual");
            quality = ghb_format_quality("Quality: ", codec, q);
        }
        else
        {
            const char *br;
            br = ghb_settings_get_string(asettings, "AudioBitrate");
            quality = g_strdup_printf("Bitrate: %s", br);
        }
        sr = ghb_settings_get_double(asettings, "AudioSamplerate");
        samplerate = ghb_settings_get_string(asettings, "AudioSamplerate");
        if ((int)sr == 0)
        {
            samplerate = g_strdup("Same As Source");
        }
        else
        {
            samplerate = g_strdup_printf("%.4g", sr);
        }
        track = ghb_settings_get_string(asettings, "AudioTrackDescription");
        mix = ghb_settings_combo_option(asettings, "AudioMixdown");
        if (count == 1)
            g_string_append_printf(str, "<b>Audio:</b>");
        else if (ii == 0)
            g_string_append_printf(str, "<b>Audio:</b>\n");
        if (count != 1)
            g_string_append_printf(str, "\t");

        g_string_append_printf(str,
            "<small> %s, Encoder: %s, Mixdown: %s, SampleRate: %s, %s</small>\n",
             track, acodec, mix, samplerate, quality);
        g_free(track);
        g_free(quality);
        g_free(samplerate);
    }

    // Add the audios
    const GValue *sub_list;

    sub_list = ghb_settings_get_value(settings, "subtitle_list");
    count = ghb_array_len(sub_list);
    for (ii = 0; ii < count; ii++)
    {
        GValue *settings;
        gchar *track;
        gboolean force, burn, def;
        gint source;

        settings = ghb_array_get_nth(sub_list, ii);
        track = ghb_settings_get_string(settings, "SubtitleTrackDescription");
        source = ghb_settings_get_int(settings, "SubtitleSource");
        force = ghb_settings_get_boolean(settings, "SubtitleForced");
        burn = ghb_settings_get_boolean(settings, "SubtitleBurned");
        def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
        if (count == 1)
            g_string_append_printf(str, "<b>Subtitle:</b>");
        else if (ii == 0)
            g_string_append_printf(str, "<b>Subtitles:</b>\n");
        if (count != 1)
            g_string_append_printf(str, "\t");

        if (source != SRTSUB)
        {
            g_string_append_printf(str,
                "<small> %s%s%s%s</small>",
                track, 
                force ? " (Force)":"",
                burn  ? " (Burn)":"",
                def   ? " (Default)":""
            );
        }
        else
        {
            gint offset;
            gchar *filename, *basename, *code;

            offset = ghb_settings_get_int(settings, "SrtOffset");
            filename = ghb_settings_get_string(settings, "SrtFile");
            basename = g_path_get_basename(filename);
            code = ghb_settings_get_string(settings, "SrtCodeset");
            g_string_append_printf(str,
                "<small> %s (%s), %s, Offset (ms) %d%s</small>",
                track, code, basename, offset,
                def   ? " (Default)":""
            );
            g_free(filename);
            g_free(basename);
            g_free(code);
        }
        if (ii < count-1)
            g_string_append_printf(str, "\n");
        g_free(track);
    }

    info = g_string_free(str, FALSE);
    gtk_tree_store_append(store, &citer, &iter);
    gtk_tree_store_set(store, &citer, 1, info, -1);
    g_free(info);
    g_free(fps);
    g_free(vcodec_abbr);
    g_free(vol_name);
    g_free(dest);
    g_free(preset);
}
コード例 #30
0
ファイル: queuehandler.c プロジェクト: artifexor/HandBrake
void
ghb_queue_buttons_grey(signal_user_data_t *ud)
{
    GtkWidget *widget;
    GtkAction *action;
    gint queue_count;
    gint titleindex;
    gint queue_state, scan_state;
    gboolean show_start, show_stop, paused;

    queue_count = ghb_array_len(ud->queue);
    titleindex = ghb_settings_combo_int(ud->settings, "title");

    queue_state = ghb_get_queue_state();
    scan_state = ghb_get_scan_state();

    show_stop = queue_state & 
                (GHB_STATE_WORKING | GHB_STATE_SEARCHING | 
                 GHB_STATE_SCANNING | GHB_STATE_MUXING);
    show_start = !(scan_state & GHB_STATE_SCANNING) && 
                    (titleindex >= 0 || queue_count > 0);


    paused = queue_state & GHB_STATE_PAUSED;

    widget = GHB_WIDGET(ud->builder, "queue_add");
    gtk_widget_set_sensitive(widget, show_start);
    action = GHB_ACTION(ud->builder, "queue_add_menu");
    gtk_action_set_sensitive(action, show_start);
    action = GHB_ACTION(ud->builder, "queue_add_all_menu");
    gtk_action_set_sensitive(action, show_start);

    widget = GHB_WIDGET (ud->builder, "queue_start1");
    if (show_stop)
    {
        gtk_widget_set_sensitive (widget, TRUE);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_start);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_start2");
    if (show_stop)
    {
        gtk_widget_set_sensitive (widget, TRUE);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Stop");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Stop Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_start);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Start");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Start Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_pause1");
    if (paused)
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
    }
    widget = GHB_WIDGET (ud->builder, "queue_pause2");
    if (paused)
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Resume");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Resume Encoding");
    }
    else
    {
        gtk_widget_set_sensitive (widget, show_stop);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), "Pause");
        gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), "Pause Encoding");
    }

    action = GHB_ACTION (ud->builder, "queue_start_menu");
    if (show_stop)
    {
        gtk_action_set_sensitive (action, TRUE);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-stop");
        gtk_action_set_label(action, "S_top Queue");
        gtk_action_set_tooltip(action, "Stop Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                            ghb_string_value("hb-stop"));
        g_object_set_property(G_OBJECT(action), "label",
                                            ghb_string_value("S_top Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                            ghb_string_value("Stop Encoding"));
#endif
    }
    else
    {
        gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-start");
        gtk_action_set_label(action, "_Start Queue");
        gtk_action_set_tooltip(action, "Start Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                            ghb_string_value("hb-start"));
        g_object_set_property(G_OBJECT(action), "label",
                                            ghb_string_value("_Start Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                            ghb_string_value("Start Encoding"));
#endif
    }
    action = GHB_ACTION (ud->builder, "queue_pause_menu");
    if (paused)
    {
        gtk_action_set_sensitive (action, show_start);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-start");
        gtk_action_set_label(action, "_Resume Queue");
        gtk_action_set_tooltip(action, "Resume Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                        ghb_string_value("hb-start"));
        g_object_set_property(G_OBJECT(action), "label",
                                        ghb_string_value("_Resume Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                        ghb_string_value("Resume Encoding"));
#endif
    }
    else
    {
        gtk_action_set_sensitive (action, show_stop);
#if GTK_CHECK_VERSION(2, 16, 0)
        gtk_action_set_icon_name(action, "hb-pause");
        gtk_action_set_label(action, "_Pause Queue");
        gtk_action_set_tooltip(action, "Pause Encoding");
#else
        g_object_set_property(G_OBJECT(action), "icon-name", 
                                        ghb_string_value("hb-pause"));
        g_object_set_property(G_OBJECT(action), "label",
                                        ghb_string_value("_Pause Queue"));
        g_object_set_property(G_OBJECT(action), "tooltip",
                                        ghb_string_value("Pause Encoding"));
#endif
    }
}