FS-7500: factor back in video_thread callback and move it to the video_read_frame
This commit is contained in:
parent
81887e9bfc
commit
a69938c3d5
|
@ -78,7 +78,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* #define DEBUG_ALLOC */
|
/* #define DEBUG_ALLOC */
|
||||||
#define DO_EVENTS
|
#define DO_EVENTS
|
||||||
|
|
||||||
|
@ -188,6 +187,8 @@ struct switch_core_session {
|
||||||
|
|
||||||
switch_media_handle_t *media_handle;
|
switch_media_handle_t *media_handle;
|
||||||
uint32_t decoder_errors;
|
uint32_t decoder_errors;
|
||||||
|
switch_core_video_thread_callback_func_t *video_read_callback;
|
||||||
|
void *video_read_user_data;
|
||||||
switch_slin_data_t *sdata;
|
switch_slin_data_t *sdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2313,6 +2313,11 @@ SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, sw
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
|
SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session,
|
||||||
|
switch_core_video_thread_callback_func_t func, void *user_data);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_session_video_read_callback(switch_core_session_t *session, switch_frame_t *frame);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void);
|
SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void);
|
||||||
SWITCH_DECLARE(const char *) switch_core_mime_ext2type(const char *ext);
|
SWITCH_DECLARE(const char *) switch_core_mime_ext2type(const char *ext);
|
||||||
SWITCH_DECLARE(const char *) switch_core_mime_type2ext(const char *type);
|
SWITCH_DECLARE(const char *) switch_core_mime_type2ext(const char *type);
|
||||||
|
|
|
@ -2163,6 +2163,7 @@ typedef struct switch_console_callback_match switch_console_callback_match_t;
|
||||||
|
|
||||||
typedef void (*switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data);
|
typedef void (*switch_media_bug_exec_cb_t)(switch_media_bug_t *bug, void *user_data);
|
||||||
|
|
||||||
|
typedef switch_status_t (switch_core_video_thread_callback_func_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data);
|
||||||
typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
|
typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
|
||||||
typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
|
typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
|
||||||
typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
|
typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
|
||||||
|
|
|
@ -9969,6 +9969,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_core_session_video_read_callback(session, *frame);
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3069,6 +3069,31 @@ SWITCH_DECLARE(void) switch_core_session_raw_read(switch_core_session_t *session
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session,
|
||||||
|
switch_core_video_thread_callback_func_t func, void *user_data)
|
||||||
|
{
|
||||||
|
if (!func) {
|
||||||
|
session->video_read_callback = NULL;
|
||||||
|
session->video_read_user_data = NULL;
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
} else if (session->video_read_callback) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
} else {
|
||||||
|
session->video_read_callback = func;
|
||||||
|
session->video_read_user_data = user_data;
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_session_video_read_callback(switch_core_session_t *session, switch_frame_t *frame)
|
||||||
|
{
|
||||||
|
if (session->video_read_callback) {
|
||||||
|
return session->video_read_callback(session, frame, session->video_read_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* mode:c
|
* mode:c
|
||||||
|
|
Loading…
Reference in New Issue