diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 6cee394d7..94ebefcaf 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2744,12 +2744,12 @@ static void linphone_call_start_video_stream(LinphoneCall *call, bool_t all_inpu video_stream_set_fps(call->videostream,linphone_core_get_preferred_framerate(lc)); 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 (call->video_window_id != 0) - video_stream_set_native_window_id(call->videostream,call->video_window_id); - else 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); + if (call->video_window_id != NULL) + video_stream_set_native_window_id(call->videostream, call->video_window_id); + else if (lc->video_window_id != NULL) + video_stream_set_native_window_id(call->videostream, lc->video_window_id); + if (lc->preview_window_id != NULL) + 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 (is_multicast){ @@ -4041,7 +4041,7 @@ void linphone_call_cancel_dtmfs(LinphoneCall *call) { } } -unsigned long linphone_call_get_native_video_window_id(const LinphoneCall *call) { +void * linphone_call_get_native_video_window_id(const LinphoneCall *call) { if (call->video_window_id) { /* The video id was previously set by the app. */ return call->video_window_id; @@ -4055,7 +4055,7 @@ unsigned long linphone_call_get_native_video_window_id(const LinphoneCall *call) return 0; } -void linphone_call_set_native_video_window_id(LinphoneCall *call, unsigned long id) { +void linphone_call_set_native_video_window_id(LinphoneCall *call, void *id) { call->video_window_id = id; #ifdef VIDEO_ENABLED if (call->videostream) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 5a3e6d2b1..5f4a2ccf8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4973,7 +4973,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){ video_preview_set_size(lc->previewstream,vsize); if (display_filter) video_preview_set_display_filter_name(lc->previewstream,display_filter); - if (lc->preview_window_id!=0) + if (lc->preview_window_id != NULL) video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id); video_preview_set_fps(lc->previewstream,linphone_core_get_preferred_framerate(lc)); video_preview_start(lc->previewstream,lc->video_conf.device); @@ -5273,7 +5273,7 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc) { * * @ingroup media_parameters **/ -unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){ +void * linphone_core_get_native_video_window_id(const LinphoneCore *lc){ if (lc->video_window_id) { /* case where the video id was previously set by the app*/ return lc->video_window_id; @@ -5289,13 +5289,17 @@ unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){ } /* unsets the video id for all calls (indeed it may be kept by filters or videostream object itself by paused calls)*/ -static void unset_video_window_id(LinphoneCore *lc, bool_t preview, unsigned long id){ +static void unset_video_window_id(LinphoneCore *lc, bool_t preview, void *id){ #ifdef VIDEO_ENABLED LinphoneCall *call; MSList *elem; #endif - if (id!=0 && id!=-1) { + if ((id != NULL) +#ifndef _WIN32 + && ((unsigned long)id != (unsigned long)-1) +#endif + ){ ms_error("Invalid use of unset_video_window_id()"); return; } @@ -5317,8 +5321,12 @@ static void unset_video_window_id(LinphoneCore *lc, bool_t preview, unsigned lon * Set the native video window id where the video is to be displayed. * For MacOS, Linux, Windows: if not set or zero the core will create its own window, unless the special id -1 is given. **/ -void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id){ - if (id==0 || id==(unsigned long)-1){ +void linphone_core_set_native_video_window_id(LinphoneCore *lc, void *id){ + if ((id == NULL) +#ifndef _WIN32 + || ((unsigned long)id == (unsigned long)-1) +#endif + ){ unset_video_window_id(lc,FALSE,id); } lc->video_window_id=id; @@ -5337,7 +5345,7 @@ void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id * * @ingroup media_parameters **/ -unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc){ +void * linphone_core_get_native_preview_window_id(const LinphoneCore *lc){ if (lc->preview_window_id){ /*case where the id was set by the app previously*/ return lc->preview_window_id; @@ -5360,8 +5368,8 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc) * This has to be used in conjonction with linphone_core_use_preview_window(). * MacOS, Linux, Windows: if not set or zero the core will create its own window, unless the special id -1 is given. **/ -void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){ - if (id==0 || id==(unsigned long)-1){ +void linphone_core_set_native_preview_window_id(LinphoneCore *lc, void *id){ + if (id == NULL || id==(unsigned long)-1){ unset_video_window_id(lc,TRUE,id); } lc->preview_window_id=id; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 54f3c2424..55f16a173 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -606,7 +606,7 @@ LINPHONE_PUBLIC void linphone_player_destroy(LinphonePlayer *obj); * @param window_id Id of the drawing window. Depend of video out * @return A pointer on the new instance. NULL if faild. */ -LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, unsigned long window_id); +LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id); /** * @brief Check whether Matroksa format is supported by the player @@ -774,14 +774,14 @@ LINPHONE_PUBLIC void linphone_call_cancel_dtmfs(LinphoneCall *call); * Get the native window handle of the video window, casted as an unsigned long. * @ingroup media_parameters **/ -LINPHONE_PUBLIC unsigned long linphone_call_get_native_video_window_id(const LinphoneCall *call); +LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call); /** * Set the native video window id where the video is to be displayed. * For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given. * @ingroup media_parameters **/ -LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, unsigned long id); +LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id); /** * Return TRUE if this call is currently part of a conference @@ -3604,11 +3604,11 @@ LINPHONE_PUBLIC int linphone_core_set_static_picture_fps(LinphoneCore *lc, float LINPHONE_PUBLIC float linphone_core_get_static_picture_fps(LinphoneCore *lc); /*function to be used for eventually setting window decorations (icons, title...)*/ -LINPHONE_PUBLIC unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc); -LINPHONE_PUBLIC void linphone_core_set_native_video_window_id(LinphoneCore *lc, unsigned long id); +LINPHONE_PUBLIC void * linphone_core_get_native_video_window_id(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_set_native_video_window_id(LinphoneCore *lc, void *id); -LINPHONE_PUBLIC unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc); -LINPHONE_PUBLIC void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id); +LINPHONE_PUBLIC void * linphone_core_get_native_preview_window_id(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_set_native_preview_window_id(LinphoneCore *lc, void *id); /** * Tells the core to use a separate window for local camera preview video, instead of diff --git a/coreapi/localplayer.c b/coreapi/localplayer.c index 964c1c920..eb53eb640 100644 --- a/coreapi/localplayer.c +++ b/coreapi/localplayer.c @@ -32,7 +32,7 @@ static void _local_player_close(LinphonePlayer *obj); static void _local_player_destroy(LinphonePlayer *obj); static void _local_player_eof_callback(void *user_data); -LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, unsigned long window_id) { +LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id) { LinphonePlayer *obj = ms_new0(LinphonePlayer, 1); if(snd_card == NULL) snd_card = lc->sound_conf.ring_sndcard; if(video_out == NULL) video_out = linphone_core_get_video_display_filter(lc); diff --git a/coreapi/private.h b/coreapi/private.h index f6a3ef131..5366b9699 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -252,7 +252,7 @@ struct _LinphoneCall{ StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/ struct _AudioStream *audiostream; /**/ struct _VideoStream *videostream; - unsigned long video_window_id; + void *video_window_id; MSAudioEndpoint *endpoint; /*used for conferencing*/ char *refer_to; LinphoneCallParams *params; @@ -784,8 +784,8 @@ struct _LinphoneCore int audio_bw; /*IP bw consumed by audio codec, set as soon as used codec is known, its purpose is to know the remaining bw for video*/ LinphoneCoreWaitingCallback wait_cb; void *wait_ctx; - unsigned long video_window_id; - unsigned long preview_window_id; + void *video_window_id; + void *preview_window_id; time_t netup_time; /*time when network went reachable */ struct _EcCalibrator *ecc; MSList *hooks;