📄 video_dialog.cpp
字号:
gtk_widget_show (image20); gtk_box_pack_start (GTK_BOX (hbox76), image20, FALSE, FALSE, 0); label156 = gtk_label_new_with_mnemonic (_("Browse")); gtk_widget_show (label156); gtk_box_pack_start (GTK_BOX (hbox76), label156, FALSE, FALSE, 0); VideoSourcePort = gtk_option_menu_new (); gtk_widget_show (VideoSourcePort); gtk_table_attach (GTK_TABLE (VideoSourceTable), VideoSourcePort, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, VideoSourcePort, _("Video Input to use"), NULL); VideoSourceSignal = gtk_option_menu_new (); gtk_widget_show (VideoSourceSignal); gtk_table_attach (GTK_TABLE (VideoSourceTable), VideoSourceSignal, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, VideoSourceSignal, _("Signal Type"), NULL); menu15 = gtk_menu_new (); signalpal = gtk_menu_item_new_with_mnemonic (_("PAL")); gtk_widget_show (signalpal); gtk_container_add (GTK_CONTAINER (menu15), signalpal); signalntsc = gtk_menu_item_new_with_mnemonic (_("NTSC")); gtk_widget_show (signalntsc); gtk_container_add (GTK_CONTAINER (menu15), signalntsc); signalsecam = gtk_menu_item_new_with_mnemonic (_("SECAM")); gtk_widget_show (signalsecam); gtk_container_add (GTK_CONTAINER (menu15), signalsecam); gtk_option_menu_set_menu (GTK_OPTION_MENU (VideoSourceSignal), menu15); VideoSourceChannelType = gtk_option_menu_new (); gtk_widget_show (VideoSourceChannelType); gtk_table_attach (GTK_TABLE (VideoSourceTable), VideoSourceChannelType, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (VideoSourceChannelType, FALSE); gtk_tooltips_set_tip (tooltips, VideoSourceChannelType, _("Channel Type for TV input"), NULL); VideoSourceChannel = gtk_combo_new(); gtk_combo_set_value_in_list(GTK_COMBO(VideoSourceChannel), true, false); gtk_widget_show (VideoSourceChannel); gtk_table_attach (GTK_TABLE (VideoSourceTable), VideoSourceChannel, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_widget_set_sensitive (VideoSourceChannel, FALSE); gtk_tooltips_set_tip (tooltips, VideoSourceChannel, _("Channel number to tune"), NULL); VideoSourceFilter = gtk_option_menu_new (); gtk_widget_show (VideoSourceFilter); gtk_table_attach (GTK_TABLE (VideoSourceTable), VideoSourceFilter, 1, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, VideoSourceFilter, _("Video Input Filter"), NULL); menu11 = gtk_menu_new (); none1 = gtk_menu_item_new_with_mnemonic (_("None")); gtk_widget_show (none1); gtk_container_add (GTK_CONTAINER (menu11), none1); decimate1 = gtk_menu_item_new_with_mnemonic (_("Decimate")); gtk_widget_show (decimate1); gtk_container_add (GTK_CONTAINER (menu11), decimate1); gtk_option_menu_set_menu (GTK_OPTION_MENU (VideoSourceFilter), menu11); dialog_action_area6 = GTK_DIALOG (VideoSourceDialog)->action_area; gtk_widget_show (dialog_action_area6); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_END); VideoSourceCancel = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (VideoSourceCancel); gtk_dialog_add_action_widget (GTK_DIALOG (VideoSourceDialog), VideoSourceCancel, GTK_RESPONSE_CANCEL); GTK_WIDGET_SET_FLAGS (VideoSourceCancel, GTK_CAN_DEFAULT); VideoSourceOkButton = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (VideoSourceOkButton); gtk_dialog_add_action_widget (GTK_DIALOG (VideoSourceDialog), VideoSourceOkButton, GTK_RESPONSE_OK); GTK_WIDGET_SET_FLAGS (VideoSourceOkButton, GTK_CAN_DEFAULT); g_signal_connect ((gpointer) VideoSourceDialog, "response", G_CALLBACK (on_VideoSourceDialog_response), NULL); g_signal_connect((gpointer)VideoSourcePort, "changed", G_CALLBACK(on_input_menu_activate), NULL); SetEntryValidator(GTK_OBJECT(VideoSourceFile), GTK_SIGNAL_FUNC(on_source_entry_changed), GTK_SIGNAL_FUNC(on_source_leave)); g_signal_connect((gpointer)VideoSourceBrowse, "clicked", G_CALLBACK(on_source_browse_button), NULL); g_signal_connect((gpointer) VideoSourceChannelType, "changed", G_CALLBACK(on_channel_list_menu_activate), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (VideoSourceDialog, VideoSourceDialog, "VideoSourceDialog"); GLADE_HOOKUP_OBJECT_NO_REF (VideoSourceDialog, dialog_vbox7, "dialog_vbox7"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceTable, "VideoSourceTable"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label150, "label150"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label151, "label151"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label152, "label152"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label153, "label153"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label154, "label154"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label155, "label155"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, hbox75, "hbox75"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceFile, "VideoSourceFile"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceBrowse, "VideoSourceBrowse"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, alignment20, "alignment20"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, hbox76, "hbox76"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, image20, "image20"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, label156, "label156"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourcePort, "VideoSourcePort"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceSignal, "VideoSourceSignal"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, menu15, "menu15"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, signalpal, "signalpal"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, signalntsc, "signalntsc"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, signalsecam, "signalsecam"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceChannelType, "VideoSourceChannelType"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceChannel, "VideoSourceChannel"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceFilter, "VideoSourceFilter"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, menu11, "menu11"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, none1, "none1"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, decimate1, "decimate1"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceChannel, "VideoSourceChannel"); GLADE_HOOKUP_OBJECT_NO_REF (VideoSourceDialog, dialog_action_area6, "dialog_action_area6"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceCancel, "VideoSourceCancel"); GLADE_HOOKUP_OBJECT (VideoSourceDialog, VideoSourceOkButton, "VideoSourceOkButton"); GLADE_HOOKUP_OBJECT_NO_REF (VideoSourceDialog, tooltips, "tooltips"); //asdf source_modified = false; gtk_entry_set_text(GTK_ENTRY(VideoSourceFile), MyConfig->GetStringValue(CONFIG_VIDEO_SOURCE_NAME)); gtk_option_menu_set_history(GTK_OPTION_MENU(VideoSourceSignal), MyConfig->GetIntegerValue(CONFIG_VIDEO_SIGNAL)); pVideoCaps = (CVideoCapabilities *)MyConfig->m_videoCapabilities; CreateInputMenu(pVideoCaps, MyConfig->GetIntegerValue(CONFIG_VIDEO_INPUT)); source_type = MyConfig->GetStringValue(CONFIG_VIDEO_SOURCE_TYPE); CreateChannelListMenu(); CreateChannelCombo(MyConfig->GetIntegerValue(CONFIG_VIDEO_CHANNEL_LIST_INDEX), MyConfig->GetIntegerValue(CONFIG_VIDEO_CHANNEL_INDEX)); gtk_option_menu_set_history(GTK_OPTION_MENU(VideoSourceFilter), strcmp(MyConfig->GetStringValue(CONFIG_VIDEO_FILTER), VIDEO_FILTER_NONE) == 0 ? 0 : 1); gtk_widget_show(VideoSourceDialog);}/************************************************************************** * Video Profile Dialog **************************************************************************/static void CreateSizeMenu(uint16_t width, uint16_t height){ const char **names = NULL; uint32_t encoderIndex; GtkWidget *encoderwidget = lookup_widget(VideoProfileDialog, "VideoProfileEncoder"); encoderIndex = gtk_option_menu_get_history(GTK_OPTION_MENU(encoderwidget)); uint signal = MyConfig->GetIntegerValue(CONFIG_VIDEO_SIGNAL); if (signal == VIDEO_SIGNAL_PAL) { // PAL names = video_encoder_table[encoderIndex].sizeNamesPAL; sizeWidthValues = video_encoder_table[encoderIndex].widthValuesPAL; sizeWidthValueCnt = video_encoder_table[encoderIndex].numSizesPAL; sizeHeightValues = video_encoder_table[encoderIndex].heightValuesPAL; sizeHeightValueCnt = sizeWidthValueCnt; } else if (signal == VIDEO_SIGNAL_NTSC) { // NTSC names = video_encoder_table[encoderIndex].sizeNamesNTSC; sizeWidthValues = video_encoder_table[encoderIndex].widthValuesNTSC; sizeWidthValueCnt = video_encoder_table[encoderIndex].numSizesNTSC; sizeHeightValues = video_encoder_table[encoderIndex].heightValuesNTSC; sizeHeightValueCnt = sizeWidthValueCnt; } else { // Secam names = video_encoder_table[encoderIndex].sizeNamesSecam; sizeWidthValues = video_encoder_table[encoderIndex].widthValuesSecam; sizeWidthValueCnt = video_encoder_table[encoderIndex].numSizesSecam; sizeHeightValues = video_encoder_table[encoderIndex].heightValuesSecam; sizeHeightValueCnt = sizeWidthValueCnt; } if (names == NULL) return; sizeMaxIndex = sizeHeightValueCnt; u_int8_t i; for (i = 0; i < sizeMaxIndex; i++) { if (sizeWidthValues[i] >= width && sizeHeightValues[i] >= height) { sizeIndex = i; break; } } if (i == sizeMaxIndex) { sizeIndex = sizeMaxIndex - 1; } if (sizeIndex >= sizeMaxIndex) { sizeIndex = sizeMaxIndex - 1; } GtkWidget *temp = lookup_widget(VideoProfileDialog, "VideoProfileSize"); CreateOptionMenu(temp, names, sizeMaxIndex, sizeIndex); temp = lookup_widget(VideoProfileDialog, "VideoEncoderSettingsButton"); bool enable_settings; if (video_encoder_table[encoderIndex].get_gui_options == NULL) { enable_settings = false; } else { enable_settings = (video_encoder_table[encoderIndex].get_gui_options)(NULL, NULL); } gtk_widget_set_sensitive(temp, enable_settings);}voidon_VideoEncoderSettingsButton (GtkButton *button, gpointer user_data){ CVideoProfile *profile = (CVideoProfile *)user_data; GtkWidget *temp; temp = lookup_widget(VideoProfileDialog, "VideoProfileEncoder"); encoder_gui_options_base_t **settings_array; uint settings_array_count; uint index = gtk_option_menu_get_history(GTK_OPTION_MENU(temp)); if ((video_encoder_table[index].get_gui_options)(&settings_array, &settings_array_count) == false) { return; } CreateEncoderSettingsDialog(profile, VideoProfileDialog, video_encoder_table[index].encoding_name, settings_array, settings_array_count);}static voidon_VideoProfileEncoder_changed (GtkOptionMenu *optionmenu, gpointer user_data){ GtkWidget *size = lookup_widget(VideoProfileDialog, "VideoProfileSize"); sizeIndex = gtk_option_menu_get_history(GTK_OPTION_MENU(size)); CreateSizeMenu(sizeWidthValues[sizeIndex], sizeHeightValues[sizeIndex]);}bool CreateNewProfile (GtkWidget *dialog, CVideoProfile *profile){ GtkWidget *temp; temp = lookup_widget(dialog, "VideoProfileName"); const char *name = gtk_entry_get_text(GTK_ENTRY(temp)); if (name == NULL || *name == '\0') return false; profile->SetConfigName(name); if (AVFlow->m_video_profile_list->FindProfile(name) != NULL) { return false; } AVFlow->m_video_profile_list->AddEntryToList(profile); return true;} voidon_VideoProfileDialog_response (GtkWidget *dialog, gint response_id, gpointer user_data){ CVideoProfile *profile = (CVideoProfile *)user_data; CVideoProfile *pass_profile = NULL; GtkWidget *temp; bool do_copy = true; if (response_id == GTK_RESPONSE_OK) { if (profile->GetName() == NULL) { do_copy = CreateNewProfile(dialog, profile); if (do_copy == false) { delete profile; } else { pass_profile = profile; } } else { debug_message("profile is %s", profile->GetName()); } if (do_copy) { temp = lookup_widget(dialog, "VideoProfileEncoder"); uint index = gtk_option_menu_get_history(GTK_OPTION_MENU(temp)); profile->SetStringValue(CFG_VIDEO_ENCODER, video_encoder_table[index].encoder); profile->SetStringValue(CFG_VIDEO_ENCODING, video_encoder_table[index].encoding); temp = lookup_widget(dialog, "VideoProfileSize"); index = gtk_option_menu_get_history(GTK_OPTION_MENU(temp)); profile->SetIntegerValue(CFG_VIDEO_WIDTH, sizeWidthValues[index]); profile->SetIntegerValue(CFG_VIDEO_HEIGHT, sizeHeightValues[index]); temp = lookup_widget(dialog, "VideoProfileBitRate"); profile->SetIntegerValue(CFG_VIDEO_BIT_RATE, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(temp))); temp = lookup_widget(dialog, "VideoProfileFrameRate"); profile->SetFloatValue(CFG_VIDEO_FRAME_RATE, gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON(temp))); // need to add filter and aspect ratio temp = lookup_widget(dialog, "VideoProfileAspectRatio");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -