From 6a99d9bf65aa5878cb409945ed2bdbdcb916d047 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期五, 02 九月 2022 14:56:40 +0800 Subject: [PATCH] 更新linphone sdk --- Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mssndcard.h | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 208 insertions(+), 3 deletions(-) diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mssndcard.h b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mssndcard.h index 1942da9..4dba02e 100755 --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mssndcard.h +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/mediastreamer2.framework/Headers/mssndcard.h @@ -40,6 +40,7 @@ MSFactory* factory; MSList *cards; MSList *descs; + char *paramString; }; /** @@ -98,6 +99,10 @@ typedef struct _MSSndCard * (*MSSndCardDuplicateFunc)(struct _MSSndCard *obj); typedef void (*MSSndCardSetUsageHintFunc)(struct _MSSndCard *obj, bool_t is_going_to_be_used); typedef void (*MSSndCardUnloadFunc)(MSSndCardManager *obj); +typedef void (*MSSndCardAudioSessionFunc)(struct _MSSndCard *obj, bool_t actived); +typedef void (*MSSndCardCallKitFunc)(struct _MSSndCard *obj, bool_t enabled); +typedef void (*MSSndCardAudioRouteFunc)(struct _MSSndCard *obj); +typedef void (*MSSndCardConfigureFunc)(struct _MSSndCard *obj); struct _MSSndCardDesc{ @@ -115,6 +120,10 @@ MSSndCardDuplicateFunc duplicate; MSSndCardUnloadFunc unload; MSSndCardSetUsageHintFunc usage_hint; + MSSndCardAudioSessionFunc audio_session_activated; + MSSndCardCallKitFunc callkit_enabled; + MSSndCardAudioRouteFunc audio_route_changed; + MSSndCardConfigureFunc configure; }; /** @@ -132,13 +141,34 @@ enum _MSSndCardStreamType{ MS_SND_CARD_STREAM_VOICE, MS_SND_CARD_STREAM_RING, - MS_SND_CARD_STREAM_MEDIA + MS_SND_CARD_STREAM_MEDIA, + MS_SND_CARD_STREAM_DTMF, }; /** * Structure for sound card stream type. */ typedef enum _MSSndCardStreamType MSSndCardStreamType; + +enum _MSSndCardDeviceType { + MS_SND_CARD_DEVICE_TYPE_TELEPHONY, + MS_SND_CARD_DEVICE_TYPE_AUX_LINE, + MS_SND_CARD_DEVICE_TYPE_GENERIC_USB, + MS_SND_CARD_DEVICE_TYPE_HEADSET, + MS_SND_CARD_DEVICE_TYPE_MICROPHONE, + MS_SND_CARD_DEVICE_TYPE_EARPIECE, + MS_SND_CARD_DEVICE_TYPE_HEADPHONES, + MS_SND_CARD_DEVICE_TYPE_SPEAKER, + MS_SND_CARD_DEVICE_TYPE_BLUETOOTH, + MS_SND_CARD_DEVICE_TYPE_BLUETOOTH_A2DP, + MS_SND_CARD_DEVICE_TYPE_UNKNOWN +}; + +/** + * device type enum. + * @var DeviceType +**/ +typedef enum _MSSndCardDeviceType MSSndCardDeviceType; #define MS_SND_CARD_CAP_DISABLED (0) /**<This soundcard is disabled.*/ #define MS_SND_CARD_CAP_CAPTURE (1) /**<This sound card can capture sound */ @@ -151,11 +181,14 @@ MSSndCardManager* sndcardmanager; char *name; char *id; + int internal_id; unsigned int capabilities; + MSSndCardDeviceType device_type; void *data; int preferred_sample_rate; int latency; MSSndCardStreamType streamType; + int ref_count; }; #ifdef __cplusplus @@ -197,14 +230,46 @@ MS2_PUBLIC void ms_snd_card_manager_destroy(MSSndCardManager* sndcardmanager); /** - * Retreive a sound card object based on its name. + * Set the sound card manager's parameter string + * + * @param m A sound card manager. + * @param paramString A string of the form "param1=true;param2=42;param3=false" + * + * Returns: MSSndCard if successfull, NULL otherwise. + */ +MS2_PUBLIC void ms_snd_card_manager_set_param_string(MSSndCardManager *m, const char *paramString); + +/** + * Retreive a sound card object based on it's id. * * @param m A sound card manager containing sound cards. - * @param id A name for card to search. + * @param id An id for card to search. * * Returns: MSSndCard if successfull, NULL otherwise. */ MS2_PUBLIC MSSndCard * ms_snd_card_manager_get_card(MSSndCardManager *m, const char *id); + +/** + * Retreive a sound card object based on it's id and capabilities. + * + * @param m A sound card manager containing sound cards. + * @param id An id for card to search. + * @param capabilities A capabilities mask of MS_SND_CARD_CAP_PLAYBACK and/or MS_SND_CARD_CAP_CAPTURE + * + * Returns: MSSndCard if successfull, NULL otherwise. + */ +MS2_PUBLIC MSSndCard * ms_snd_card_manager_get_card_with_capabilities(MSSndCardManager *m, const char *id, unsigned int capabilities); + +/** + * Retreive the first sound card object in the card manager based on its type and driver type. + * + * @param m A sound card manager containing sound cards. + * @param driver_type The type of the driver. + * @param type The type of the card. + * + * Returns: MSSndCard if successfull, NULL otherwise. + */ +MS2_PUBLIC MSSndCard * ms_snd_card_manager_get_card_by_type(MSSndCardManager *m, const MSSndCardDeviceType type, const char * driver_type); /** * Retreive a playback capable sound card object based on its name. @@ -215,6 +280,16 @@ * Returns: MSSndCard if successfull, NULL otherwise. */ MS2_PUBLIC MSSndCard * ms_snd_card_manager_get_playback_card(MSSndCardManager *m, const char *id); + +/** + * Retreive all sound cards having the name provided as input. + * + * @param m A sound card manager containing sound cards. + * @param name A name for card to search. + * + * Returns: MSSndCard list of cards if successfull, NULL otherwise. + */ +MS2_PUBLIC bctbx_list_t * ms_snd_card_manager_get_all_cards_with_name(MSSndCardManager *m, const char *name); /** * Retreive a capture capable sound card object based on its name. @@ -306,10 +381,47 @@ MS2_PUBLIC void ms_snd_card_manager_register_desc(MSSndCardManager *m, MSSndCardDesc *desc); /** + * Unregister a sound card description in a sound card manager. + * + * @param m A sound card manager containing sound cards. + * @param desc A sound card description object. + * + */ +MS2_PUBLIC void ms_snd_card_manager_unregister_desc(MSSndCardManager *m, MSSndCardDesc *desc); + +/** * Ask all registered MSSndCardDesc to re-detect their soundcards. * @param m The sound card manager. **/ MS2_PUBLIC void ms_snd_card_manager_reload(MSSndCardManager *m); + +/** + * Check if there is another card in the manager having same driver_type, name and device_type + * @param m Card Manager + * @param card Card to compare properties against + * @param checkCapabilities flag to check capabilities + * + * Returns: true if a duplicate has been found, false otherwise +**/ +MS2_PUBLIC bool_t ms_snd_card_is_card_duplicate(MSSndCardManager *m, MSSndCard * card, bool_t checkCapabilities); + +/** + * Prevent card type to be at the head fo the list + * @param m Card Manager + * @param type Card type to remove from the head of list of cards + * +**/ +MS2_PUBLIC void ms_snd_card_remove_type_from_list_head(MSSndCardManager *m, MSSndCardDeviceType type); + +/** + * Swap two position of 2 sound cards in the sound card manager. + * @param m Card Manager + * @param card0 Card to be swapped + * @param card1 Card to be swapped + * + * Returns: true if card0 and card1 are not null and both are found among the list of sound cards in the card manager, false otherwise +**/ +MS2_PUBLIC bool_t ms_snd_card_manager_swap_cards(MSSndCardManager *m, MSSndCard *card0, MSSndCard *card1); /* This function is available for testing only, this should not be used in a real application! */ MS2_PUBLIC void ms_snd_card_manager_bypass_soundcard_detection(bool_t value); @@ -363,6 +475,7 @@ * Destroy sound card object. * * @param obj A MSSndCard object. + * @deprecated, use ms_snd_card_unref instead */ MS2_PUBLIC void ms_snd_card_destroy(MSSndCard *obj); @@ -378,6 +491,16 @@ MS2_PUBLIC MSSndCard * ms_snd_card_dup(MSSndCard *card); /** + * Retreive a sound card's device type. + * + * @param obj A sound card object. + * + * Returns: an MSSndCardDeviceType enum type. + * Default value is MSSndCardDeviceType::MS_SND_CARD_DEVICE_TYPE_UNKNOWN. + */ +MS2_PUBLIC MSSndCardDeviceType ms_snd_card_get_device_type(const MSSndCard *obj); + +/** * Retreive a sound card's driver type string. * * Internal driver types are either: "OSS, ALSA, WINSND, PASND, CA" @@ -387,6 +510,15 @@ * Returns: a string if successfull, NULL otherwise. */ MS2_PUBLIC const char *ms_snd_card_get_driver_type(const MSSndCard *obj); + +/** + * Retreive a sound card's device type string. + * + * @param type A sound card type. + * + * Returns: a string if successfull, "bad type" otherwise. + */ +MS2_PUBLIC const char * ms_snd_card_device_type_to_string(const MSSndCardDeviceType type); /** * Retreive a sound card's name. @@ -406,6 +538,14 @@ */ MS2_PUBLIC const char *ms_snd_card_get_string_id(MSSndCard *obj); +/** + * Retrieve sound card's internal ID. + * + * @param obj A sound card object. + * + * Returns: An integer storing the internal ID value. + */ +MS2_PUBLIC int ms_snd_card_get_internal_id(MSSndCard *obj); /** * Retreive sound card's capabilities. @@ -448,6 +588,15 @@ * */ MS2_PUBLIC void ms_snd_card_set_level(MSSndCard *obj, MSSndCardMixerElem e, int percent); + +/** + * Set internal ID of the sound card. + * + * @param obj A sound card object. + * @param id A sound card internal ID. + * + */ +MS2_PUBLIC void ms_snd_card_set_internal_id(MSSndCard *obj, int id); /** * Get some mixer level value. @@ -543,6 +692,40 @@ MS2_PUBLIC void ms_snd_card_set_usage_hint(MSSndCard *obj, bool_t is_going_to_be_used); /** + * Used by application to notify whether audio access is allowed for the process. + * On most platform this function is useless, but in an iOS application using Callkit, the system decides when audio (through the AVAudioSession singleton) is open or closed. + * Such application needs to explicitely notify mediastreamer2 with ms_snd_card_notify_audio_session_activated() about the state of the audio session. + * + * @param obj A sound card object. + * @param actived TRUE if audio session is activated, FALSE otherwise. + */ +MS2_PUBLIC void ms_snd_card_notify_audio_session_activated(MSSndCard *obj, bool_t activated); + +/** + * Used by application to notify whether audio route is changed. On most platform this function is useless. + * But an iOS application needs to explicitely notify mediastreamer2 with ms_snd_card_notify_audio_route_changed() about the changment of audio route to ajust the sample rate for playback/record. + * + * @param obj A sound card object. +*/ +MS2_PUBLIC void ms_snd_card_notify_audio_route_changed(MSSndCard *obj); + +/** + * Used by application to tell the MSSndCard if rely on notifications of activation of audio session. + * When yesno is set to FALSE, the MSSndCard will not rely on notifications of activation of audio session, and will assume that audio is always usable. + * If set to TRUE, the mediastreamer2 will require explicit calls to ms_snd_card_notify_audio_session_activated(). + * + * @param obj A sound card object. + * @param yesno TRUE if app notifies is activated, FALSE otherwise. The default value is FALSE. + */ +MS2_PUBLIC void ms_snd_card_app_notifies_activation(MSSndCard *obj, bool_t yesno); + +/** + * Used to configure audio session with default settings. Callkit usage. + * @param obj A sound card object. + */ +MS2_PUBLIC void ms_snd_card_configure_audio_session(MSSndCard *obj); + +/** * Sets the stream type for this soundcard, default is VOICE **/ MS2_PUBLIC void ms_snd_card_set_stream_type(MSSndCard *obj, MSSndCardStreamType type); @@ -569,6 +752,28 @@ **/ MS2_PUBLIC void ms_alsa_card_set_forced_sample_rate(int samplerate); +/** + * Returns a string value of the given MSSndCardDeviceType enum + */ +MS2_PUBLIC const char* ms_snd_card_device_type_to_string(MSSndCardDeviceType type); + +/** + * Takes a ref on a MSSndCard + */ +MS2_PUBLIC MSSndCard* ms_snd_card_ref(MSSndCard *sndCard); + +/** + * Removes a ref from a MSSndCard + */ +MS2_PUBLIC void ms_snd_card_unref(MSSndCard *sndCard); + +#ifdef __ANDROID__ +/** + * Sort cards in order to put earpiece and speaker as first devices of every filter. +**/ +void ms_snd_card_sort(MSSndCardManager *m); +#endif // __ANDROID__ + /** @} */ #ifdef __cplusplus -- Gitblit v1.8.0