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

📄 video_dialog.cpp

📁 完整的RTP RTSP代码库
💻 CPP
📖 第 1 页 / 共 4 页
字号:
  // probe new source device  CVideoCapabilities* pNewVideoCaps;  pNewVideoCaps = FindVideoCapabilitiesByDevice(newSourceName);  if (pNewVideoCaps == NULL) {    pNewVideoCaps = new CVideoCapabilities(newSourceName);    if (pNewVideoCaps->IsValid()) {      MyConfig->m_videoCapabilities = pNewVideoCaps;      pNewVideoCaps->SetNext(VideoCapabilities);    }  }	  // check for errors  if (!pNewVideoCaps->IsValid()) {    if (!pNewVideoCaps->m_canOpen) {      ShowMessage("Change Video Source",		  "Specified video source can't be opened, check name");    } else {      ShowMessage("Change Video Source",		  "Specified video source doesn't support capture");    }    gtk_entry_set_text(GTK_ENTRY(temp), 		       MyConfig->GetStringValue(CONFIG_VIDEO_SOURCE_NAME));    delete pNewVideoCaps;    return;  }  // change inputs menu  temp = lookup_widget(VideoSourceDialog, "VideoSourcePort");    CreateInputMenu(pNewVideoCaps, 		  gtk_option_menu_get_history(GTK_OPTION_MENU(temp)));  if (pVideoCaps != MyConfig->m_videoCapabilities) {    delete pVideoCaps;  }  pVideoCaps = pNewVideoCaps;    ChangeInput();}#if 0static void on_yes_default_file_audio_source (GtkWidget *widget, gpointer *data){	default_file_audio_source = 		FileDefaultAudio(gtk_entry_get_text(GTK_ENTRY(source_entry)));	default_file_audio_dialog = false;}static void on_no_default_file_audio_source (GtkWidget *widget, gpointer *data){	default_file_audio_dialog = false;}#endifstatic void ChangeSource(){  GtkWidget *wid = lookup_widget(VideoSourceDialog, "VideoSourceFile");  const char* new_source_name =    gtk_entry_get_text(GTK_ENTRY(wid));  if (strcmp(new_source_name, 	     MyConfig->GetStringValue(CONFIG_VIDEO_SOURCE_NAME)) == 0) {    return;  }      //	default_file_audio_source = -1;      // decide what type of source we have      if (SourceIsDevice()) {	source_type = VIDEO_SOURCE_V4L;		SourceV4LDevice();      } else {	if (pVideoCaps != MyConfig->m_videoCapabilities) {	  // don't delete these anymoredelete pVideoCaps;	}	pVideoCaps = NULL;		if (IsUrl(new_source_name)) {	  source_type = URL_SOURCE;	} else {	  if (access(new_source_name, R_OK) != 0) {	    ShowMessage("Change Video Source",			"Specified video source can't be opened, check name");	  }	  source_type = FILE_SOURCE;	}	#if 0	if (!default_file_audio_dialog	    && FileDefaultAudio(source_name) >= 0) {	  YesOrNo(		  "Change Video Source",		  "Do you want to use this for the audio source also?",		  true,		  GTK_SIGNAL_FUNC(on_yes_default_file_audio_source),		  GTK_SIGNAL_FUNC(on_no_default_file_audio_source));	}#endif      }}static void on_source_entry_changed (GtkWidget *widget, gpointer *data){  source_modified = true;}static int on_source_leave (GtkWidget *widget, gpointer *data){	if (source_modified) {		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);

⌨️ 快捷键说明

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