set icon and title on video window too.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@216 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
smorlat 2009-01-03 15:34:55 +00:00
parent 13c66482e4
commit 0cc94ad35b
8 changed files with 318 additions and 232 deletions

View file

@ -2034,6 +2034,14 @@ const char *linphone_core_get_video_device(const LinphoneCore *lc){
return NULL;
}
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){
if (lc->videostream)
return video_stream_get_native_window_id(lc->videostream);
if (lc->previewstream)
return video_stream_get_native_window_id(lc->previewstream);
return 0;
}
static MSVideoSizeDef supported_resolutions[]={
{ MS_VIDEO_SIZE_SVGA , "svga" },
{ MS_VIDEO_SIZE_4CIF , "4cif" },

View file

@ -702,7 +702,8 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc);
int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
const char *linphone_core_get_video_device(const LinphoneCore *lc);
/*function to be used for eventually setting window decorations (icons, title...)*/
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
/*play/record support: use files instead of soundcard*/

View file

@ -246,8 +246,39 @@ void linphone_gtk_show_about(){
gtk_widget_show(about);
}
static void set_video_window_decorations(GdkWindow *w){
const char *title=linphone_gtk_get_ui_config("title","Linphone");
const char *icon_path=linphone_gtk_get_ui_config("icon","linphone2.png");
char video_title[256];
GdkPixbuf *pbuf=create_pixbuf(icon_path);
snprintf(video_title,sizeof(video_title),"%s video",title);
gdk_window_set_title(w,video_title);
if (pbuf){
GList *l=NULL;
l=g_list_append(l,pbuf);
gdk_window_set_icon_list(w,l);
g_list_free(l);
g_object_unref(G_OBJECT(pbuf));
}
}
static gboolean linphone_gtk_iterate(LinphoneCore *lc){
unsigned long id;
static unsigned long previd=0;
linphone_core_iterate(lc);
id=linphone_core_get_native_video_window_id(lc);
if (id!=previd){
GdkWindow *w;
previd=id;
if (id!=0){
w=gdk_window_foreign_new(id);
if (w) {
set_video_window_decorations(w);
g_object_unref(G_OBJECT(w));
}
else ms_error("gdk_window_foreign_new() failed");
}
}
return TRUE;
}
@ -693,18 +724,21 @@ static void linphone_gtk_check_menu_items(void){
static void linphone_gtk_configure_main_window(){
static gboolean config_loaded=FALSE;
static gboolean show_digits=1;
static gboolean show_identities=1;
static const char *title;
static const char *home;
static const char *icon_path;
GtkWidget *w=linphone_gtk_get_main_window();
if (!config_loaded){
show_digits=linphone_gtk_get_ui_config_int("show_digits",1);
show_identities=linphone_gtk_get_ui_config_int("identity_frame",1);
title=linphone_gtk_get_ui_config("title",NULL);
home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
icon_path=linphone_gtk_get_ui_config("icon",NULL);
config_loaded=TRUE;
}
if (show_digits==0) gtk_widget_hide(linphone_gtk_get_widget(w,"dialpad"));
if (show_digits==FALSE) gtk_widget_hide(linphone_gtk_get_widget(w,"dialpad"));
if (show_identities==FALSE) gtk_widget_hide(linphone_gtk_get_widget(w,"identity_frame"));
if (title) gtk_window_set_title(GTK_WINDOW(w),title);
if (icon_path) {
GdkPixbuf *pbuf=create_pixbuf(icon_path);

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Sun Dec 28 23:41:16 2008 -->
<!--Generated with glade3 3.4.5 on Tue Dec 30 16:01:16 2008 -->
<glade-interface>
<widget class="GtkWindow" id="main">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -426,235 +426,17 @@ Online users</property>
<property name="n_columns">4</property>
<property name="homogeneous">True</property>
<child>
<widget class="GtkButton" id="dtmf_1">
<widget class="GtkButton" id="dtmf_D">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">1</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">2</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">3</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_A">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">A</property>
<property name="label" translatable="yes">D</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">4</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">5</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">6</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_B">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">B</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">7</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">8</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">9</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_C">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">C</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_star">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">*</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_0">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">0</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
@ -680,19 +462,237 @@ Online users</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_D">
<widget class="GtkButton" id="dtmf_0">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">D</property>
<property name="label" translatable="yes">0</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_star">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">*</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_C">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">C</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">9</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">8</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">7</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_B">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">B</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_6">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">6</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">5</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">4</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_A">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">A</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">3</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">2</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="dtmf_1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">1</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -729,7 +729,7 @@ Online users</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame8">
<widget class="GtkFrame" id="identity_frame">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>

View file

@ -142,6 +142,8 @@ void video_stream_send_vfu(VideoStream *stream);
void video_stream_stop(VideoStream * stream);
void video_stream_set_sent_video_size(VideoStream *stream, MSVideoSize vsize);
void video_stream_enable_self_view(VideoStream *stream, bool_t val);
unsigned long video_stream_get_native_window_id(VideoStream *stream);
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize vsize);
void video_preview_stop(VideoStream *stream);

View file

@ -52,6 +52,7 @@ typedef struct _MSDisplay{
MSDisplayDesc *desc;
long window_id; /*window id if the display should use an existing window*/
void *data;
bool_t use_external_window;
} MSDisplay;
@ -94,6 +95,7 @@ void ms_display_destroy(MSDisplay *d);
#define MS_VIDEO_OUT_SET_CORNER MS_FILTER_METHOD(MS_VIDEO_OUT_ID,2,int)
#define MS_VIDEO_OUT_AUTO_FIT MS_FILTER_METHOD(MS_VIDEO_OUT_ID,3,int)
#define MS_VIDEO_OUT_ENABLE_MIRRORING MS_FILTER_METHOD(MS_VIDEO_OUT_ID,4,int)
#define MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID MS_FILTER_METHOD(MS_VIDEO_OUT_ID,5,unsigned long)
#ifdef __cplusplus
}

View file

@ -53,6 +53,17 @@ static SDL_Surface *sdl_screen=0;
#include <SDL/SDL_syswm.h>
static long sdl_get_native_window_id(){
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if ( SDL_GetWMInfo(&info) ) {
if ( info.subsystem == SDL_SYSWM_X11 ) {
return (long) info.info.x11.wmwindow;
}
}
return 0;
}
static void sdl_show_window(bool_t show){
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
@ -79,6 +90,11 @@ static void sdl_show_window(bool_t show){
ms_warning("SDL window show/hide not implemented");
}
static long sdl_get_native_window_id(){
ms_warning("sdl_get_native_window_id not implemented");
return 0;
}
#endif
static void sdl_display_uninit(MSDisplay *obj);
@ -92,7 +108,7 @@ static SDL_Overlay * sdl_create_window(int w, int h){
return NULL;
}
if (sdl_screen->flags & SDL_HWSURFACE) ms_message("SDL surface created in hardware");
SDL_WM_SetCaption("Linphone Video", NULL);
SDL_WM_SetCaption("Video window", NULL);
ms_message("Using yuv overlay.");
lay=SDL_CreateYUVOverlay(w , h ,SDL_YV12_OVERLAY,sdl_screen);
if (lay==NULL){
@ -137,6 +153,7 @@ static bool_t sdl_display_init(MSDisplay *obj, MSPicture *fbuf){
fbuf->h=lay->h;
obj->data=lay;
sdl_show_window(TRUE);
obj->window_id=sdl_get_native_window_id();
return TRUE;
}
return FALSE;
@ -207,7 +224,7 @@ MSDisplayDesc ms_sdl_display_desc={
.unlock=sdl_display_unlock,
.update=sdl_display_update,
.uninit=sdl_display_uninit,
.pollevent=sdl_poll_event
.pollevent=sdl_poll_event,
};
#elif defined(WIN32)
@ -325,7 +342,7 @@ static bool_t win_display_init(MSDisplay *obj, MSPicture *fbuf){
wd->fb.h=fbuf->h;
if (wd->window==NULL){
if (obj->window_id!=0){
if (obj->use_external_window && obj->window_id!=0){
void *p;
wd->window=(HWND)obj->window_id;
p=(void*)GetWindowLongPtr(wd->window,GWLP_USERDATA);
@ -335,10 +352,11 @@ static bool_t win_display_init(MSDisplay *obj, MSPicture *fbuf){
}else SetWindowLongPtr(wd->window,GWLP_USERDATA,(LONG_PTR)obj);
}else{
wd->window=create_window(wd->fb.w,wd->fb.h);
obj->window_id=wd->window;
if (wd->window!=NULL) SetWindowLongPtr(wd->window,GWLP_USERDATA,(LONG_PTR)obj);
else return FALSE;
}
}else if (obj->window_id==0){
}else if (!obj->use_external_window){
/* the window might need to be resized*/
RECT cur;
GetWindowRect(wd->window,&cur);
@ -488,6 +506,7 @@ MSDisplay *ms_display_new(MSDisplayDesc *desc){
void ms_display_set_window_id(MSDisplay *d, long id){
d->window_id=id;
d->use_external_window=TRUE;
}
void ms_display_destroy(MSDisplay *obj){
@ -827,6 +846,17 @@ static int video_out_enable_mirroring(MSFilter *f,void *arg){
return 0;
}
static int video_out_get_native_window_id(MSFilter *f, void*arg){
VideoOut *s=(VideoOut*)f->data;
unsigned long *id=(unsigned long*)arg;
*id=0;
if (s->display){
*id=s->display->window_id;
return 0;
}
return -1;
}
static MSFilterMethod methods[]={
{ MS_FILTER_SET_VIDEO_SIZE , video_out_set_vsize },
{ MS_VIDEO_OUT_SET_DISPLAY , video_out_set_display},
@ -834,6 +864,7 @@ static MSFilterMethod methods[]={
{ MS_VIDEO_OUT_AUTO_FIT , video_out_auto_fit},
{ MS_VIDEO_OUT_HANDLE_RESIZING , video_out_handle_resizing},
{ MS_VIDEO_OUT_ENABLE_MIRRORING , video_out_enable_mirroring},
{ MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID, video_out_get_native_window_id},
{ 0 ,NULL}
};

View file

@ -345,6 +345,14 @@ void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const
}
}
unsigned long video_stream_get_native_window_id(VideoStream *stream){
unsigned long id;
if (stream->output){
if (ms_filter_call_method(stream->output,MS_VIDEO_OUT_GET_NATIVE_WINDOW_ID,&id)==0)
return id;
}
return 0;
}
VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){