⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video_dialog.cpp

📁 MPEG4音频视频压缩编码(含G.711/ACC/H.261等)
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		ChangeSource();	}	return FALSE;}static void on_source_browse_button (GtkWidget *widget, gpointer *data){  GtkWidget *wid = lookup_widget(VideoSourceDialog, "VideoSourceFile");  FileBrowser(wid, VideoSourceDialog, GTK_SIGNAL_FUNC(ChangeSource));}static void CreateChannelCombo(uint list_index, uint chan_index){  GList *VideoSourceChannel_items = NULL;  if (chanlists[list_index].count <= chan_index) {    chan_index = 0;  }  for (uint ix = 0; ix < chanlists[list_index].count; ix++) {    VideoSourceChannel_items =       g_list_append(VideoSourceChannel_items, 		    (gpointer)chanlists[list_index].list[ix].name);  }  debug_message("channel list has %d", chanlists[list_index].count);  GtkWidget *channel_combo = lookup_widget(VideoSourceDialog,					   "VideoSourceChannel");  gtk_combo_set_popdown_strings(GTK_COMBO(channel_combo), 				VideoSourceChannel_items);  //gtk_combo_set_use_arrows_always(GTK_COMBO(channel_combo), 1);  g_list_free(VideoSourceChannel_items);  GtkWidget *entry = GTK_COMBO(channel_combo)->entry;  gtk_entry_set_text(GTK_ENTRY(entry), 		     chanlists[list_index].list[chan_index].name);  gtk_widget_show(channel_combo);}void ChangeChannelList(u_int8_t newIndex){  //  channelListIndex = newIndex;	// recreate channel menu  CreateChannelCombo(newIndex, 		     MyConfig->GetIntegerValue(CONFIG_VIDEO_CHANNEL_INDEX));}static void on_channel_list_menu_activate(GtkWidget *widget, gpointer data){  uint channel_list_index =     gtk_option_menu_get_history(GTK_OPTION_MENU(widget));  ChangeChannelList(channel_list_index);}static const char* GetChannelListName(uint32_t index, void* pUserData){	return ((struct CHANLISTS*)pUserData)[index].name;}static void CreateChannelListMenu (void){  struct CHANLISTS* pChannelList = chanlists;  uint index, on_index = 0;  on_index = MyConfig->GetIntegerValue(CONFIG_VIDEO_CHANNEL_LIST_INDEX);    for (index = 0; chanlists[index].name != NULL; index++) {  }  GtkWidget *channel_list_menu = lookup_widget(VideoSourceDialog, 					       "VideoSourceChannelType");  CreateOptionMenu(channel_list_menu,		   GetChannelListName,		   (void*)pChannelList,		   index,		   on_index);}static voidon_VideoSourceDialog_response          (GtkDialog       *dialog,                                        gint             response_id,                                        gpointer         user_data){  if (response_id == GTK_RESPONSE_OK) {    if (ValidateAndSave() == false)       return;  }  gtk_widget_destroy(GTK_WIDGET(dialog));}void create_VideoSourceDialog (void){  GtkWidget *dialog_vbox7;  GtkWidget *VideoSourceTable;  GtkWidget *label150;  GtkWidget *label151;  GtkWidget *label152;  GtkWidget *label153;  GtkWidget *label154;  GtkWidget *label155;  GtkWidget *hbox75;  GtkWidget *VideoSourceFile;  GtkWidget *VideoSourceBrowse;  GtkWidget *alignment20;  GtkWidget *hbox76;  GtkWidget *image20;  GtkWidget *label156;  GtkWidget *VideoSourcePort;  GtkWidget *VideoSourceSignal;  GtkWidget *menu15;  GtkWidget *signalpal;  GtkWidget *signalntsc;  GtkWidget *signalsecam;  GtkWidget *VideoSourceChannelType;  GtkWidget *VideoSourceFilter;  GtkWidget *menu11;  GtkWidget *none1;  GtkWidget *decimate1;  GtkWidget *VideoSourceChannel;  GtkWidget *dialog_action_area6;  GtkWidget *VideoSourceCancel;  GtkWidget *VideoSourceOkButton;  GtkTooltips *tooltips;  tooltips = gtk_tooltips_new ();  VideoSourceDialog = gtk_dialog_new ();  gtk_window_set_title (GTK_WINDOW (VideoSourceDialog), _("Video Source"));  gtk_window_set_modal(GTK_WINDOW(VideoSourceDialog), TRUE);  gtk_window_set_transient_for(GTK_WINDOW(VideoSourceDialog), 			       GTK_WINDOW(MainWindow));  dialog_vbox7 = GTK_DIALOG (VideoSourceDialog)->vbox;  gtk_widget_show (dialog_vbox7);  VideoSourceTable = gtk_table_new (6, 2, FALSE);  gtk_widget_show (VideoSourceTable);  gtk_box_pack_start (GTK_BOX (dialog_vbox7), VideoSourceTable, TRUE, TRUE, 0);  gtk_table_set_row_spacings (GTK_TABLE (VideoSourceTable), 2);  gtk_table_set_col_spacings (GTK_TABLE (VideoSourceTable), 9);  label150 = gtk_label_new (_("Source:"));  gtk_widget_show (label150);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label150, 0, 1, 0, 1,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label150), 0, 0.5);  label151 = gtk_label_new (_("Port:"));  gtk_widget_show (label151);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label151, 0, 1, 1, 2,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label151), 0, 0.5);  label152 = gtk_label_new (_("Signal:"));  gtk_widget_show (label152);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label152, 0, 1, 2, 3,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label152), 0, 0.5);  label153 = gtk_label_new (_("Channel List:"));  gtk_widget_show (label153);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label153, 0, 1, 3, 4,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label153), 0, 0.5);  label154 = gtk_label_new (_("Channel:"));  gtk_widget_show (label154);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label154, 0, 1, 4, 5,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label154), 0, 0.5);  label155 = gtk_label_new (_("Filter:"));  gtk_widget_show (label155);  gtk_table_attach (GTK_TABLE (VideoSourceTable), label155, 0, 1, 5, 6,                    (GtkAttachOptions) (GTK_FILL),                    (GtkAttachOptions) (0), 0, 0);  gtk_misc_set_alignment (GTK_MISC (label155), 0, 0.5);  hbox75 = gtk_hbox_new (FALSE, 0);  gtk_widget_show (hbox75);  gtk_table_attach (GTK_TABLE (VideoSourceTable), hbox75, 1, 2, 0, 1,                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),                    (GtkAttachOptions) (GTK_FILL), 0, 0);  VideoSourceFile = gtk_entry_new ();  gtk_widget_show (VideoSourceFile);  gtk_box_pack_start (GTK_BOX (hbox75), VideoSourceFile, TRUE, TRUE, 0);  gtk_tooltips_set_tip (tooltips, VideoSourceFile, _("Video Device"), NULL);  VideoSourceBrowse = gtk_button_new ();  gtk_widget_show (VideoSourceBrowse);  gtk_box_pack_start (GTK_BOX (hbox75), VideoSourceBrowse, FALSE, FALSE, 0);  alignment20 = gtk_alignment_new (0.5, 0.5, 0, 0);  gtk_widget_show (alignment20);  gtk_container_add (GTK_CONTAINER (VideoSourceBrowse), alignment20);  hbox76 = gtk_hbox_new (FALSE, 2);  gtk_widget_show (hbox76);  gtk_container_add (GTK_CONTAINER (alignment20), hbox76);  image20 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);  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 &&	sizeWidthValues[i] >= height) {      sizeIndex = i;      break;    }  }  if (i == sizeMaxIndex) {    sizeIndex = sizeMaxIndex - 1;  }  if (sizeIndex >= sizeMaxIndex) {    sizeIndex = sizeMaxIndex - 1;  }  GtkWidget *temp = lookup_widget(VideoProfileDialog, "VideoProfileSize");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -