incubator-bluesky-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r885395 [19/23] - in /incubator/bluesky/trunk/RealClass/Student: ./ autom4te.cache/ src/ src/.deps/ src/pic/
Date Mon, 30 Nov 2009 12:18:38 GMT
Added: incubator/bluesky/trunk/RealClass/Student/src/callbacks.cc
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/callbacks.cc?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/callbacks.cc (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/callbacks.cc Mon Nov 30 12:18:34 2009
@@ -0,0 +1,730 @@
+/** \file callbacks.cc implementation for GUI operations
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include  <stdio.h>  
+#include  <sys/types.h>  
+#include  <sys/socket.h>  
+#include  <sys/ioctl.h>  
+
+#include  <net/if.h>  
+#include  <net/if_arp.h>  
+
+#include  <errno.h>  
+#include <iostream> 
+#include <fstream>
+
+#include <gtk/gtk.h>
+#include  <sys/types.h>
+
+#include <sys/socket.h>
+#include <stdio.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "client_communicate.h"
+#include <iostream>
+#include "ncclient.hh"
+#include "callbacks.hh"
+#include "interface.h"
+#include "support.hh"
+#include "errormessage.h"
+#include "stdafx.h"
+#include "en_de_audio.h"
+#include "en_de_video.h"
+#include "en_de_screen.h"
+
+#include <gdk/gdkx.h>
+
+#define  ETH_NAME    "eth0"
+#define ETH_NAME1   "eth1"
+int getip_tag = 0;
+using namespace std;
+extern CScreenReceiver g_teacher_screenreceiver;
+extern CVideoReceiver g_teacher_videoreceiver;
+extern CAudioReceiver g_teacher_audioreceiver;
+extern CVideoReceiver g_student_videoreceiver;
+extern CAudioReceiver g_student_audioreceiver;
+
+extern CV4LStuVideoSender g_student_videosender;
+extern CStuAudioSender g_student_audiosender;
+
+extern struct CRCLClientJoinInGroupR client_mcu_info;
+extern struct TRCClientLogin stulogin;
+extern GtkWidget *loadsys;
+extern GtkWidget *addclass;
+extern GtkWidget *loadtool;
+extern GtkWidget *clist1;
+extern GtkWidget *classdialog;
+extern GtkWidget *chatview;
+extern GtkWidget *chat_show;
+extern client_ts_communicate client_comm;
+extern DWORD TeacherMode;
+extern DWORD chatMode;
+extern DWORD Focus_student;
+extern GtkWidget *teachimage;
+extern GtkWidget *screenimage;
+extern GtkWidget *studimage;
+
+extern GtkTextBuffer *chat_buffer; //textbuf used in chatMode 
+extern GtkTextIter chat_end;
+extern GtkTextIter chat_start;
+extern GtkTextBuffer *TeachChat_buffer; //textbuf used in teachMode
+extern GtkTextIter TeachChat_end;
+extern GtkTextIter TeachChat_start;
+extern GtkAdjustment *adj1, *adj2;
+
+extern GtkWidget *localIPentry;
+extern GtkWidget *teachaudioentry;
+extern GtkWidget *centerport_entry;
+
+char showchat[1000];
+
+gfloat upper1, page_size1, step, value;
+int loadflag = 0;
+int GroupID;
+int addclassflag = 0;
+extern char CenterIP[16];
+extern char CenterPort[8];
+extern GtkWidget *chatentry;
+CRCLMSG send_mes;
+
+char IP[30];
+int error_info_no = 0; //use by ncstudent_timer_callback()
+
+void on_about1_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *about;
+	about = create_about_dialog();
+	gtk_widget_show(about);
+}
+
+void on_loadsys_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+
+	GtkWidget *loginwindow;
+	loginwindow = create_loaddialog();
+	gtk_widget_show(loginwindow);
+}
+
+void on_addclass_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	addclass_op();
+}
+
+void on_exitclass_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	exitclass_op();
+}
+
+void on_exitsys_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	exitsys_op();
+}
+
+void on_requestchange_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	exchange_op();
+}
+
+void on_cancelchange_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	cancelexchange_op();
+}
+
+void on_networkconfig_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	GtkWidget *networkwindow;
+	networkwindow = create_networkdialog();
+	gtk_widget_show(networkwindow);
+}
+
+void on_loadcancelbut_clicked(GtkObject *object, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_networkcancel_clicked(GtkObject *object, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_studimagebut_clicked(GtkButton *button, gpointer user_data)
+{
+	g_student_videosender.CloseXImage();
+	if (Focus_student == 0)
+	{
+		g_student_videosender.SetMode(CV4LStuVideoSender::ModeNone);
+		g_student_videosender.Stop();
+	}
+	else if (Focus_student == 1)
+		g_student_videosender.SetMode(CV4LStuVideoSender::ModeTransmit);
+
+	g_student_videoreceiver.Init();
+	g_student_videoreceiver.CreateXImage(GDK_WINDOW_XID(studimage->window), 2,
+			345, 320 - 93, 240 - 40);
+	g_student_videoreceiver.Start(stulogin.SeMCU_SVPort);
+}
+
+void on_myimagebut_clicked(GtkButton *button, gpointer user_data)
+{
+	if (!g_student_videosender.IsInitialized())
+		g_student_videosender.Init(5560);
+
+	if (Focus_student == 0)
+	{
+		g_student_videosender.SetMode(CV4LStuVideoSender::ModeCapture);
+		g_student_videosender.Stop();
+	}
+	else if (Focus_student == 1)
+		g_student_videosender.SetMode(CV4LStuVideoSender::ModeTransmit);
+
+	g_student_videosender.CreateXImage(GDK_WINDOW_XID(studimage->window), 2,
+			345, 320 - 93, 240 - 40);
+	g_student_videosender.Start();
+}
+
+void on_sendchatbut_clicked(GtkButton *button, gpointer user_data)
+{
+	sendmessage_op();
+}
+
+void on_loadokbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	get_loadsys();
+	printf("student login is %s\n", stulogin.ClientName);
+	if (strcmp(stulogin.ClientName, "") == 0)
+	{
+
+		Error_dia(usename_error, usename_errorms);
+		return;
+	}
+	else if (strlen(stulogin.ClientName) > 200)
+	{
+
+		Error_dia(usename_error1, usename_error1ms);
+		return;
+
+	}
+	else
+	{
+		//setup TCP connect
+		LPCTSTR ts_addr = CenterIP;
+		UINT ts_port = atol(CenterPort);
+		CRCLMSG send_mes;
+		if (client_comm.establish_connect(ts_addr, ts_port) != (-1))
+		{
+			send_mes.rclType = 5020;
+			send_mes.msglen = sizeof(stulogin);
+			memcpy(send_mes.msg, &stulogin, sizeof(stulogin));
+
+			if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+			{
+				printf("\nsend failed!");
+			}
+			loadflag = 1;
+		}
+		else
+		{
+			Error_dia(load_error1, load_error1ms);
+		}
+		gtk_widget_destroy(GTK_WIDGET(user_data));
+	}
+}
+
+void on_classcancelbut_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_classokbut_clicked(GtkButton *button, gpointer user_data)
+{
+	TRCClientJionInGroup JionGroup;
+	if (loadflag == 1) //client join group , send message code 10020
+	{
+		JionGroup.ClientID = client_comm.Rec_ClientID;
+		JionGroup.GroupID = GroupID;
+		JionGroup.C_TAPort = stulogin.SeMCU_TAPort;
+		JionGroup.C_TVPort = stulogin.SeMCU_TVPort;
+		JionGroup.C_TScrPort = stulogin.SeMCU_TSPort;
+		JionGroup.C_CAPort = stulogin.SeMCU_SAPort;
+		JionGroup.C_CVPort = stulogin.SeMCU_SVPort;
+		send_mes.rclType = 10020;
+		send_mes.msglen = sizeof(JionGroup);
+		memcpy(send_mes.msg, &JionGroup, sizeof(JionGroup));
+		printf("class ok button\n");
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			printf("\nsend failed!");
+		}
+	}
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_chatentry_activate(GtkWidget *widget, GtkWidget *entry)
+{
+	sendmessage_op();
+}
+
+void select_clist_row(GtkCList *clist, gint row, gint column, GdkEvent *event,
+		gpointer user_data)
+{
+	gint now_cur = GTK_CLIST(clist)->focus_row;
+	gchar *text;
+	gtk_clist_get_text(GTK_CLIST(clist1), now_cur, 0, &text);
+	GroupID = atoi(text);
+}
+
+void on_networktool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	GtkWidget *networkwindow;
+	networkwindow = create_networkdialog();
+	gtk_widget_show(networkwindow);
+}
+
+void on_loadtool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	GtkWidget *loginwindow;
+	loginwindow = create_loaddialog();
+	gtk_widget_show(loginwindow);
+}
+
+void on_addclasstool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	addclass_op();
+}
+
+void on_exitclasstool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	exitclass_op();
+}
+
+void on_exchangetool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	exchange_op();
+}
+
+void on_cancelextool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	cancelexchange_op();
+}
+
+void on_exittool_clicked(GtkToolButton *toolbutton, gpointer user_data)
+{
+	exitsys_op();
+}
+
+void on_Topconfigbutton_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_set_sensitive(centerport_entry, TRUE);
+	gtk_widget_set_sensitive(localIPentry, TRUE);
+	gtk_widget_set_sensitive(teachaudioentry, TRUE);
+}
+
+void on_networkOk_clicked(GtkButton *button, gpointer user_data)
+{
+	get_networkconfig();
+	if (getip_tag == 1)
+	{
+		Error_dia(getIP_error, getIP_errorms);
+		getip_tag = 0;
+		return;
+	}
+	if (!(stulogin.SeMCU_TAPort % 2 == 0))
+	{
+		Error_dia(config_error1, config_error1ms);
+		return;
+	}
+	if (stulogin.SeMCU_TAPort < 1024)
+	{
+		Error_dia(port_error, port_errorms);
+		return;
+	}
+	else
+	{
+		gtk_widget_set_sensitive(loadsys, TRUE);
+		gtk_widget_set_sensitive(loadtool, TRUE);
+		gtk_widget_destroy( GTK_WIDGET(GTK_WIDGET( user_data)));
+	}
+}
+
+void addclass_op()
+{
+	TRCClientGetGroupInfo GetGroupInfo;
+	GtkWidget *classwindow;
+	classwindow = create_classdialog();
+	gtk_widget_show(classwindow);
+	if (loadflag == 1) //join successfully
+	{
+		GetGroupInfo.ClientID = client_comm.Rec_ClientID;
+		send_mes.rclType = 10050;
+		send_mes.msglen = sizeof(TRCClientGetGroupInfo);
+		memcpy(send_mes.msg, &GetGroupInfo, sizeof(TRCClientGetGroupInfo));
+
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+			perror("send failed!");
+	}
+}
+
+void exitclass_op()
+{
+	GtkWidget* dialog1;
+	dialog1 = create_exit_class_dialog();
+	gtk_widget_show(dialog1);
+}
+
+void exitsys_op() //exit system
+{
+	GtkWidget* dialog2;
+	dialog2 = create_exit_system_dialog();
+	gtk_widget_show(dialog2);
+
+}
+
+void exchange_op()
+{
+	TCRCLClientApplyFocus ApplyFocus;
+	ApplyFocus.ClientID = client_comm.Rec_ClientID;
+	ApplyFocus.GroupID = GroupID;
+	send_mes.rclType = 1010;
+	send_mes.msglen = sizeof(ApplyFocus);
+	memcpy(send_mes.msg, &ApplyFocus, sizeof(ApplyFocus));
+
+	if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+	{
+		printf("\nsend failed!");
+	}
+}
+
+void cancelexchange_op()
+{
+	TCRCLClientDestroyFocus DestroyFocus;
+	DestroyFocus.ClientID = client_comm.Rec_ClientID;
+	DestroyFocus.GroupID = GroupID;
+	send_mes.rclType = 1020;
+	send_mes.msglen = sizeof(DestroyFocus);
+	memcpy(send_mes.msg, &DestroyFocus, sizeof(DestroyFocus));
+
+	if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+	{
+		printf("\nsend failed!");
+	}
+}
+
+void sendmessage_op()
+{
+	TCRCLClientTextBroadcast TextBroadcast;
+	const char*Text = gtk_entry_get_text(GTK_ENTRY(chatentry));
+	if ((addclassflag == 1) && (strcmp(Text, "") != 0) && (chatMode == 1))
+	{
+		TextBroadcast.ClientID = client_comm.Rec_ClientID;
+		TextBroadcast.GroupID = GroupID;
+
+		memset(TextBroadcast.Info, 0, 1024);
+		TextBroadcast.InfoLength = strlen(Text) >= 1000 ? 1000 : strlen(Text);
+
+		if (strlen(Text) >= 1000)
+		{
+
+			memcpy(TextBroadcast.Info, Text, 1000);
+
+		}
+		else
+			strcpy(TextBroadcast.Info, Text);
+
+		send_mes.rclType = 1030;
+		send_mes.msglen = sizeof(TextBroadcast);
+		memcpy(send_mes.msg, &TextBroadcast, sizeof(TextBroadcast));
+
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+
+		}
+		strcpy(showchat, stulogin.ClientName);
+		strcat(showchat, ":");
+		strcat(showchat, TextBroadcast.Info);
+		strcat(showchat, "\n");
+		client_comm.get_text_from_msg(showchat);
+		if (TeacherMode == 1)
+		{
+			upper1 = GTK_ADJUSTMENT(adj1)->upper;
+			page_size1 = GTK_ADJUSTMENT(adj1)->page_size;
+			step = GTK_ADJUSTMENT(adj1)->step_increment;
+			value = upper1 - page_size1 + step;
+			gtk_adjustment_set_value(GTK_ADJUSTMENT(adj1), value);
+		}
+
+		else if (TeacherMode == 0)
+		{
+			upper1 = GTK_ADJUSTMENT(adj2)->upper;
+			page_size1 = GTK_ADJUSTMENT(adj2)->page_size;
+			step = GTK_ADJUSTMENT(adj2)->step_increment;
+			value = upper1 - page_size1 + step;
+			gtk_adjustment_set_value(GTK_ADJUSTMENT(adj2), value);
+		}
+
+	}
+
+	gtk_entry_set_text(GTK_ENTRY(chatentry), "");
+}
+
+void on_stulist_cancelbut_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_stulist_okbut_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_about_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_error_calbut_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void on_error_okbut_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+
+void get_stulist()
+{
+	if (addclassflag == 1)
+	{
+		CRCLClientGetClientInfo GetClientInfo;
+		send_mes.rclType = 1040;
+		GetClientInfo.ClientID = client_comm.Rec_ClientID;
+		GetClientInfo.GroupID = GroupID;
+		send_mes.msglen = sizeof(GetClientInfo);
+		memcpy(send_mes.msg, &GetClientInfo, sizeof(GetClientInfo));
+
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			perror("send failed!");
+		}
+	}
+}
+
+int getip()
+{
+	int sock;
+	struct sockaddr_in sin;
+	struct ifreq ifr;
+	sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+	if (sock == -1)
+	{
+		perror("socket");
+		return -1;
+	}
+	strncpy(ifr.ifr_name, ETH_NAME, IFNAMSIZ);
+	ifr.ifr_name[IFNAMSIZ - 1] = 0;
+
+	if (ioctl(sock, SIOCGIFADDR, &ifr) < 0)
+	{
+		perror("ioctl");
+		strncpy(ifr.ifr_name, ETH_NAME1, IFNAMSIZ);
+		ifr.ifr_name[IFNAMSIZ - 1] = 0;
+		if (ioctl(sock, SIOCGIFADDR, &ifr) < 0)
+		{
+			getip_tag = 1;
+			return -1;
+		}
+	}
+	memcpy(&sin, &ifr.ifr_addr, sizeof(sin));
+	strcpy(IP, inet_ntoa(sin.sin_addr));
+	printf("get IP  %s\n", inet_ntoa(sin.sin_addr));
+	close(sock);
+	return 0;
+}
+
+gboolean timer_callback(void *para) //timer refresh to answer clientcommunicate.cc error message
+{
+	switch (error_info_no)
+	{
+	case 0:
+		return true;
+	case 1:
+		Error_dia(load_error2, load_error2ms);
+		error_info_no = 0;
+		break;
+
+	case 2:
+		Error_dia(load_error3, load_error3ms);
+		error_info_no = 0;
+		break;
+
+	case 3:
+		Error_dia(load_error4, load_error4ms);
+		error_info_no = 0;
+		break;
+
+	case 4:
+		Error_dia(getclasslist_error, getclasslist_errorms);
+		error_info_no = 0;
+		break;
+
+	case 5:
+		Error_dia(addclass_error, addclass_errorms);
+		error_info_no = 0;
+		break;
+
+	case 6:
+		Error_dia(addclass_error1, addclass_error1ms);
+		error_info_no = 0;
+		break;
+
+	case 7:
+		Error_dia(exitclass_error, exitclass_errorms);
+		error_info_no = 0;
+		break;
+
+	case 8:
+		Error_dia(focus_error1, focus_error1ms);
+		error_info_no = 0;
+		break;
+
+	case 9:
+		Error_dia(focus_error2, focus_error2ms);
+		error_info_no = 0;
+		break;
+
+	case 10:
+		Error_dia(killfocus_error, killfocus_errorms);
+		error_info_no = 0;
+		break;
+
+	case 11:
+		Error_dia(killfocus_error, killfocus_errorms);
+		error_info_no = 0;
+		break;
+
+	case 20:
+		upper1 = GTK_ADJUSTMENT(adj1)->upper;
+		page_size1 = GTK_ADJUSTMENT(adj1)->page_size;
+		value = upper1 - page_size1;
+		gtk_adjustment_set_value(GTK_ADJUSTMENT(adj1), value);
+		error_info_no = 0;
+		break;
+
+	case 21:
+
+		upper1 = GTK_ADJUSTMENT(adj2)->upper;
+		page_size1 = GTK_ADJUSTMENT(adj2)->page_size;
+		value = upper1 - page_size1;
+		gtk_adjustment_set_value(GTK_ADJUSTMENT(adj2), value);
+		error_info_no = 0;
+		break;
+
+	default:
+
+		break;
+	}
+}
+
+void scroll_set_value(GtkAdjustment *set)
+{
+
+	gtk_adjustment_set_value(set, 1010000);
+
+}
+
+void on_exit_class_cancel_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+
+}
+
+void on_exit_class_yes_clicked(GtkButton *button, gpointer user_data)
+{
+	TRCClientLeaveGroup LeaveGroup;
+	if (addclassflag == 1)
+	{
+		LeaveGroup.ClientID = client_comm.Rec_ClientID;
+		LeaveGroup.GroupID = GroupID;
+		send_mes.rclType = 10030;//exit message code
+		send_mes.msglen = sizeof(TRCClientLeaveGroup);
+		memcpy(send_mes.msg, &LeaveGroup, sizeof(TRCClientLeaveGroup));
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+			perror("send failed!");
+	}
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+void on_exit_system_cancel_clicked(GtkButton *button, gpointer user_data)
+{
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+}
+void on_exit_system_yes_clicked(GtkButton *button, gpointer user_data)
+{
+	TRCClientLogout logoutsys;
+	if (loadflag == 1)
+	{
+		logoutsys.ClientID = client_comm.Rec_ClientID;
+		send_mes.rclType = 5050; //send to Tserver
+		send_mes.msglen = sizeof(logoutsys);
+		memcpy(send_mes.msg, &logoutsys, sizeof(logoutsys));
+
+		if (client_comm.send_mes(send_mes, send_mes.msglen + 8) < 0)
+		{
+			printf("\nsend failed!");
+		}
+	}
+	gtk_widget_destroy(GTK_WIDGET(user_data));
+	gtk_main_quit();
+}
+
+gint mainwindow_delete_event(GtkWidget *widget, GdkEvent *event,
+		gpointer user_data)
+{
+
+	GtkWidget *dialog3;
+	dialog3 = create_exit_system_dialog();
+	gtk_widget_show(dialog3);
+
+	return TRUE;
+}
+
+void on_clearchatbut_clicked(GtkButton *button, gpointer user_data)
+{
+	if (TeacherMode == 1)
+	{
+		gtk_text_buffer_get_start_iter(TeachChat_buffer, &TeachChat_start);
+		gtk_text_buffer_delete(TeachChat_buffer, &TeachChat_start,
+				&TeachChat_end);
+	}
+	else if (TeacherMode == 0)
+	{
+		gtk_text_buffer_get_start_iter(chat_buffer, &chat_start);
+		gtk_text_buffer_delete(chat_buffer, &chat_start, &chat_end);
+	}
+
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/callbacks.hh
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/callbacks.hh?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/callbacks.hh (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/callbacks.hh Mon Nov 30 12:18:34 2009
@@ -0,0 +1,162 @@
+/** \file callbacks.h define GUI operations
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#include <gtk/gtk.h>
+//!about system_activate
+void
+on_about1_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!load system_activate
+void
+on_loadsys_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!add class_activate
+void
+on_addclass_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!exit class_activate
+void
+on_exitclass_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!exit system_activate
+void
+on_exitsys_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!request change_activate
+void
+on_requestchange_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!cancel change_activate
+void
+on_cancelchange_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!Top config button_clicked
+void
+on_Topconfigbutton_clicked(GtkButton *button, gpointer user_data);
+//!network Ok_clicked
+void
+on_networkOk_clicked(GtkButton *button, gpointer user_data);
+//!network config_activate
+void
+on_networkconfig_activate(GtkMenuItem *menuitem, gpointer user_data);
+//!about_clicked
+void
+on_about_clicked(GtkButton *button, gpointer user_data);
+//!load cancel button_clicked
+void
+on_loadcancelbut_clicked(GtkObject *object, gpointer user_data);
+//!network cancel_clicked
+void
+on_networkcancel_clicked(GtkObject *object, gpointer user_data);
+//!send_clicked
+void
+on_send_clicked(GtkButton *button, gpointer user_data);
+//!student image button_clicked
+void
+on_studimagebut_clicked(GtkButton *button, gpointer user_data);
+//!my image button_clicked
+void
+on_myimagebut_clicked(GtkButton *button, gpointer user_data);
+//!send chat button_clicked
+void
+on_sendchatbut_clicked(GtkButton *button, gpointer user_data);
+//!load ok button_clicked
+void
+on_loadokbutton_clicked(GtkButton *button, gpointer user_data);
+//!class cancel button_clicked
+void
+on_classcancelbut_clicked(GtkButton *button, gpointer user_data);
+//!class cancel button_destroy
+void
+on_classcancelbut_destroy(GtkButton *button, gpointer user_data);
+//!class ok button_clicked
+void
+on_classokbut_clicked(GtkButton *button, gpointer user_data);
+//!select clist row
+void
+select_clist_row(GtkCList *clist, gint row, gint column, GdkEvent *event,
+		gpointer user_data);
+//!load tool_clicked
+void
+on_loadtool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!add class tool_clicked
+void
+on_addclasstool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!exit class tool_clicked
+void
+on_exitclasstool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!exchange tool_clicked
+void
+on_exchangetool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!cancel exit tool_clicked
+void
+on_cancelextool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!network tool_clicked
+void
+on_networktool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!exittool_clicked
+void
+on_exittool_clicked(GtkToolButton *toolbutton, gpointer user_data);
+//!student list cancel button_clicked
+void
+on_stulist_cancelbut_clicked(GtkButton *button, gpointer user_data);
+//!student list ok button_clicked
+void
+on_stulist_okbut_clicked(GtkButton *button, gpointer user_data);
+//!chat entry_activate
+void
+on_chatentry_activate(GtkWidget *widget, GtkWidget *entry);
+//!error cancel button_clicked
+void
+on_error_calbut_clicked(GtkButton *button, gpointer user_data);
+//!error ok button_clicked
+void
+on_error_okbut_clicked(GtkButton *button, gpointer user_data);
+//!exit_class cancel_clicked
+void
+on_exit_class_cancel_clicked(GtkButton *button, gpointer user_data);
+//!exit_class yes_clicked
+void
+on_exit_class_yes_clicked(GtkButton *button, gpointer user_data);
+//!exit_system cancel_clicked
+void
+on_exit_system_cancel_clicked(GtkButton *button, gpointer user_data);
+//!exit_system yes_clicked
+void
+on_exit_system_yes_clicked(GtkButton *button, gpointer user_data);
+gint mainwindow_delete_event(GtkWidget *widget, GdkEvent *event,
+		gpointer user_data);
+//!clear chat button_clicked
+void
+on_clearchatbut_clicked(GtkButton *button, gpointer user_data);
+//!add class operation
+void addclass_op();
+//!exit class operation
+void exitclass_op();
+//!exit system operation
+void exitsys_op();
+//!exchange operation
+void exchange_op();
+//!cancel operation
+void cancelexchange_op();
+//get student list operation
+void get_stulist();
+//!send message operation
+void sendmessage_op();
+//!get time
+gint timer_callback(void* para);
+//!get ip
+int getip();
+//!scroll set value
+void scroll_set_value(GtkAdjustment *set);

Added: incubator/bluesky/trunk/RealClass/Student/src/client_communicate.cc
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/client_communicate.cc?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/client_communicate.cc (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/client_communicate.cc Mon Nov 30 12:18:34 2009
@@ -0,0 +1,503 @@
+/** \file client_communicate.cc implementation for the communicate with Tserver
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#include "client_communicate.h"
+#include "callbacks.hh"
+#include "interface.h"
+#include "errormessage.h"
+#include "en_de_video.h"
+#include "en_de_audio.h"
+#include "en_de_screen.h"
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <string.h>
+#include <stdlib.h>
+#include <gdk/gdkx.h>
+
+extern GtkWidget *chatview;
+extern GtkWidget *chat_show;
+extern GtkWidget *clist1;
+extern DWORD TeacherMode;
+extern DWORD chatMode;
+extern DWORD Focus_student;
+extern client_ts_communicate client_comm;
+extern int loadflag;
+extern int addclassflag;
+extern GtkWidget *chatview;
+extern GtkWidget *stu_clist;
+extern GtkWidget *class1;
+extern GtkWidget *addclass;
+extern GtkWidget *exitclass;
+extern GtkWidget *addclasstool;
+extern GtkWidget *exitclasstool;
+extern GtkWidget *exchangetool;
+extern GtkWidget *cancelextool;
+//MCU connect with TServer
+extern GtkWidget *chat_show;
+extern GtkWidget *screenimage;
+extern GtkWidget *teachimage;
+
+extern GtkWidget *sendchatbut;
+extern GtkWidget *chatentry;
+
+extern GtkWidget *requestchange;//for apply focus 
+extern GtkWidget *cancelchange;
+
+extern CScreenReceiver g_teacher_screenreceiver;
+extern CVideoReceiver g_teacher_videoreceiver;
+extern CAudioReceiver g_teacher_audioreceiver;
+
+extern CV4LStuVideoSender g_student_videosender;
+extern CStuAudioSender g_student_audiosender;
+
+extern CVideoReceiver g_student_videoreceiver;
+
+extern CAudioReceiver g_student_audioreceiver;
+
+extern struct TRCClientLogin stulogin; //initialise student login info
+
+extern GtkTextBuffer *chat_buffer;
+extern GtkTextIter chat_end;
+extern GtkTextIter chat_start;
+extern GtkTextBuffer *TeachChat_buffer;
+extern GtkTextIter TeachChat_end;
+extern GtkTextIter TeachChat_start;
+
+extern GtkWidget *networktool;
+extern GtkWidget *networkconfig;
+
+extern GtkWidget *loadsys;
+extern GtkWidget *loadtool;
+
+char *studentInfo[3];
+int clientcount;
+
+extern int error_info_no;
+
+client_ts_communicate::client_ts_communicate()
+{
+	textview_mutex.Init();
+}
+
+client_ts_communicate::~client_ts_communicate()
+{
+
+}
+
+int client_ts_communicate::close_socket(int nHow)
+{
+	if (client_socket.ShutDown(nHow) == false)
+	{
+		perror("close socket error!");
+		return -1;
+	}
+
+	return 0;
+}
+
+int client_ts_communicate::establish_connect(LPCTSTR ts_IP, UINT ts_Port,
+		UINT nSocketPort) //setup socket on MCU
+{
+	if (client_socket.Create(nSocketPort) != true)
+	{
+		printf("Create socket failed!/n");
+		return -1;
+	}
+
+	if (client_socket.Connect(ts_IP, ts_Port) != true)
+	{
+		perror("connet error!");
+		return -1;
+	}
+
+	client_socket_thread.Attach(&client_socket);
+
+	if (client_socket_thread.Init() != true)
+	{
+		printf("Fail to initilize thread!/n");
+		return -1;
+	}
+	client_socket_thread.Start();
+
+	return 0;
+
+}
+
+int client_ts_communicate::send_mes(CRCLMSG mes, int mes_length) //send message to Tserver
+{
+	if (client_socket.Send(&mes, mes_length) == -1)
+	{
+		return -1;
+	}
+	return 0;
+}
+
+int client_ts_communicate::recevie_msg(char *buf, int buf_length)//receive message from Tsever
+{
+	CRCLMSG * receive_str;
+	receive_str = (CRCLMSG *) buf;
+
+	printf("message ID is %d\n", receive_str->rclType);
+
+	switch (receive_str->rclType)
+	{
+	case 5021: //confirm login				
+		TRCClientLoginR *loginReceive;
+		loginReceive = (TRCClientLoginR *) receive_str->msg;
+
+		if (loginReceive->ResponseType == 0)//login successfully
+		{
+			loadflag = 1;
+			Rec_ClientID = loginReceive->ClientID;
+			//change the status of menus
+			gtk_widget_set_sensitive(networktool, FALSE);
+			gtk_widget_set_sensitive(networkconfig, FALSE);
+			gtk_widget_set_sensitive(loadsys, FALSE);
+			gtk_widget_set_sensitive(loadtool, FALSE);
+			gtk_widget_set_sensitive(addclass, TRUE);
+			gtk_widget_set_sensitive(addclasstool, TRUE);
+		}
+		if (loginReceive->ResponseType == 2) //the user name have been used
+			error_info_no = 1;
+		if (loginReceive->ResponseType == 4) //network problem
+			error_info_no = 2;
+		if (loginReceive->ResponseType == 6) //reach the max num
+			error_info_no = 3;
+		break;
+	case 10051: //response to the client's request for group info		  
+		int index;
+		static char *classInfo[5];
+		static char tmp[10];
+		GetGroupInfoR = (TRCClientGetGroupInfoR *) receive_str->msg;
+		if (GetGroupInfoR->ResponseType == 0)
+		{
+			gtk_clist_clear( GTK_CLIST(clist1));
+			chatMode = GetGroupInfoR-> groupchatMode;
+			if (chatMode == 0)
+			{
+				gtk_widget_set_sensitive(sendchatbut, FALSE);
+				gtk_widget_set_sensitive(chatentry, FALSE);
+			}
+			for (index = 0; index < GetGroupInfoR->GroupCount; index++)
+			{
+				sprintf(tmp, "%d", GetGroupInfoR->GroupList[index].GroupID);
+				classInfo[0] = tmp;
+				classInfo[3] = "";
+				classInfo[4] = "";
+				classInfo[1] = GetGroupInfoR->GroupList[index].GroupName;
+				classInfo[2] = GetGroupInfoR->GroupList[index].TeacherName;
+				gtk_clist_freeze ( GTK_CLIST(clist1));
+				gtk_clist_append(GTK_CLIST(clist1), classInfo);
+				gtk_clist_thaw ( GTK_CLIST(clist1));
+			}
+		}
+		if (GetGroupInfoR->ResponseType == 60)//unable to get class list	 
+			error_info_no = 4;
+		break;
+
+	case 10021: //response to the student join class	
+		CRCLClientJoinInGroupR *JoinInGroupR;
+		JoinInGroupR = (CRCLClientJoinInGroupR *) receive_str->msg;
+		printf("MCU's IP is %s\n", JoinInGroupR->MCUIP);
+		if (JoinInGroupR->ResponseType == 0)
+		{
+			addclassflag = 1;
+			TeacherMode = JoinInGroupR->RoomMode;
+			gtk_widget_set_sensitive(exitclass, TRUE);
+			gtk_widget_set_sensitive(exitclasstool, TRUE);
+			gtk_widget_set_sensitive(addclass, FALSE);
+			gtk_widget_set_sensitive(addclasstool, FALSE);
+			gtk_widget_set_sensitive(exchangetool, TRUE);
+			gtk_widget_set_sensitive(cancelextool, TRUE);
+			gtk_widget_set_sensitive(cancelchange, TRUE);
+			gtk_widget_set_sensitive(requestchange, TRUE);
+			gtk_widget_set_sensitive(loadsys, FALSE);
+			gtk_widget_set_sensitive(loadtool, FALSE);
+
+			client_mcu_info.GroupID = JoinInGroupR->GroupID;
+			strcpy(client_mcu_info.MCUIP, JoinInGroupR->MCUIP);
+			strcpy(client_mcu_info.SeMCUIP, JoinInGroupR->SeMCUIP);
+			client_mcu_info.TAPort = JoinInGroupR->TAPort;
+			client_mcu_info.TVPort = JoinInGroupR->TVPort;
+			client_mcu_info.TSPort = JoinInGroupR->TSPort;
+			client_mcu_info.CAPort = JoinInGroupR->CAPort;
+			client_mcu_info.CVPort = JoinInGroupR->CVPort;
+			client_mcu_info.RoomMode = JoinInGroupR->RoomMode;
+
+			g_student_audioreceiver.Init();
+			g_student_audioreceiver.Start(stulogin.SeMCU_SAPort);
+
+			if (TeacherMode == 1)
+			{
+				g_teacher_screenreceiver.Init();
+				g_teacher_screenreceiver.CreateXImage(GDK_WINDOW_XID(
+						teachimage->window), 240, 76, 782, 580);
+				g_teacher_screenreceiver.Start(stulogin.SeMCU_TSPort);
+
+			}
+			g_teacher_videoreceiver.Init();
+			g_teacher_videoreceiver.CreateXImage(GDK_WINDOW_XID(
+					teachimage->window), 2, 76, 320 - 90, 240 - 43);
+			g_teacher_videoreceiver.Start(stulogin.SeMCU_TVPort);
+			g_teacher_audioreceiver.Init();
+			g_teacher_audioreceiver.Start(stulogin.SeMCU_TAPort);
+
+		}
+		else if (JoinInGroupR->ResponseType == 20) //student fail to join class	   
+			error_info_no = 5;
+
+		else if (JoinInGroupR->ResponseType == 22) //the group reach the max num 
+			error_info_no = 6;
+
+		break;
+
+	case 10031: //reponse the leave of student
+		TRCClientLeaveGroupR *LeaveGroupR;
+		LeaveGroupR = (TRCClientLeaveGroupR *) receive_str->msg;
+		if (LeaveGroupR->ResponseType == 0)
+		{
+			addclassflag = 0;
+
+			g_teacher_screenreceiver.Stop();
+			g_teacher_screenreceiver.CloseXImage();
+			g_teacher_videoreceiver.Stop();
+			g_teacher_videoreceiver.CloseXImage();
+			g_teacher_audioreceiver.Stop();
+
+			g_student_videosender.Stop();
+			g_student_videosender.CloseXImage();
+			g_student_audiosender.Pause();
+			g_student_videoreceiver.Stop();
+			g_student_videoreceiver.CloseXImage();
+
+			gtk_widget_set_sensitive(addclass, TRUE);
+			gtk_widget_set_sensitive(addclasstool, TRUE);
+			gtk_widget_set_sensitive(exitclass, FALSE);
+			gtk_widget_set_sensitive(exitclasstool, FALSE);
+			gtk_widget_set_sensitive(cancelchange, FALSE);
+			gtk_widget_set_sensitive(exchangetool, FALSE);
+			gtk_widget_set_sensitive(requestchange, FALSE);
+			gtk_widget_set_sensitive(cancelextool, FALSE);
+		}
+		else if (LeaveGroupR->ResponseType == 21)//student fail to exit class	
+			error_info_no = 7;
+		break;
+
+	case 1011: //response to student's apply focus
+		TCRCLClientApplyFocusR *ApplyFocusR;
+		ApplyFocusR = (TCRCLClientApplyFocusR *) receive_str->msg;
+		if (GetGroupInfoR->ResponseType == 40) //already have one focus
+			error_info_no = 8;
+		else if (GetGroupInfoR->ResponseType == 41) //fail to get a focus
+			error_info_no = 9;
+
+		break;
+
+	case 1021: //response to student's cancel focus	
+		TCRCLClientDestroyFocusR *DestroyFocusR;
+		DestroyFocusR = (TCRCLClientDestroyFocusR *) receive_str->msg;
+		if (DestroyFocusR->ResponseType == 0)
+		{
+			Focus_student = 0;
+			printf("The student destroy focus\n");
+		}
+		else if (DestroyFocusR->ResponseType == 42)//fail to cancel focus
+			error_info_no = 10;
+
+		break;
+
+	case 1052: //response to student get a focus		
+		TCRCLTeacherAllowClientFocusRToMS *AllowClientFocusR;
+		AllowClientFocusR
+				= (TCRCLTeacherAllowClientFocusRToMS *) receive_str->msg;
+		{
+			Focus_student = 1;
+			unsigned long intIP2 = inet_addr(client_mcu_info.MCUIP);
+			intIP2 = ntohl(intIP2);
+			RTPIPv4Address rtpAddr1(intIP2, client_mcu_info.CAPort);
+			RTPIPv4Address rtpAddr2(intIP2, client_mcu_info.CVPort);
+
+			g_student_audioreceiver.Stop();
+
+			if (!g_student_videosender.IsInitialized())
+			{
+				g_student_videosender.Init(6102);
+			}
+
+			g_student_videosender.SetMode(CV4LStuVideoSender::ModeTransmit);
+			printf(
+					"\n g_student_videosender.AddDestination(rtpAddr2):problem!!!!!!!!!!!\n");
+			g_student_videosender.ClearDestinations();
+			g_student_videosender.AddDestination(rtpAddr2);
+			g_student_videosender.Start();
+
+			g_student_audiosender.Init(6004);
+			g_student_audiosender.ClearDestinations();
+			g_student_audiosender.AddDestination(rtpAddr1);
+			g_student_audiosender.Start();
+			g_student_audiosender.Resume();
+		}
+		break;
+
+	case 1062: //send to student that teacher have canceled a focus			
+		TCRCLTeacherCancelClientFocusRToMS *TeacherCancelClientR;
+		TeacherCancelClientR
+				= (TCRCLTeacherCancelClientFocusRToMS *) receive_str->msg;
+		Focus_student = 0;
+		printf("cancel image OKKKKKKKKKKK\n");
+		g_student_audioreceiver.Init();
+		g_student_audioreceiver.Start(stulogin.SeMCU_SAPort);
+
+		g_student_videosender.Stop();
+		g_student_videosender.CloseXImage();
+		g_student_audiosender.Pause();
+		g_student_videoreceiver.Stop();
+		g_student_videoreceiver.CloseXImage();
+		break;
+
+	case 1031: //response to text chat
+		char Text[1024];
+		TCRCLClientTextBroadcastR *TextBroadcastR;
+		TextBroadcastR = (TCRCLClientTextBroadcastR *) receive_str->msg;
+		strcpy(Text, TextBroadcastR->ClientName);
+		strcat(Text, ":");
+		strcat(Text, TextBroadcastR->Info);
+		strcat(Text, "\n");
+		get_text_from_msg(Text);
+		flush_scrollar();
+		break;
+
+	case 1081: //change mode
+
+		TCRCLTeacherSwitchModeR *TeacherSwitchMode;
+		TeacherSwitchMode = (TCRCLTeacherSwitchModeR *) receive_str->msg;
+		if (TeacherSwitchMode->ModeType == 0)
+		{
+			g_teacher_screenreceiver.Stop();
+			g_teacher_screenreceiver.CloseXImage();
+			TeacherMode = 0;
+			chatMode = 1;
+			gtk_widget_set_sensitive(sendchatbut, TRUE);
+			gtk_widget_set_sensitive(chatentry, TRUE);
+		}
+		if (TeacherSwitchMode->ModeType == 1)
+		{
+			TeacherMode = 1;
+			chatMode = 1;
+			gtk_widget_set_sensitive(sendchatbut, TRUE);
+			gtk_widget_set_sensitive(chatentry, TRUE);
+			g_teacher_screenreceiver.Init();
+			g_teacher_screenreceiver.CreateXImage(GDK_WINDOW_XID(
+					teachimage->window), 240, 76, 782, 580);
+			g_teacher_screenreceiver.Start(stulogin.SeMCU_TSPort);
+		}
+
+		break;
+
+	case 10012: //cancel communication mode
+		TRCDestoryGroupRToClient *DestoryGroupRToClient;
+		DestoryGroupRToClient = (TRCDestoryGroupRToClient *) receive_str->msg;
+		addclassflag = 0;
+
+		g_teacher_screenreceiver.Stop();
+		g_teacher_screenreceiver.CloseXImage();
+		g_teacher_videoreceiver.Stop();
+		g_teacher_videoreceiver.CloseXImage();
+		g_teacher_audioreceiver.Stop();
+		g_student_videosender.Stop();
+		g_student_videosender.CloseXImage();
+		g_student_audiosender.Pause();
+		g_student_videoreceiver.Stop();
+		g_student_videoreceiver.CloseXImage();
+
+		gtk_widget_set_sensitive(addclass, TRUE);
+		gtk_widget_set_sensitive(addclasstool, TRUE);
+		gtk_widget_set_sensitive(exitclass, FALSE);
+		gtk_widget_set_sensitive(exitclasstool, FALSE);
+		gtk_widget_set_sensitive(cancelchange, FALSE);
+		gtk_widget_set_sensitive(exchangetool, FALSE);
+		gtk_widget_set_sensitive(requestchange, FALSE);
+		gtk_widget_set_sensitive(cancelextool, FALSE);
+
+		break;
+
+	case 1092: //teacher change to chat mode
+
+		TCRCLTeacherAgreeChat *TeacherAgreeChat;
+		TeacherAgreeChat = (TCRCLTeacherAgreeChat *) receive_str->msg;
+		if (TeacherAgreeChat->Agreechat == 0)
+		{
+			chatMode = 0;
+			gtk_widget_set_sensitive(sendchatbut, FALSE);
+			gtk_widget_set_sensitive(chatentry, FALSE);
+		}
+		else if (TeacherAgreeChat->Agreechat == 1)
+		{
+			chatMode = 1;
+			gtk_widget_set_sensitive(sendchatbut, TRUE);
+			gtk_widget_set_sensitive(chatentry, TRUE);
+		}
+
+		break;
+
+	case 1001: //get the message from teacher
+
+		char TeachMessage[1024];
+		TCRCLTeacherTextBroadcastR *TeacherTextR;
+		TeacherTextR = (TCRCLTeacherTextBroadcastR *) receive_str->msg;
+		strcpy(TeachMessage, "Teacher:");
+		strcat(TeachMessage, TeacherTextR->Info);
+		strcat(TeachMessage, "\n");
+		printf("Teacher message is %s\n", TeachMessage);
+		get_text_from_msg(TeachMessage);
+		flush_scrollar();
+
+		break;
+
+	default:
+
+		break;
+	}
+
+	return 0;
+
+}
+
+void client_ts_communicate::get_text_from_msg(char *Message)
+{
+	textview_mutex.Lock();
+	if (TeacherMode == 1)
+		gtk_text_buffer_insert(TeachChat_buffer, &TeachChat_end, Message, -1);
+	else if (TeacherMode == 0)
+		gtk_text_buffer_insert(chat_buffer, &chat_end, Message, -1);
+	textview_mutex.Unlock();
+
+}
+void client_ts_communicate::flush_scrollar()
+{
+	textview_mutex.Lock();
+	if (TeacherMode == 1)
+		error_info_no = 20;
+	else if (TeacherMode == 0)
+		error_info_no = 21;
+	textview_mutex.Unlock();
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/client_communicate.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/client_communicate.h?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/client_communicate.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/client_communicate.h Mon Nov 30 12:18:34 2009
@@ -0,0 +1,77 @@
+/** \file client_communicate.h class for the communicate with Tserver
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#ifndef CLIENT_COMMUNICATE_H
+#define CLIENT_COMMUNICATE_H
+
+#include "stdafx.h"
+#include "clientsocket.h"
+#include "singlecomm.h"
+#include "ncclient.hh"
+//!communicate with Tserver
+class client_ts_communicate
+{
+public:
+	//!Constructor
+	client_ts_communicate();
+	//!Destructor
+	~client_ts_communicate();
+	//!establish a connection
+	int establish_connect(LPCTSTR, UINT, UINT nSocketPort = 0);
+	//!send messages
+	/*!
+	 \param CRCLMSG the message
+	 \param mes_length message length
+	*/
+	int send_mes(struct CRCLMSG, int mes_length);
+	//!receive messages
+	/*!
+	 \param buf the buffer to store messages
+	 \param buf_length buffer size
+	*/
+	int recevie_msg(char *buf, int buf_length);
+	//!get text from messages
+	/*!
+	 \param Message the message
+	*/
+	void get_text_from_msg(char *Message);
+	//!flush scrollar
+	void flush_scrollar();
+	//!close the socket
+	int close_socket(int nHow);
+	//!ClientID
+	DWORD Rec_ClientID;
+	//!TRCClient GetGroupInfoR list
+	TRCClientGetGroupInfoR *GetGroupInfoR;
+	//!TRCClient GetGroupInfoR list
+	struct CRCLClientJoinInGroupR client_mcu_info;
+
+private:
+	//!client socket
+	CClientSocket client_socket;
+	//!client socket thread
+	CSingleComm client_socket_thread;
+	//!mutex for text view
+	JMutex textview_mutex;
+
+};
+
+#endif

Added: incubator/bluesky/trunk/RealClass/Student/src/clientsocket.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/clientsocket.cpp?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/clientsocket.cpp (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/clientsocket.cpp Mon Nov 30 12:18:34 2009
@@ -0,0 +1,77 @@
+/** \file clientsocket.cpp implementation of the CClientSocket class
+ *
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+// ClientSocket.cpp: implementation of the CClientSocket class.
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "clientsocket.h"
+#include "client_communicate.h"
+
+extern client_ts_communicate client_comm;
+
+CClientSocket::CClientSocket()
+{
+
+}
+
+CClientSocket::~CClientSocket()
+{
+}
+
+void CClientSocket::OnEvent()
+{
+	unsigned long len;
+	if (m_lEvent == 0)
+		return;
+	IOCtl(FIONREAD, &len);
+	if (len == 0)
+	{
+		Close();
+		printf("\nA client disconnected.");
+		return;
+	}
+
+	char buffer[10008] =
+	{ '\0' };
+	int receive_length = 0;
+
+	memset(buffer, '\0', 10008);
+	if ((receive_length = Receive(buffer, 10008)) == -1)
+	{
+		perror("Receive failed!");
+		return;
+	}
+
+	CRCLMSG* pM = (CRCLMSG*) buffer;
+	printf("message lenth is %d\n", pM->msglen);
+	int index = receive_length;
+	int to_receive_length = pM->msglen + 8 - receive_length;
+	while (to_receive_length > 0)
+	{
+		receive_length = Receive(buffer + index, to_receive_length);
+		printf("recv a message lenth is %d\n", receive_length);
+		index += receive_length;
+		to_receive_length -= receive_length;
+	}
+
+	client_comm.recevie_msg(buffer, receive_length);
+
+	return;
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/clientsocket.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/clientsocket.h?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/clientsocket.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/clientsocket.h Mon Nov 30 12:18:34 2009
@@ -0,0 +1,40 @@
+/** \file clientsocket.h CClientSocket extends CAsyncSocketEx and handle socket event with users
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#if !defined(CLIENTSOCKET_H)
+#define CLIENTSOCKET_H
+
+#include "asyncsocketex.h"
+//!Client Socket class
+class CClientSocket: public CAsyncSocketEx
+{
+public:
+	//Constructor
+	CClientSocket();
+	//!Destructor
+	virtual ~CClientSocket();
+
+protected:
+	//!listen to event and deal with corresponding events
+	virtual void OnEvent();
+
+};
+
+#endif // !defined(CLIENTSOCKET_H)

Added: incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.cpp?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.cpp (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.cpp Mon Nov 30 12:18:34 2009
@@ -0,0 +1,1078 @@
+/** \file en_de_audio.cpp Implementation for audio operation:capture,encoder,decoder,sender,receiver
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+#include "en_de_audio.h"
+//!CODEC_ID_MP2 for network transmission 
+#define ENCODE_ID CODEC_ID_MP2//CODEC_ID_PCM_S16LE
+//!CODEC_ID_MP3 the codec for the saved file
+#define DECODE_ID CODEC_ID_MP3
+//!maxinum frames to store in the fifo buffer
+#define STATIC_AUDIO_FRAMES 10
+//!maxinum packet size
+#define MAX_PACKET_SIZE 10*1024
+//!maxinum audio packet size
+#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
+
+//!Print the error text
+extern void PErrorText(const char* error);
+
+// For CAEncoder class.
+
+CAEncoder::CAEncoder() :
+	m_soundcard("/dev/dsp")
+{
+	m_pCodec = 0;
+	m_pCodecCtx = 0;
+	m_bInit = false;
+
+	m_audio_buf = 0;
+	m_fifo = 0;
+
+}
+
+CAEncoder::~CAEncoder()
+{
+	/*CAEncoder can't close audio device in ~CAEncoder(), 
+	 and close audio device in main()*/
+
+	m_bInit = false;
+	CloseAudio();
+
+	if (m_pCodecCtx)
+	{
+		avcodec_close( m_pCodecCtx);
+		m_pCodecCtx = 0;
+	}
+
+	if (m_audio_buf)
+		free( m_audio_buf);
+
+	if (m_fifo)
+	{
+		fifo_free( m_fifo);
+		free(m_fifo);
+	}
+
+}
+
+void CAEncoder::CloseAudio()
+{
+}
+
+bool CAEncoder::OpenAudio()
+{
+	if (m_soundcard.start_record() < 0)
+	{
+		printf("\nopen audio error.\n");
+		return false;
+	}
+
+	SOUNDPARAMS sp;
+	sp.format = 2;
+
+	sp.channels = 1;
+
+	sp.rate = AUDIO_ENCODE_sample_rate;
+
+	m_soundcard.setparams(&sp);
+
+	printf("\nopen audio success.\n");
+	return true;
+
+}
+
+
+bool CAEncoder::Init(enum CodecID nCodecID /*=CODEC_ID_MPEG4*/)
+{
+	m_bInit = false;
+
+	avienc_init();
+	av_register_all();
+
+	if (!OpenAudio())
+		return false;
+
+	/* find the mpeg4 video encoder */
+	m_pCodec = avcodec_find_encoder(nCodecID);
+	if (!m_pCodec)
+	{
+		PErrorText("codec not found");
+		return false;
+	}
+
+	if (m_pCodecCtx)
+	{
+		avcodec_close( m_pCodecCtx);
+		m_pCodecCtx = 0;
+	}
+
+	m_pCodecCtx = avcodec_alloc_context();
+	/* put sample parameters */
+	m_pCodecCtx->codec_id = nCodecID;
+	m_pCodecCtx->codec_type = CODEC_TYPE_AUDIO;
+	m_pCodecCtx->bit_rate = AUDIO_ENCODE_bit_rate;
+	m_pCodecCtx->sample_rate = AUDIO_ENCODE_sample_rate;
+	m_pCodecCtx->channels = 1;
+
+	/* open it */
+	if (avcodec_open(m_pCodecCtx, m_pCodec) < 0)
+	{
+		PErrorText("could not open codec");
+		return false;
+	}
+
+	if (0 == m_audio_buf)
+		m_audio_buf = (uint8_t*) av_malloc(2 * MAX_AUDIO_PACKET_SIZE);
+
+	if (m_fifo == 0)
+	{
+		m_fifo = (FifoBuffer*) malloc(sizeof(FifoBuffer));
+		fifo_init(m_fifo, 10000);
+	}
+
+	m_bInit = true;
+	return true;
+}
+
+int CAEncoder::EncodeProcess(uint8_t* data, uint8_t *pOutBuf[2], int nOutsize)
+{
+	int size_out = nOutsize;
+	int loop_times = 0;
+
+	if (!m_bInit)
+		return -1;
+
+	/* now encode as many frames as possible */
+	if (m_pCodecCtx->frame_size > 1)
+	{
+		fifo_write(m_fifo, data, nOutsize, &m_fifo->wptr);
+		int frame_bytes = m_pCodecCtx->frame_size * 2 * m_pCodecCtx->channels;
+		while (fifo_read(m_fifo, m_audio_buf, frame_bytes, &m_fifo->rptr) == 0)
+		{
+			m_encode_length[loop_times] = avcodec_encode_audio(m_pCodecCtx,
+					pOutBuf[loop_times], 4 * MAX_AUDIO_PACKET_SIZE,
+					(short *) m_audio_buf);
+			++loop_times;
+			if (loop_times >= 2)
+				break;
+
+		}
+	}
+	else
+	{
+		switch (m_pCodecCtx->codec->id)
+		{
+		case CODEC_ID_PCM_S16LE:
+		case CODEC_ID_PCM_S16BE:
+		case CODEC_ID_PCM_U16LE:
+		case CODEC_ID_PCM_U16BE:
+			break;
+		default:
+			size_out = size_out >> 1;
+			break;
+		}
+		m_encode_length[0] = avcodec_encode_audio(m_pCodecCtx, pOutBuf[0],
+				size_out, (short *) data);
+		loop_times = 1;
+		printf("now encode here!\n");
+	}
+
+	return loop_times;
+
+}
+
+int CAEncoder::Capture(uint8_t** pOutBuf, int &size)
+{
+	int ret;
+	static uint8_t buf[10000];
+	if (!m_bInit)
+		return -1;
+	m_soundcard.sounddata(buf, ret);
+
+	if (ret > 0)
+	{
+		*pOutBuf = buf;
+		size = ret;
+		return ret;
+	}
+
+	return -1;
+}
+
+// For CADecoder class.
+CADecoder::CADecoder()
+{
+	m_pCodec = 0;
+	m_pCodecCtx = 0;
+	m_pSDLBuf = 0;
+	m_bInit = false;
+
+}
+
+CADecoder::~CADecoder()
+{
+
+	m_bInit = false;
+	CloseAudio();
+	if (m_pSDLBuf)
+	{
+		free( m_pSDLBuf);
+		m_pSDLBuf = 0;
+	}
+
+	if (m_pCodecCtx)
+	{
+		avcodec_close( m_pCodecCtx);
+		m_pCodecCtx = 0;
+	}
+
+}
+
+void CADecoder::CloseAudio()
+{
+
+}
+
+bool CADecoder::OpenAudio()
+{
+
+	return true;
+}
+
+bool CADecoder::Init(enum CodecID nCodecID/* = CODEC_ID_MP3*/, int nOutBufSize /*= SDLBufSize*/)
+{
+	m_bInit = false;
+
+	avcodec_init();
+	avcodec_register_all();
+
+	if (!OpenAudio())
+	{
+		printf("\n Open audio device faild!");
+		return false;
+	}
+	//malloc SDLBuf.
+	if (m_pSDLBuf)
+	{
+		free( m_pSDLBuf);
+		m_pSDLBuf = 0;
+	}
+
+	m_pSDLBuf = (uint8_t*) malloc(nOutBufSize * sizeof(uint8_t));
+	if (m_pSDLBuf == 0)
+	{
+		PErrorText("OutBuf malloc failed!");
+		return false;
+	}
+	// find the video decoder
+	m_pCodec = avcodec_find_decoder(nCodecID);
+	if (!m_pCodec)
+	{
+		PErrorText("Codec not found");
+		return false;
+	}
+
+	if (m_pCodecCtx)
+	{
+		avcodec_close( m_pCodecCtx);
+		m_pCodecCtx = 0;
+	}
+	m_pCodecCtx = avcodec_alloc_context();
+
+	// frames per second
+	m_pCodecCtx->frame_rate = A_DECODE_framerate;
+	m_pCodecCtx->frame_rate_base = A_DECODE_frame_rate_base;
+	// emit one intra frame every ten frames
+	m_pCodecCtx->gop_size = A_DECODE_gop_size;
+
+	m_pCodecCtx->bit_rate = AUDIO_DECODE_bit_rate;
+	m_pCodecCtx->sample_rate = AUDIO_DECODE_sample_rate;
+	m_pCodecCtx->channels = 1;
+
+	m_pCodecCtx->codec_type = CODEC_TYPE_AUDIO;
+
+	// we dont send complete frames
+	if (m_pCodec->capabilities & CODEC_CAP_TRUNCATED)
+		m_pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
+
+	// open it
+	if (avcodec_open(m_pCodecCtx, m_pCodec) < 0)
+	{
+		PErrorText("could not open codec");
+		return false;
+	}
+	m_bInit = true;
+	return true;
+}
+//!Set the capture params
+/*!
+\param fd file handle
+\param bits audio sample type 
+\param chn channel
+\param hz frequency
+*/
+int SetFormat(unsigned int fd, unsigned int bits, unsigned int chn,
+		unsigned int hz)
+{
+	int ioctl_val;
+
+	/* set bit format */
+	ioctl_val = bits;
+	if (ioctl(fd, SNDCTL_DSP_SETFMT, &ioctl_val) == -1)
+	{
+		fprintf(stderr, "Set fmt to bit  failed:\n");
+		return (-1);
+	}
+	if (ioctl_val != bits)
+	{
+		fprintf(stderr, "do not support bit  supported \n");
+		return (-1);
+	}
+
+	/*set channel */
+	ioctl_val = chn;
+	if ((ioctl(fd, SNDCTL_DSP_CHANNELS, &ioctl_val)) == -1)
+	{
+		fprintf(stderr, "Set Audio Channels %d failed:\n", chn);
+		return (-1);
+	}
+	if (ioctl_val != chn)
+	{
+		fprintf(stderr, "do not support channel %d,supported\n", chn);
+		return (-1);
+	}
+
+	/*set speed */
+	ioctl_val = hz;
+	if (ioctl(fd, SNDCTL_DSP_SPEED, &ioctl_val) == -1)
+	{
+		fprintf(stderr, "Set speed to %d failed:\n", hz);
+		return (-1);
+	}
+	if (ioctl_val != hz)
+	{
+		fprintf(stderr, "do not support speed %d,supported is\n", hz);
+		return (-1);
+	}
+
+	return (0);
+}
+
+int CADecoder::DecodeProcess(uint8_t *encodeddata_a,
+		const int encodeddatasize_a)
+{
+
+	static JMutex writemutex;
+	int len;
+	int encodedAudioSize;
+	int outAudioBufSize;
+	int kkk;
+
+	if (!m_bInit)
+	{
+		return -1;
+	}
+
+	if (!writemutex.IsInitialized())
+	{
+		if (!writemutex.Init())
+		{
+			PErrorText("\nDecodeProcess: writemutex Init error\n");
+			return -1;
+
+		}
+	}
+
+	encodedAudioSize = encodeddatasize_a;
+	len = 0;
+	kkk = 0;
+	while (encodedAudioSize > 0)
+	{
+		len = avcodec_decode_audio(m_pCodecCtx, (short *) m_pSDLBuf,
+				&outAudioBufSize, encodeddata_a + kkk, encodedAudioSize);
+		if (len < 0)
+		{
+			PErrorText("Error While Decoding Audio");
+			return -2;
+		}
+
+		encodedAudioSize -= len;
+		kkk += len;
+	}
+	static int s_iloops = 0;
+	static char s_chAudioBuf[STATIC_AUDIO_FRAMES * 2 * 4096];
+	static int s_AudioBuflength = 0;
+	memcpy(s_chAudioBuf + s_AudioBuflength, m_pSDLBuf, outAudioBufSize);
+	s_AudioBuflength += outAudioBufSize;
+	s_iloops++;
+
+	if (outAudioBufSize > 0)
+		if (s_iloops >= STATIC_AUDIO_FRAMES)
+		{
+			writemutex.Lock();
+			static int64_t pre, cur, inteval;
+			pre = av_gettime();
+			//write
+			int fd2;
+			fd2 = open("/dev/dsp", O_WRONLY);
+			if (SetFormat(fd2, AFMT_S16_LE, 1, 44100) < 0)
+			{
+				fprintf(stderr, "cannot set............\n");
+				return (-1);
+			}
+			printf("here test 2 %d , %d ........\n", m_pCodecCtx->sample_rate,
+					fd2);
+			write(fd2, s_chAudioBuf, s_AudioBuflength);
+			close(fd2);
+
+			s_iloops = 0;
+			s_AudioBuflength = 0;
+			cur = av_gettime();
+			inteval = (cur - pre);
+
+			writemutex.Unlock();
+		}
+
+	return 0;
+}
+
+//CStuAudioSender class.
+
+CStuAudioSender::CStuAudioSender()
+{
+	stop = false;
+	m_bInit = 0;
+	m_sendpause = false;
+
+	m_pOutBuf[0] = 0;
+	m_pOutBuf[1] = 0;
+}
+
+CStuAudioSender::~CStuAudioSender()
+{
+	//first stop thread, because  m_pOutBuf is being used by Thread();
+	Stop();
+
+	//free buffer.
+	if (m_pOutBuf[0] != 0)
+		free( m_pOutBuf[0]);
+	if (m_pOutBuf[1] != 0)
+		free( m_pOutBuf[1]);
+}
+//!Initialize
+/*!
+\param nPort the port for transmission
+*/
+bool CStuAudioSender::Init(int nPort)
+{
+	if (m_bInit)
+		return true;
+
+	//init rtpsession.
+	RTPSessionParams sessParams1;
+	sessParams1.SetOwnTimestampUnit(1.0 / 30.0); //30 video frames per second
+	sessParams1.SetUsePollThread(0); //background thread to call virtual callbacks - set by default, but just to be sure
+	sessParams1.SetMaximumPacketSize(MAX_PACKET_SIZE);
+	//setup transmission parameters
+	RTPUDPv4TransmissionParams transParams1;
+	transParams1.SetPortbase(nPort);
+	//CREATE THE SESSION
+	int status1 = m_fecrtpsession.Create(sessParams1, &transParams1);
+	if (status1)
+	{
+		//		ReportError(status1);
+		return false; //unable to create the session
+	}
+	//must set for fec SendFECPacket. 
+	m_fecrtpsession.SetDefaultMark(true);
+	m_fecrtpsession.SetDefaultPayloadType(1);
+	m_fecrtpsession.SetDefaultTimestampIncrement(0);
+
+	for (int i = 0; i <= 1; i++)
+	{
+		if (m_pOutBuf[i] == 0)
+		{
+			m_pOutBuf[i] = (uint8_t*) malloc(CAEncoder::A_OutBufSize);
+			if (m_pOutBuf[i] == 0)
+			{
+				return false;
+			}
+
+		}
+	}
+	//Init vencoder.
+	if (!m_aencoder.Init(ENCODE_ID))
+	{
+		return false;
+	}
+
+	m_bInit = true;
+	return m_bInit;
+}
+//!Start to send 
+int CStuAudioSender::Start(char* szFile /* =0 */, bool bIsRecord /* =false */)
+{
+	if (!m_bInit)
+		return -1;
+
+	if (JThread::IsRunning())
+		return 0;
+
+	if (!stopmutex.IsInitialized())
+	{
+		if (stopmutex.Init() < 0)
+			return -2;
+	}
+
+	stop = false;
+
+	if (!m_sendpausemutex.IsInitialized())
+	{
+		if (m_sendpausemutex.Init() < 0)
+			return -2;
+	}
+
+	m_sendpause = false;
+
+	if (JThread::Start() < 0)
+	{
+		return -6;
+	}
+
+	return 0;
+}
+
+void CStuAudioSender::Stop()
+{
+	if (!IsRunning())
+		return;
+
+	stopmutex.Lock();
+	stop = true;
+	stopmutex.Unlock();
+
+	//wait for two minute;
+	sleep(1);
+	if (JThread::IsRunning())
+	{
+		JThread::Kill();
+	}
+	stop = false;
+
+}
+
+void CStuAudioSender::Pause()
+{
+	if (!m_bInit)
+		return;
+	m_sendpausemutex.Lock();
+	m_sendpause = true;
+	m_sendpausemutex.Unlock();
+
+}
+
+void CStuAudioSender::Resume()
+{
+	if (!m_bInit)
+		return;
+
+	m_sendpausemutex.Lock();
+	m_sendpause = false;
+	m_sendpausemutex.Unlock();
+
+}
+
+void *CStuAudioSender::Thread()
+{
+	uint8_t * data;
+	int datasize;
+	int OutBufSzie;
+	int status;
+
+	JThread::ThreadStarted();
+
+	bool stopthread;
+
+	stopmutex.Lock();
+	stopthread = stop;
+	stopmutex.Unlock();
+
+	bool sendpause;
+
+	m_sendpausemutex.Lock();
+	sendpause = m_sendpause;
+	m_sendpausemutex.Unlock();
+
+	int64_t pre_time, cur_time;
+	useconds_t delay;
+	pre_time = av_gettime();
+	while (!stopthread)
+	{
+
+		cur_time = av_gettime();
+		delay = cur_time - pre_time;
+		if (delay < 20000 * 2)
+		{
+			usleep(20000 * 2 - delay);
+			pre_time = av_gettime();
+		}
+
+		if ((status = m_aencoder.Capture(&data, datasize)) < 0)
+		{
+			printf("\naudio capture failed");
+			stopthread = true;
+		}
+		else
+		{
+			if (datasize <= 0)
+				continue;
+			OutBufSzie = datasize;
+			if ((status = m_aencoder.EncodeProcess(data, m_pOutBuf, OutBufSzie))
+					< 0)
+			{
+				printf("\naudio EncodeProcess failed");
+				stopthread = true;
+			}
+			else
+			{
+				if (status > 0)
+				{
+					if (!sendpause)
+					{
+						static int s_iTemp1 = 0;
+						s_iTemp1++;
+						for (int i = 0; i < status; i++)
+						{
+							static char temp_buf[1000];
+							int *temp_p = (int *) temp_buf;
+							static int s_iTemp1 = 0;
+							s_iTemp1++;
+
+							//	printf("now send sequen is %d\n",s_iTemp1);
+							*temp_p = s_iTemp1;
+							memcpy(temp_buf + sizeof(int), m_pOutBuf[i],
+									m_aencoder.encodelength(i));
+							m_fecrtpsession.SendPacket(temp_buf,
+									m_aencoder.encodelength(i) + sizeof(int));
+						}
+						//usleep(20000);
+					}
+				}
+
+				m_sendpausemutex.Lock();
+				sendpause = m_sendpause;
+				m_sendpausemutex.Unlock();
+
+				stopmutex.Lock();
+				stopthread = stop;
+				stopmutex.Unlock();
+			}
+		}
+
+	}
+	printf("\nAudio capture thread stoped.\n");
+	return 0;
+}
+
+bool CStuAudioSender::AddDestination(const RTPIPv4Address &des)
+{
+	if (!m_bInit)
+		return false;
+	if (m_fecrtpsession.AddDestination(des) < 0)
+		return false;
+
+	return true;
+}
+
+void CStuAudioSender::ClearDestinations()
+{
+	if (!m_bInit)
+		return;
+	m_fecrtpsession.ClearDestinations();
+}
+
+//CAudioReceiver class.
+
+CAudioReceiver::CAudioReceiver()
+{
+	m_bInit = false;
+}
+
+CAudioReceiver::~CAudioReceiver()
+{
+
+}
+
+bool CAudioReceiver::Init()
+{
+	if (m_bInit)
+		return m_bInit;
+
+	//init video decoder.
+	if (!m_adecoder.Init(DECODE_ID))
+	{
+		return false;
+	}
+
+	m_bInit = true;
+	return m_bInit;
+
+}
+
+int CAudioReceiver::Start(int nPort)
+{
+	if (!m_bInit)
+		return -1;
+
+	if (IsActive())
+		return 0;
+
+	//init rtpsession.
+	RTPSessionParams sessParams1;
+	sessParams1.SetOwnTimestampUnit(1.0 / 30.0); //30 video frames per second
+	sessParams1.SetUsePollThread(1); //background thread to call virtual callbacks - set by default, but just to be sure
+	sessParams1.SetMaximumPacketSize(MAX_PACKET_SIZE);
+	//setup transmission parameters
+	RTPUDPv4TransmissionParams transParams1;
+	transParams1.SetPortbase(nPort);
+	//CREATE THE SESSION
+	int status1 = Create(sessParams1, &transParams1);
+	if (status1)
+		return -2; //unable to create the session	
+
+	return 0;
+}
+
+void CAudioReceiver::Stop()
+{
+	Destroy();
+}
+
+void CAudioReceiver::OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime,
+		const RTPAddress *senderaddress)
+{
+	int *iTemp = 0;
+	iTemp = (int *) pack->GetPayloadData();
+	printf("now  receive audio sequen is %d\n", *iTemp);
+
+	m_adecoder.DecodeProcess(pack->GetPayloadData() + sizeof(int),
+			pack->GetPayloadLength() - sizeof(int));
+
+}
+
+/* ---------------------------------------------------------------------- */
+
+Soundcard::Soundcard(const char *dev)
+{
+	if (dev)
+		strcpy(devname, dev);
+	else
+		strcpy(devname, "/dev/dsp");
+
+	driver_name[0] = '\0';
+
+	stat = STATUS_CLOSED;
+	get_capabilities();
+	channels = 1;
+	rate = 22050;
+	fd = -1;
+}
+
+Soundcard::~Soundcard()
+{
+	/* nothing */
+	close_dev();
+}
+
+int Soundcard::start_record()
+{
+	switch (stat)
+	{
+	case STATUS_CLOSED:
+		if (!init_done)
+			get_capabilities();
+		if (!init_done)
+			return -1;
+		return open_dev(TRUE);
+	case STATUS_RECORD:
+		return 0;
+	case STATUS_PLAYBACK:
+		close_dev();
+		return open_dev(TRUE);
+	}
+	return -1;
+}
+
+int Soundcard::start_playback()
+{
+	switch (stat)
+	{
+	case STATUS_CLOSED:
+		if (!init_done)
+			get_capabilities();
+		if (!init_done)
+			return -1;
+		return open_dev(FALSE);
+	case STATUS_RECORD:
+		close_dev();
+		return open_dev(FALSE);
+	case STATUS_PLAYBACK:
+		return 0;
+	}
+	return -1;
+}
+
+void Soundcard::get_capabilities()
+{
+	int i, dsp;
+	int try_afmt;
+	int try_channels;
+
+	afmt = 0;
+	if (-1 != (dsp = open(devname, O_RDONLY)))
+	{
+
+		ioctl(dsp, SNDCTL_DSP_SETFMT, &afmt); /* current */
+		ioctl(dsp, SNDCTL_DSP_GETFMTS, &afmt_hw); /* hardware cap */
+		afmt_sw = 0;
+
+		for (i = 0; i < 16; i++)
+		{
+			try_afmt = (1 << i);
+			if (-1 == ioctl(dsp, SNDCTL_DSP_SETFMT, &try_afmt))
+				continue;
+			if (try_afmt != (1 << i))
+				continue;
+			afmt_sw |= try_afmt;
+		}
+
+		try_channels = 2;
+		if (-1 != ioctl(dsp, SNDCTL_DSP_CHANNELS, &try_channels) && 2
+				== try_channels)
+			channels_hw = 2;
+		else
+			channels_hw = 1;
+
+		close(dsp);
+		init_done = 1;
+
+	}
+	else
+	{
+		init_done = 0;
+	}
+}
+
+int Soundcard::open_dev(int record)
+{
+	struct SOUNDPARAMS p;
+	int frag, rrate;
+
+	if (-1 == (fd = open(devname, record ? O_RDONLY : O_WRONLY)))
+		goto err;
+	fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+	/* try to get ~50 ms latency */
+	blocksize = 50 * channels * rate / 1000;
+	if (afmt == AFMT_U16_BE || afmt == AFMT_S16_BE || afmt == AFMT_U16_LE
+			|| afmt == AFMT_S16_LE)
+		blocksize *= 2;
+	for (frag = 0; blocksize != 1; frag++)
+		blocksize >>= 1;
+#if 0
+	fprintf(stderr,"asking for %d byte blocksize\n",1 << frag);
+#endif
+	frag |= 0x7fff0000;
+	if (-1 == ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag))
+		perror("ioctl SNDCTL_DSP_SETFRAGMENT");
+
+	rrate = rate;
+	if (-1 == ioctl(fd, SNDCTL_DSP_SETFMT, &afmt))
+	{
+		perror("ioctl SNDCTL_DSP_SETFMT");
+		goto err;
+	}
+	if (-1 == ioctl(fd, SNDCTL_DSP_CHANNELS, &channels))
+	{
+		perror("ioctl SNDCTL_DSP_SETFMT");
+		goto err;
+	}
+	if (-1 == ioctl(fd, SNDCTL_DSP_SPEED, &rrate))
+	{
+		perror("ioctl SNDCTL_DSP_SETFMT");
+		goto err;
+	}
+	if (-1 == ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &blocksize))
+	{
+		perror("ioctl SNDCTL_DSP_SETFMT");
+		goto err;
+	}
+	if (0 == blocksize)
+		blocksize = 4096;
+	if (rrate != rate)
+	{
+		fprintf(stderr, "sample rate: asked for %d, hardware uses %d. ", rate,
+				rrate);
+		if (abs(rate - rrate) * 100 < rate)
+		{
+			fprintf(stderr, "that's fine (diff <1%%).\n");
+		}
+		else
+		{
+			fprintf(stderr, "way off, using hardware rate.\n");
+			rate = rrate;
+		}
+	}
+
+	latency = blocksize * 1000 / channels / rate;
+	if (afmt == AFMT_U16_BE || afmt == AFMT_S16_BE || afmt == AFMT_U16_LE
+			|| afmt == AFMT_S16_LE)
+		latency = latency / 2;
+
+	stat = record ? STATUS_RECORD : STATUS_PLAYBACK;
+#if 0
+	fprintf(stderr,"%s (format=%d, %s, rate=%d, blocksize=%d, latency=%d ms)\n",
+			record ? "recording" : "playback",
+			afmt,
+			(channels == 2) ? "stereo" : "mono",
+			rate, blocksize, latency);
+#endif
+	p.channels = channels;
+	p.rate = rate;
+	p.blocksize = blocksize;
+	p.latency = latency;
+	switch (afmt)
+	{
+	case AFMT_U8:
+		p.format = FMT_8BIT;
+		break;
+	case AFMT_S16_LE:
+		p.format = FMT_16BIT;
+		break;
+	default:
+		fprintf(stderr, "oops(open): unsupported sound format\n");
+		exit(1);
+	}
+
+	if (record)
+	{
+		trigger = ~PCM_ENABLE_INPUT;
+		ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trigger);
+		trigger = PCM_ENABLE_INPUT;
+		ioctl(fd, SNDCTL_DSP_SETTRIGGER, &trigger);
+	}
+	return 0;
+
+	err: if (-1 != fd)
+		close( fd);
+	stat = STATUS_CLOSED;
+	fd = -1;
+	return -1;
+}
+
+void Soundcard::close_dev()
+{
+	close( fd);
+	fd = -1;
+	stat = STATUS_CLOSED;
+
+	return;
+}
+
+void Soundcard::setparams(struct SOUNDPARAMS *p)
+{
+	rate = p->rate;
+	channels = p->channels;
+	switch (p->format)
+	{
+	case FMT_8BIT:
+		afmt = AFMT_U8;
+		break;
+	case FMT_16BIT:
+		afmt = AFMT_S16_LE;
+		break;
+	default:
+		fprintf(stderr, "oops(set): unsupported sound format\n");
+		exit(1);
+	}
+
+	switch (stat)
+	{
+	case STATUS_RECORD:
+		close_dev();
+		open_dev( TRUE);
+		break;
+	case STATUS_PLAYBACK:
+		close_dev();
+		open_dev( FALSE);
+		break;
+	case STATUS_CLOSED:
+		if (!init_done)
+			get_capabilities();
+		if (!init_done)
+			return;
+		if (0 == open_dev(TRUE))
+			close_dev();
+		break;
+	}
+	printf("\nchannels=%d\n", channels);
+	printf("\nrate=%d\n", rate);
+	printf("\nblocksize=%d\n", blocksize);
+	printf("\nlatency=%d\n", latency);
+
+}
+
+void
+//Soundcard::sounddata(int s)
+Soundcard::sounddata(uint8_t* buf, int &size)
+{
+	int rc, have;
+
+	switch (stat)
+	{
+	case STATUS_RECORD:
+		/* read */
+		for (have = 0; have < blocksize;)
+		{
+			rc = read(fd, buf + have, blocksize - have);
+			switch (rc)
+			{
+			case -1:
+			{
+				printf("\naudio capture failed\n");
+				size = -1;
+				return;
+			}
+				break;
+			case 0:
+				fprintf(stderr, "Huh? got 0 bytes from sound device?\n");
+				exit(1);
+			default:
+				have += rc;
+			}
+		}
+		size = have;
+		break;
+	case STATUS_PLAYBACK:
+		if (-1 != fd)
+			write(fd, buffer, blocksize);
+		break;
+	}
+}

Added: incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.h?rev=885395&view=auto
==============================================================================
--- incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.h (added)
+++ incubator/bluesky/trunk/RealClass/Student/src/en_de_audio.h Mon Nov 30 12:18:34 2009
@@ -0,0 +1,309 @@
+/** \file en_de_audio.h Classes for audio operation:capture,encoder,decoder,sender,receiver
+*
+*
+*Licensed to the Apache Software Foundation (ASF) under one
+*or more contributor license agreements.  See the NOTICE file
+*distributed with this work for additional information
+*regarding copyright ownership.  The ASF licenses this file
+*to you under the Apache License, Version 2.0 (the
+*"License"); you may not use this file except in compliance
+*with the License.  You may obtain a copy of the License at
+*
+*  http://www.apache.org/licenses/LICENSE-2.0
+*
+*Unless required by applicable law or agreed to in writing,
+*software distributed under the License is distributed on an
+*"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*KIND, either express or implied.  See the License for the
+*specific language governing permissions and limitations
+*under the License. 
+*/
+
+#include "fecrtpsession.h"
+#include <iostream>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <linux/types.h>
+#include <linux/videodev.h>
+#include <time.h>
+// FFmpeg
+#include <ffmpeg/avcodec.h>
+#include <ffmpeg/avformat.h>
+// X11
+#include <X11/Intrinsic.h>
+#include <X11/XWDFile.h>
+
+// Jthread and JMutex
+#include <jthread.h>
+#include <jmutex.h>
+
+// Audio
+#include <linux/soundcard.h>
+
+#define STATUS_CLOSED    0
+#define STATUS_RECORD    1
+#define STATUS_PLAYBACK  2
+
+#define FMT_UNDEFINED  0
+#define FMT_8BIT       1          /* unsigned */
+#define FMT_16BIT      2          /* signed - native byte order */
+#define FMT_MULAW      4          /* NOT SUPPORTED (yet) */
+#define FMT_ALAW       8          /* NOT SUPPORTED (yet) */
+
+#define FMT_MAX        2
+//!sound card params
+struct SOUNDPARAMS
+{
+	int format;
+	int channels;
+	int rate;
+	int blocksize;
+	int latency;
+};
+//!sound card operation
+class Soundcard
+{
+
+public:
+	/* sound card capabilities */
+	char devname[32];
+	int init_done;
+	int afmt_hw;
+	int afmt_sw;
+	int channels_hw;
+
+	int trigger;
+	char driver_name[64];
+
+	/* current settings */
+	int afmt;
+	int channels;
+	int rate;
+	int blocksize;
+	int latency;
+
+	//!file handle
+	int fd;
+	//!reference count
+	int stat;
+	char buffer[65536];
+
+	/* internal functions */
+	//!get capabilities
+	void get_capabilities();
+	//!open device
+	int open_dev(int record);
+	//close device
+	void close_dev();
+
+public: 
+	//!constructor
+	Soundcard(const char *dev);
+	//!Destructor
+	~Soundcard();
+	//!set sound card param
+	void setparams(struct SOUNDPARAMS *params);
+	//!start record
+	int start_record();
+	// strat playback
+	int start_playback();
+
+public:
+	//!set sound data
+	void sounddata(uint8_t* buf, int &size);
+
+};
+
+#if !defined(_EN_DE_AUDIO_H__INCLUDED_)
+#define _EN_DE_AUDIO_H__INCLUDED_
+
+//!Audio decoder class.
+class CADecoder
+{
+public:
+	//!constructor
+	CADecoder();
+	//!Destructor
+	virtual ~CADecoder();
+	//!Decode a frame
+	/*!
+	\param encodeddata_a the pointer to data
+	\param encodeddatasize_a data size
+	*/
+	int DecodeProcess(uint8_t *encodeddata_a, const int encodeddatasize_a);
+	//!Initialize
+	/*!
+	\param nCodecID the specific CODEC_ID, use CODEC_ID_MP3
+	\param nOutBufSize the decoded data buffer size
+	*/
+	bool Init(enum CodecID nCodecID = CODEC_ID_MP3, int nOutBufSize =
+			A_SDLBufSize);
+private:
+	enum ADECODERBUFSIZE
+	{
+		A_SDLBufSize = AVCODEC_MAX_AUDIO_FRAME_SIZE
+	};
+	//!Param for the ENCODEC
+	enum AUDIO_DECODEC_PARA
+	{
+		AUDIO_DECODE_bit_rate = 64000,
+		AUDIO_DECODE_sample_rate = 44100,
+		A_DECODE_framerate = 25,
+		A_DECODE_frame_rate_base = 1,
+		A_DECODE_gop_size = 12
+	};
+
+	//!Bool variable to mark the initiallise
+	bool m_bInit;
+	//!AVCodec Instance to store the codec
+	AVCodec *m_pCodec;
+	//!AVCodecContext Instance to store the codec content
+	AVCodecContext *m_pCodecCtx;
+	//!Buffer to store the decoded data
+	uint8_t *m_pSDLBuf;
+
+	//!open audio device
+	bool OpenAudio();
+	//!close audio device
+	void CloseAudio();
+
+};
+//!Audio Encoder class 
+class CAEncoder
+{
+	friend class CStuAudioSender;
+public:
+	//!Constructor
+	CAEncoder();
+	//!Virtual Donstructor
+	virtual ~CAEncoder();
+	//!capture data
+	int Capture(uint8_t** pOutBuf, int &size);
+	//!Encode a frame
+	/*!
+	\param data the pointer to captured data
+	\param pOutBuf the buffer to store encoded data
+	\param nOutsize the encoded data size
+	*/
+	int EncodeProcess(uint8_t* data, uint8_t *pOutBuf[2], int nOutsize);
+	//!Initialize
+	/*!
+	\param nCodecID the specific CODEC_ID, use CODEC_ID_MP3
+	*/
+	bool Init(enum CodecID nCodecID = CODEC_ID_MP2);
+	//!Get the encoded data length
+	inline int encodelength(int i)
+	{
+		return m_encode_length[i];
+	}
+	//!Soundcard Instance
+	Soundcard m_soundcard;
+	//!Buffer for encode
+	uint8_t* m_audio_buf;
+	//!FifoBuffer to read the audio data to encode
+	FifoBuffer *m_fifo;
+private:
+	//!open audio device
+	bool OpenAudio();
+	//!close audio device
+	void CloseAudio();
+	//!Params for the ENCODEC
+	enum AUDIO_ENCODEC_PARA
+	{
+		AUDIO_ENCODE_bit_rate = 64000,
+		AUDIO_ENCODE_sample_rate = 44100,
+		A_ENCODE_framerate = 25,
+		A_ENCODE_frame_rate_base = 1,
+		A_ENCODE_gop_size = 12
+	};
+	//!Define encode buffer size
+	enum AENCODERBUFSIZE
+	{
+		A_OutBufSize = 4 * 128 * 1024
+	};//128000
+
+	//!Bool variable to mark the initiallise
+	bool m_bInit;
+	//!AVCodec Instance to store the codec
+	AVCodec *m_pCodec;
+	//!AVCodecContext Instance to store the codec content
+	AVCodecContext *m_pCodecCtx;
+	//!To store Encoded data
+	int m_encode_length[2];
+
+};
+//!Student Audio Sender class
+class CStuAudioSender: private JThread
+{
+public:
+	//!Constructor
+	CStuAudioSender();
+	//!Destructor
+	~CStuAudioSender();
+  
+	bool Init(int nPort);
+	//!Add Destination 
+	bool AddDestination(const RTPIPv4Address &des);
+	//!Clear Destinations
+	void ClearDestinations();
+	int Start(char* szFile = 0, bool bIsRecord = false);
+	//!Pause to send
+	void Pause();
+	//!Resume to send
+	void Resume();
+private:
+	//!Stop to send
+	void Stop();
+	//!sender thread
+	void *Thread();
+	//!thread stop status
+	bool stop;
+	//!mutex for the thread stop
+	JMutex stopmutex;
+private:
+	//!CAEncoder Instance
+	CAEncoder m_aencoder;
+	//!store the data
+	uint8_t *m_pOutBuf[2]; //only record endcode data 2 times
+	//!RTPSession Instance
+	RTPSession m_fecrtpsession;
+	//!mark the init status
+	int m_bInit;
+	//!mark pause status
+	bool m_sendpause;
+	//!mutex for send pause
+	JMutex m_sendpausemutex;
+};
+
+//!Audio Receiver class
+class CAudioReceiver: public RTPSession
+{
+public:
+	//!Constructor
+	CAudioReceiver();
+	//!Virtual Destructor
+	virtual ~CAudioReceiver();
+	//!Initialize
+	bool Init();
+	//!Start Receive audio data
+	int Start(int nPort);
+	//!Stop receive audio data
+	void Stop();
+
+private:
+	//!Deal with the RTPPacket
+	virtual void OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime,
+			const RTPAddress *senderaddress);
+
+private:
+	//!mark the init status
+	bool m_bInit;
+	CADecoder m_adecoder;
+};
+
+#endif // !defined(_EN_DE_AUDIO_H__INCLUDED_)



Mime
View raw message