mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 20:51:58 +00:00
FS-7500: another refactoring pass, temp code still in place, WORK IN PROGRESS
This commit is contained in:
@@ -191,7 +191,7 @@ struct switch_core_session {
|
||||
switch_core_video_thread_callback_func_t *_video_thread_callback;
|
||||
void *_video_thread_user_data;
|
||||
//switch_time_t last_video_write_time;
|
||||
|
||||
|
||||
switch_image_write_callback_t image_write_callback;
|
||||
void *image_write_callback_user_data;
|
||||
};
|
||||
|
||||
@@ -169,10 +169,6 @@ typedef enum {
|
||||
DS_INVALID,
|
||||
} dtls_state_t;
|
||||
|
||||
typedef switch_status_t (switch_core_video_thread_callback_func_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data);
|
||||
|
||||
|
||||
|
||||
#define MESSAGE_STAMP_FFL(_m) _m->_file = __FILE__; _m->_func = __SWITCH_FUNC__; _m->_line = __LINE__
|
||||
|
||||
#define MESSAGE_STRING_ARG_MAX 10
|
||||
@@ -1274,18 +1270,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Write a video image to a session using a video frame
|
||||
\param session the session to write to
|
||||
\param frame a pointer to a frame to use for write with proper codec
|
||||
\param img the image structure with the image data
|
||||
\param the size for packetization
|
||||
\param flag pointer to frame flags to pass in / out
|
||||
\return SWITCH_STATUS_SUCCESS a if the image was written
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_image(switch_core_session_t *session, switch_frame_t *frame,
|
||||
switch_image_t *img, switch_size_t size, uint32_t *flag);
|
||||
/*!
|
||||
\brief set a callback to be called after each frame of an image is written
|
||||
\param session the session to write to
|
||||
@@ -1643,16 +1627,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
|
||||
/*!
|
||||
\brief Encode video data using a codec handle
|
||||
\param codec the codec handle to use
|
||||
\param img the img in I420 format
|
||||
\param encoded_data the buffer to write the encoded data to
|
||||
\param encoded_data_len the size of the encoded_data buffer
|
||||
\param flag flags to exchange
|
||||
\return SWITCH_STATUS_SUCCESS if the data was encoded
|
||||
\note encoded_data_len will be rewritten to the in-use size of encoded_data
|
||||
\param frame the frame to encode
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *codec,
|
||||
switch_image_t *img,
|
||||
void *encoded_data, uint32_t *encoded_data_len, unsigned int *flag);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *codec, switch_frame_t *frame);
|
||||
|
||||
|
||||
/*!
|
||||
\brief send control data using a codec handle
|
||||
@@ -1679,10 +1657,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
|
||||
\param flag flags to exchange
|
||||
\return SWITCH_STATUS_SUCCESS if the data was decoded, and a non-NULL img
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_decode_video(switch_codec_t *codec,
|
||||
switch_frame_t *frame,
|
||||
switch_image_t **img, unsigned int *flag);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_decode_video(switch_codec_t *codec, switch_frame_t *frame);
|
||||
|
||||
/*!
|
||||
\brief Destroy an initalized codec handle
|
||||
@@ -2340,34 +2315,6 @@ 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);
|
||||
|
||||
/*!
|
||||
\brief Set a callback to let the core video thread call us
|
||||
\param session the session
|
||||
\param func to callback
|
||||
\param private user data
|
||||
\return SWITCH_STATUS_CONTINUE | SWITCH_STATUS_SUCCESS | SWITCH_STATUS_BREAK | SWITCH_STATUS_*
|
||||
|
||||
If returns SWITCH_STATUS_CONTINUE, it will continues to run furthur code (read/write) in the core video thread,
|
||||
that is to say, if the callback func to nothing and just returns SWITCH_STATUS_CONTINUE, it remains the default behaviour,
|
||||
Return SWITCH_STATUS_SUCCESS to skip the default behaviour
|
||||
Return SWITCH_STATUS_BREAK will break the loop and end the video thread
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_thread_callback(switch_core_session_t *session, switch_core_video_thread_callback_func_t *func, void *user_data);
|
||||
|
||||
/*!
|
||||
\brief Set a callback to let the core video thread call us
|
||||
\param session the session
|
||||
\param the current video frame
|
||||
\param private user data
|
||||
\return SWITCH_STATUS_CONTINUE or SWITCH_STATUS_SUCCESS
|
||||
|
||||
If returns SWITCH_STATUS_CONTINUE, it will continues to run furthur code (read/write) in the core video thread,
|
||||
that is to say, if the callback func to nothing and just returns SWITCH_STATUS_CONTINUE, it remains the default behaviour,
|
||||
Return SWITCH_STATUS_SUCCESS to skip the default behaviour
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_video_thread_callback(switch_core_session_t *session, switch_frame_t *frame);
|
||||
|
||||
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_type2ext(const char *type);
|
||||
|
||||
@@ -150,7 +150,7 @@ typedef struct switch_core_media_params_s {
|
||||
/* a core_video_thread will be started automatically
|
||||
when uses rtp based media,
|
||||
external_video_source should be set to SWITCH_TRUE and
|
||||
switch_core_media_start_video_thread()
|
||||
switch_core_session_start_video_thread()
|
||||
should be explicitly called to start the video thread
|
||||
if uses the media handle for non-rtp based media
|
||||
*/
|
||||
@@ -266,11 +266,6 @@ SWITCH_DECLARE(void) switch_core_media_deinit(void);
|
||||
SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(void) switch_core_session_wake_video_thread(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(void) switch_core_session_clear_crypto(switch_core_session_t *session);
|
||||
<<<<<<< HEAD
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_start_video_thread(switch_core_session_t *session);
|
||||
=======
|
||||
SWITCH_DECLARE(switch_status_t) start_core_video_thread(switch_core_session_t *session);
|
||||
>>>>>>> allow using the video thread externally - e.g. non rtp based video
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core_session_t *session,
|
||||
switch_media_type_t type,
|
||||
@@ -314,7 +309,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_timer_t *) switch_core_media_get_timer(switch_core_session_t *session, switch_media_type_t mtype);
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_media_start_video_function(switch_core_session_t *session, switch_video_function_t video_function, void *user_data);
|
||||
SWITCH_DECLARE(void) switch_core_media_end_video_function(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_start_video_thread(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(int) switch_core_media_check_video_function(switch_core_session_t *session);
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
|
||||
@@ -74,6 +74,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
switch_frame_flag_t flags;
|
||||
void *user_data;
|
||||
payload_map_t *pmap;
|
||||
switch_image_t *img;
|
||||
};
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
@@ -1450,6 +1450,7 @@ typedef enum {
|
||||
CF_BYPASS_MEDIA_AFTER_HOLD,
|
||||
CF_HANGUP_HELD,
|
||||
CF_CONFERENCE_RESET_MEDIA,
|
||||
CF_VIDEO_DECODED_READ,
|
||||
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
||||
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
||||
CF_FLAG_MAX
|
||||
@@ -1496,7 +1497,8 @@ typedef enum {
|
||||
SFF_MARKER = (1 << 11),
|
||||
SFF_WAIT_KEY_FRAME = (1 << 12),
|
||||
SFF_RAW_RTP_PARSE_FRAME = (1 << 13),
|
||||
SFF_PICTURE_RESET = (1 << 14)
|
||||
SFF_PICTURE_RESET = (1 << 14),
|
||||
SFF_SAME_IMAGE = (1 << 15)
|
||||
} switch_frame_flag_enum_t;
|
||||
typedef uint32_t switch_frame_flag_t;
|
||||
|
||||
@@ -2154,6 +2156,8 @@ typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void
|
||||
typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
|
||||
typedef struct switch_xml_binding switch_xml_binding_t;
|
||||
|
||||
typedef void (*switch_video_function_t) (switch_core_session_t *session, void *user_data);
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *decoded_data,
|
||||
@@ -2169,13 +2173,9 @@ typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *code
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_video_encode_func_t) (switch_codec_t *codec,
|
||||
switch_image_t *img,
|
||||
void *encoded_data, uint32_t *encoded_data_len, unsigned int *flag);
|
||||
typedef switch_status_t (*switch_core_codec_video_encode_func_t) (switch_codec_t *codec, switch_frame_t *frame);
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_video_decode_func_t) (switch_codec_t *codec,
|
||||
switch_frame_t *frame,
|
||||
switch_image_t **img, unsigned int *flag);
|
||||
typedef switch_status_t (*switch_core_codec_video_decode_func_t) (switch_codec_t *codec, switch_frame_t *frame);
|
||||
|
||||
typedef enum {
|
||||
SCC_VIDEO_REFRESH = 0
|
||||
|
||||
Reference in New Issue
Block a user