From cb9232b3ab413fae7bcc2b94abd70f18ca02b263 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期二, 03 十二月 2024 11:20:32 +0800
Subject: [PATCH] 增加铃声;增加TCP/UDP连接选择

---
 Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mediastream.h |   90 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mediastream.h b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mediastream.h
index 451e75f..c2b3f7c 100755
--- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mediastream.h
+++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mediastream.h
@@ -68,6 +68,19 @@
 MS2_PUBLIC void ring_stop (RingStream * stream);
 
 /**
+ * Asks the ring filter to route to the selected sound card (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The RingStream object
+ * @param[in] sndcard_playback The wanted audio output soundcard
+ */
+MS2_PUBLIC void ring_stream_set_output_ms_snd_card(RingStream *stream, MSSndCard * sndcard_playback);
+
+/**
+ * Retrieve the current sound card from the audio playback filter (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The AudioStream object
+ */
+MS2_PUBLIC MSSndCard * ring_stream_get_output_ms_snd_card(RingStream *stream);
+
+/**
  * @}
 **/
 /**
@@ -145,6 +158,7 @@
 	MSFactory *factory;
 	MSBandwidthController *bandwidth_controller;
 	MSVideoQualityController *video_quality_controller;
+	MediaStreamDir direction;
 };
 
 MS2_PUBLIC void media_stream_init(MediaStream *stream, MSFactory *factory, const MSMediaStreamSessions *sessions);
@@ -287,6 +301,10 @@
 
 MS2_PUBLIC void media_stream_iterate(MediaStream * stream);
 
+MS2_PUBLIC void media_stream_set_direction(MediaStream *stream, MediaStreamDir dir);
+
+MS2_PUBLIC MediaStreamDir media_stream_get_direction(const MediaStream *stream);
+
 /**
  * Returns TRUE if stream was still actively receiving packets (RTP or RTCP) in the last period specified in timeout_seconds.
 **/
@@ -318,7 +336,8 @@
 	MSResourceFile,
 	MSResourceRtp,
 	MSResourceCamera,
-	MSResourceSoundcard
+	MSResourceSoundcard,
+	MSResourceVoid
 }MSResourceType;
 
 MS2_PUBLIC const char *ms_resource_type_to_string(MSResourceType type);
@@ -363,6 +382,8 @@
 struct _AudioStream
 {
 	MediaStream ms;
+	MSSndCard *playcard;
+	MSSndCard *captcard;
 	MSFilter *soundread;
 	MSFilter *soundwrite;
 	MSFilter *dtmfgen;
@@ -419,6 +440,8 @@
 	bool_t spk_eq_active;
 	bool_t use_ng;/*noise gate*/
 	bool_t is_ec_delay_set;
+	bool_t disable_record_on_mute;
+	float last_mic_gain_level_db;
 };
 
 /**
@@ -617,6 +640,25 @@
 static MS2_INLINE void audio_stream_enable_adaptive_jittcomp(AudioStream *stream, bool_t enabled) {
 	media_stream_enable_adaptive_jittcomp(&stream->ms, enabled);
 }
+/**
+ * Calling this method with disable=true will cause the microhone to be completely deactivated when muted
+ * Currently only implemented for IOS, this will cause the playback sound to be interrupted for a short moment while the audio is reconfigured.
+ * On IOS 14, it will also disable Apple's microphone recording indicator when microphone is muted.
+ *
+ * @param stream The stream.
+ * @param disable True if you wish to entirely stop the audio recording when muting the microphone.
+ */
+MS2_PUBLIC void audio_stream_disable_record_on_mute(AudioStream *stream, bool_t disable);
+
+/**
+ * Mute or unmute the microphone
+ * For IOS, if "audio_stream_disable_record_on_mute" was enabled, this will completely stop the microphone recording.
+ * Else, sound recording remains active but silence is sent instead of recorded audiow@
+ *
+ * @param stream The stream.
+ * @param enable Wether the microphone must be enabled.
+ */
+MS2_PUBLIC void audio_stream_enable_mic(AudioStream *stream, bool_t enable);
 
 /**
  * Apply a software gain on the microphone.
@@ -632,6 +674,7 @@
 
 
 /**
+ * @deprecated
  * Like audio_stream_set_mic_gain_db() excepted that the gain is specified
  * in percentage.
  *
@@ -805,6 +848,7 @@
 typedef void (*VideoStreamRenderCallback)(void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view);
 typedef void (*VideoStreamEventCallback)(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args);
 typedef void (*VideoStreamCameraNotWorkingCallback)(void *user_pointer, const MSWebCam *old_webcam);
+typedef void (*VideoStreamEncoderControlCb)(struct _VideoStream *, unsigned int method_id, void *arg, void *user_data);
 
 struct _MediastreamVideoStat
 {
@@ -845,7 +889,7 @@
 	char *display_name;
 	void *window_id;
 	void *preview_window_id;
-	MediaStreamDir dir;
+	MediaStreamDir dir; /* Not used anymore, see direction in MediaStream */
 	MSRect decode_rect; //Used for the qrcode decoder
 	MSWebCam *cam;
 	RtpSession *rtp_io_session; /**< The RTP session used for RTP input/output. */
@@ -861,6 +905,8 @@
 	VideoStreamCameraNotWorkingCallback cameracb;
 	void *camera_pointer;
 	MediaStreamVideoStat ms_video_stat;
+	VideoStreamEncoderControlCb encoder_control_cb;
+	void *encoder_control_cb_user_data;
 	bool_t use_preview_window;
 	bool_t enable_qrcode_decoder;
 	bool_t freeze_on_error;
@@ -887,7 +933,11 @@
 MS2_PUBLIC VideoStream *video_stream_new2(MSFactory* factory, const char* ip, int loc_rtp_port, int loc_rtcp_port);
 
 MS2_PUBLIC VideoStream *video_stream_new_with_sessions(MSFactory* factory, const MSMediaStreamSessions *sessions);
-MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, MediaStreamDir dir);
+
+/** 
+ * Use media_stream_set_direction() instead 
+ **/
+MS2_DEPRECATED MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, MediaStreamDir dir);
 static MS2_INLINE void video_stream_enable_adaptive_bitrate_control(VideoStream *stream, bool_t enabled) {
 	media_stream_enable_adaptive_bitrate_control(&stream->ms, enabled);
 }
@@ -997,6 +1047,12 @@
 /*function to call periodically to handle various events */
 MS2_PUBLIC void video_stream_iterate(VideoStream *stream);
 
+/*
+ * Assign a specific callback to process PLI, SLI, FIR received by RTCP.
+ * When set to NULL, or not assigned, the default behavior is to target these commands to the video encoder.
+ */ 
+MS2_PUBLIC void video_stream_set_encoder_control_callback(VideoStream *stream, VideoStreamEncoderControlCb cb, void *user_data);
+
 /**
  * Asks the video stream to send a Full-Intra Request.
  * @param[in] stream The videostream object.
@@ -1081,7 +1137,7 @@
  */
 MS2_PUBLIC int video_stream_get_camera_sensor_rotation(VideoStream *stream);
 
-/*provided for compatibility, use video_stream_set_direction() instead */
+/*provided for compatibility, use media_stream_set_direction() instead */
 MS2_PUBLIC int video_stream_recv_only_start(VideoStream *videostream, RtpProfile *profile, const char *addr, int port, int used_pt, int jitt_comp);
 MS2_PUBLIC int video_stream_send_only_start(VideoStream *videostream,
 				RtpProfile *profile, const char *addr, int port, int rtcp_port,
@@ -1254,6 +1310,32 @@
 MS2_PUBLIC void audio_stream_set_audio_route(AudioStream *stream, MSAudioRoute route);
 
 /**
+ * Asks the audio capture filter to route to the selected sound card (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The AudioStream object
+ * @param[in] sndcard_capture The wanted audio input soundcard
+ */
+MS2_PUBLIC void audio_stream_set_input_ms_snd_card(AudioStream *stream, MSSndCard * sndcard_capture);
+
+/**
+ * Asks the audio playback filter to route to the selected sound card (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The AudioStream object
+ * @param[in] sndcard_playback The wanted audio output soundcard
+ */
+MS2_PUBLIC void audio_stream_set_output_ms_snd_card(AudioStream *stream, MSSndCard * sndcard_playback);
+
+/**
+ * Retrieve the current sound card from the audio capture filter (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The AudioStream object
+ */
+MS2_PUBLIC MSSndCard * audio_stream_get_input_ms_snd_card(AudioStream *stream);
+
+/**
+ * Retrieve the current sound card from the audio playback filter (currently only used for AAudio and OpenSLES)
+ * @param[in] stream The AudioStream object
+ */
+MS2_PUBLIC MSSndCard * audio_stream_get_output_ms_snd_card(AudioStream *stream);
+
+/**
  * @}
 **/
 

--
Gitblit v1.8.0