ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
}
+ #define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION
+
+ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){
+ LinphoneCore *lc=call->core;
+ int jitt_comp=lc->rtp_conf.audio_jitt_comp;
+ int used_pt=-1;
+ const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
+ SalProtoRtpAvp,SalAudio);
+
+ if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
+ MSSndCard *playcard=lc->sound_conf.lsd_card ?
+ lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
+ MSSndCard *captcard=lc->sound_conf.capt_sndcard;
+ const char *playfile=lc->play_file;
+ const char *recfile=lc->rec_file;
+ call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt);
+ bool_t use_ec;
+
+ if (used_pt!=-1){
+ if (playcard==NULL) {
+ ms_warning("No card defined for playback !");
+ }
+ if (captcard==NULL) {
+ ms_warning("No card defined for capture !");
+ }
+ /*Replace soundcard filters by inactive file players or recorders
+ when placed in recvonly or sendonly mode*/
+ if (stream->port==0 || stream->dir==SalStreamRecvOnly){
+ captcard=NULL;
+ playfile=NULL;
+ }else if (stream->dir==SalStreamSendOnly){
+ playcard=NULL;
+ captcard=NULL;
+ recfile=NULL;
+ /*And we will eventually play "playfile" if set by the user*/
+ /*playfile=NULL;*/
+ }
+ if (send_ringbacktone){
+ captcard=NULL;
+ playfile=NULL;/* it is setup later*/
+ }
+ /*if playfile are supplied don't use soundcards*/
+ if (lc->use_files) {
+ captcard=NULL;
+ playcard=NULL;
+ }
+ if (call->params.in_conference){
+ /* first create the graph without soundcard resources*/
+ captcard=playcard=NULL;
+ }
+ use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc);
+
+ audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc);
+ audio_stream_start_full(
+ call->audiostream,
+ call->audio_profile,
+ stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
+ stream->port,
+ stream->port+1,
+ used_pt,
+ jitt_comp,
+ playfile,
+ recfile,
+ playcard,
+ captcard,
+ use_ec
+ );
+ post_configure_audio_streams(call);
+ if (muted && !send_ringbacktone){
+ audio_stream_set_mic_gain(call->audiostream,0);
+ }
+ if (stream->dir==SalStreamSendOnly && playfile!=NULL){
+ int pause_time=500;
+ ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
+ }
+ if (send_ringbacktone){
+ setup_ring_player(lc,call);
+ }
+ audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL);
+ if (call->params.in_conference){
+ /*transform the graph to connect it to the conference filter */
+ linphone_call_add_to_conf(call);
+ }
+ }else ms_warning("No audio stream accepted ?");
+ }
+ }
+
+ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){
+ #ifdef VIDEO_ENABLED
+ LinphoneCore *lc=call->core;
+ int used_pt=-1;
+ const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc,
+ SalProtoRtpAvp,SalVideo);
+ /* shutdown preview */
+ if (lc->previewstream!=NULL) {
+ video_preview_stop(lc->previewstream);
+ lc->previewstream=NULL;
+ }
+ call->current_params.has_video=FALSE;
+ if (vstream && vstream->dir!=SalStreamInactive && vstream->port!=0) {
+ const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
+ call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
+ if (used_pt!=-1){
+ VideoStreamDir dir=VideoStreamSendRecv;
+ MSWebCam *cam=lc->video_conf.device;
+ bool_t is_inactive=FALSE;
+
+ call->current_params.has_video=TRUE;
+
+ video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
+ video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
+ if (lc->video_window_id!=0)
+ video_stream_set_native_window_id(call->videostream,lc->video_window_id);
+ if (lc->preview_window_id!=0)
+ video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
+ video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
+
+ if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
+ cam=get_nowebcam_device();
+ dir=VideoStreamSendOnly;
+ }else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){
+ dir=VideoStreamRecvOnly;
+ }else if (vstream->dir==SalStreamSendRecv){
+ if (lc->video_conf.display && lc->video_conf.capture)
+ dir=VideoStreamSendRecv;
+ else if (lc->video_conf.display)
+ dir=VideoStreamRecvOnly;
+ else
+ dir=VideoStreamSendOnly;
+ }else{
+ ms_warning("video stream is inactive.");
+ /*either inactive or incompatible with local capabilities*/
+ is_inactive=TRUE;
+ }
+ if (call->camera_active==FALSE || all_inputs_muted){
+ cam=get_nowebcam_device();
+ }
+ if (!is_inactive){
+ video_stream_set_direction (call->videostream, dir);
++ ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
++ video_stream_set_device_rotation(call->videostream, lc->device_rotation);
+ video_stream_start(call->videostream,
+ call->video_profile, addr, vstream->port,
+ vstream->port+1,
+ used_pt, lc->rtp_conf.audio_jitt_comp, cam);
+ video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL);
+ }
+ }else ms_warning("No video stream accepted.");
+ }else{
+ ms_warning("No valid video stream defined.");
+ }
+ #endif
+ }
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){
LinphoneCore *lc=call->core;
gtk_status_icon_set_visible(icon,TRUE);
g_object_set_data(G_OBJECT(icon),"menu",menu);
g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)gtk_widget_destroy,menu);
- tout=g_timeout_add(1000,(GSourceFunc)do_icon_blink,icon);
+ g_object_set_data(G_OBJECT(icon),"icon",pbuf);
+ g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)g_object_unref,pbuf);
+ pbuf=create_pixbuf(call_icon_path);
+ g_object_set_data(G_OBJECT(icon),"call_icon",pbuf);
+ }
+
+ static gboolean do_icon_blink(GtkStatusIcon *gi){
+ GdkPixbuf *call_icon=g_object_get_data(G_OBJECT(gi),"call_icon");
+ GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(gi),"icon");
+ GdkPixbuf *cur_icon=gtk_status_icon_get_pixbuf(gi);
+ if (cur_icon==call_icon){
+ gtk_status_icon_set_from_pixbuf(gi,normal_icon);
+ }else{
+ gtk_status_icon_set_from_pixbuf(gi,call_icon);
+ }
+ return TRUE;
+ }
+
+ static void linphone_gtk_status_icon_set_blinking(gboolean val){
+ guint tout;
+ tout=(unsigned)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(icon),"timeout"));
+ if (val && tout==0){
++ tout=g_timeout_add(500,(GSourceFunc)do_icon_blink,icon);
+ g_object_set_data(G_OBJECT(icon),"timeout",GINT_TO_POINTER(tout));
+ }else if (!val && tout!=0){
+ GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(icon),"icon");
+ g_source_remove(tout);
+ g_object_set_data(G_OBJECT(icon),"timeout",NULL);
+ gtk_status_icon_set_from_pixbuf(icon,normal_icon);
+ }
}
+static void init_identity_combo(GtkComboBox *box){
+ GtkListStore *store;
+ GtkCellRenderer *r1,*r2;
+ store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_POINTER);
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(box));
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(box),(r1=gtk_cell_renderer_text_new()),TRUE);
+ gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(box),(r2=gtk_cell_renderer_pixbuf_new()),FALSE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(box),r1,"text",0);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(box),r2,"stock-id",1);
+ g_object_set(G_OBJECT(r1),"ellipsize",PANGO_ELLIPSIZE_END,NULL);
+ gtk_combo_box_set_model(box,GTK_TREE_MODEL(store));
+}
+
void linphone_gtk_load_identities(void){
const MSList *elem;
GtkComboBox *box=GTK_COMBO_BOX(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"identities"));
/**
* Streams running
*/
- StreamsRunning(7, "StreamsRunning"),
+ public final static State StreamsRunning = new State(ID_STREAMS_RUNNING,"StreamsRunning");
/**
- * Paussing
+ * Pausing
*/
- Pausing(8, "Pausing"),
+ public final static State Pausing = new State(8,"Pausing");
/**
* Paused
*/
/**
* The call object is now released.
*/
- CallReleased(18,"CallReleased");
+ public static final State CallReleased = new State(18,"CallReleased");
-
- private final int mValue;
- private final String mStringValue;
- private State(int v, String desc) {
- this.mValue = v;
- this.mStringValue = desc;
+ @SuppressWarnings("unchecked")
+ private State(int value,String stringValue) {
+ mValue = value;
+ values.addElement(this);
+ mStringValue=stringValue;
}
+
public static State fromInt(int value) {
- State[] allStates = State.values();
- for (int i=0; i<allStates.length;i++) {
- if (allStates[i].mValue == value)
- return allStates[i];
+
+ for (int i=0; i<values.size();i++) {
+ State state = (State) values.elementAt(i);
+ if (state.mValue == value) return state;
}
throw new RuntimeException("state not found ["+value+"]");
}