Moved the 'video frame decoded' callback from Core to LinphoneCall

parent 9c0fb8ce
...@@ -856,8 +856,8 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u ...@@ -856,8 +856,8 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u
break; break;
case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED:
ms_message("First video frame decoded successfully"); ms_message("First video frame decoded successfully");
if (call->core->vtable.call_first_video_frame != NULL) if (call->nextVideoFrameDecoded._func != NULL)
call->core->vtable.call_first_video_frame(call->core, call); call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data);
break; break;
default: default:
ms_warning("Unhandled event %i", event_id); ms_warning("Unhandled event %i", event_id);
...@@ -866,6 +866,14 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u ...@@ -866,6 +866,14 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u
} }
#endif #endif
void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) {
call->nextVideoFrameDecoded._func = cb;
call->nextVideoFrameDecoded._user_data = user_data;
#ifdef VIDEO_ENABLED
ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION);
#endif
}
void linphone_call_init_media_streams(LinphoneCall *call){ void linphone_call_init_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core; LinphoneCore *lc=call->core;
SalMediaDescription *md=call->localdesc; SalMediaDescription *md=call->localdesc;
...@@ -1284,6 +1292,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna ...@@ -1284,6 +1292,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
cam=get_nowebcam_device(); cam=get_nowebcam_device();
} }
if (!is_inactive){ if (!is_inactive){
call->log->video_enabled = TRUE;
video_stream_set_direction (call->videostream, dir); video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
video_stream_set_device_rotation(call->videostream, lc->device_rotation); video_stream_set_device_rotation(call->videostream, lc->device_rotation);
...@@ -1342,7 +1351,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut ...@@ -1342,7 +1351,6 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
call->current_params.has_video=FALSE; call->current_params.has_video=FALSE;
if (call->videostream!=NULL) { if (call->videostream!=NULL) {
linphone_call_start_video_stream(call,cname,all_inputs_muted); linphone_call_start_video_stream(call,cname,all_inputs_muted);
call->log->video_enabled = TRUE;
} }
call->all_muted=all_inputs_muted; call->all_muted=all_inputs_muted;
......
...@@ -226,6 +226,9 @@ typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy; ...@@ -226,6 +226,9 @@ typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;
**/ **/
struct _LinphoneCall; struct _LinphoneCall;
typedef struct _LinphoneCall LinphoneCall; typedef struct _LinphoneCall LinphoneCall;
/** Callback prototype */
typedef void (*LinphoneCallCbFunc)(struct _LinphoneCall *call,void * user_data);
/** /**
* LinphoneCallState enum represents the different state a call can reach into. * LinphoneCallState enum represents the different state a call can reach into.
...@@ -287,6 +290,8 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t ...@@ -287,6 +290,8 @@ void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t
void linphone_call_send_vfu_request(LinphoneCall *call); void linphone_call_send_vfu_request(LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call); void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer); void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
/** /**
* Enables or disable echo cancellation for this call * Enables or disable echo cancellation for this call
* @param call * @param call
...@@ -614,8 +619,6 @@ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int d ...@@ -614,8 +619,6 @@ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, LinphoneCall *call, int d
typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to); typedef void (*ReferReceived)(struct _LinphoneCore *lc, const char *refer_to);
/** Callback prototype */ /** Callback prototype */
typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf);
/** Callback prototype */
typedef void (*CallFirstVideoFrameCb)(struct _LinphoneCore *lc, LinphoneCall *call);
/** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */ /** Callback prototype for in progress transfers. The new_call_state is the state of the call resulting of the transfer, at the other party. */
typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); typedef void (*LinphoneTransferStateChanged)(struct _LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
...@@ -635,8 +638,7 @@ typedef struct _LinphoneVTable{ ...@@ -635,8 +638,7 @@ typedef struct _LinphoneVTable{
DtmfReceived dtmf_received; /**< A dtmf has been received received */ DtmfReceived dtmf_received; /**< A dtmf has been received received */
ReferReceived refer_received; /**< An out of call refer was received */ ReferReceived refer_received; /**< An out of call refer was received */
CallEncryptionChangedCb call_encryption_changed; /**<Notifies on change in the encryption of call streams */ CallEncryptionChangedCb call_encryption_changed; /**<Notifies on change in the encryption of call streams */
CallFirstVideoFrameCb call_first_video_frame; /**<Notifies on first successful video frame decoding */ LinphoneTransferStateChanged transfer_state_changed; /**<Notifies when a transfer is in progress */
LinphoneTransferStateChanged transfer_state_changed; /**<Notifies when a transfer is in progress */
BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/ BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
NotifyReceivedCb notify_recv; /**< Other notifications*/ NotifyReceivedCb notify_recv; /**< Other notifications*/
DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/ DisplayStatusCb display_status; /**< Callback that notifies various events with human readable text.*/
......
...@@ -74,6 +74,12 @@ struct _LinphoneCallParams{ ...@@ -74,6 +74,12 @@ struct _LinphoneCallParams{
bool_t pad; bool_t pad;
}; };
typedef struct _CallCallbackObj
{
LinphoneCallCbFunc _func;
void * _user_data;
}CallCallbackObj;
static const int linphone_call_magic=0x3343; static const int linphone_call_magic=0x3343;
...@@ -124,6 +130,7 @@ struct _LinphoneCall ...@@ -124,6 +130,7 @@ struct _LinphoneCall
bool_t auth_token_verified; bool_t auth_token_verified;
bool_t defer_update; bool_t defer_update;
bool_t was_automatically_paused; bool_t was_automatically_paused;
CallCallbackObj nextVideoFrameDecoded;
}; };
......
mediastreamer2 @ 62417844
Subproject commit 7af64431dde94b21e0313ced873726462b4f5f32 Subproject commit 6241784466c0032b701cbb00d4ddab1db120bbf0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment