From 3e6cf581926e93792c7b5d73631ea4082c5d47ed Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 16 Feb 2021 11:07:35 +0100 Subject: [PATCH] a2dp/avdtp: mark capabilities as const --- src/classic/a2dp_sink.c | 4 ++-- src/classic/a2dp_sink.h | 6 +++--- src/classic/a2dp_source.c | 4 ++-- src/classic/a2dp_source.h | 6 +++--- src/classic/avdtp.c | 5 +++-- src/classic/avdtp.h | 2 +- src/classic/avdtp_sink.c | 2 +- src/classic/avdtp_sink.h | 2 +- src/classic/avdtp_source.c | 2 +- src/classic/avdtp_source.h | 2 +- 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/classic/a2dp_sink.c b/src/classic/a2dp_sink.c index 8de3832e7..754719ace 100644 --- a/src/classic/a2dp_sink.c +++ b/src/classic/a2dp_sink.c @@ -171,8 +171,8 @@ void a2dp_sink_deinit(void){ } avdtp_stream_endpoint_t * a2dp_sink_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, - uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * codec_configuration, uint16_t codec_configuration_len){ + const uint8_t *codec_capabilities, uint16_t codec_capabilities_len, + uint8_t * codec_configuration, uint16_t codec_configuration_len){ avdtp_stream_endpoint_t * local_stream_endpoint = avdtp_sink_create_stream_endpoint(AVDTP_SINK, media_type); if (!local_stream_endpoint){ return NULL; diff --git a/src/classic/a2dp_sink.h b/src/classic/a2dp_sink.h index c4def3378..8e360fa8e 100644 --- a/src/classic/a2dp_sink.h +++ b/src/classic/a2dp_sink.h @@ -81,9 +81,9 @@ void a2dp_sink_init(void); * * @return local_stream_endpoint */ -avdtp_stream_endpoint_t * a2dp_sink_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, - uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * codec_configuration, uint16_t codec_configuration_len); +avdtp_stream_endpoint_t * a2dp_sink_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, + const uint8_t *codec_capabilities, uint16_t codec_capabilities_len, + uint8_t * codec_configuration, uint16_t codec_configuration_len); /** * @brief Unregister stream endpoint and free it's memory diff --git a/src/classic/a2dp_source.c b/src/classic/a2dp_source.c index 4e683a9fe..0e45a6428 100644 --- a/src/classic/a2dp_source.c +++ b/src/classic/a2dp_source.c @@ -690,8 +690,8 @@ void a2dp_source_deinit(void){ } avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, - uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * codec_configuration, uint16_t codec_configuration_len){ + const uint8_t *codec_capabilities, uint16_t codec_capabilities_len, + uint8_t * codec_configuration, uint16_t codec_configuration_len){ avdtp_stream_endpoint_t * stream_endpoint = avdtp_source_create_stream_endpoint(AVDTP_SOURCE, media_type); if (!stream_endpoint){ return NULL; diff --git a/src/classic/a2dp_source.h b/src/classic/a2dp_source.h index efeae9336..d4493e60d 100644 --- a/src/classic/a2dp_source.h +++ b/src/classic/a2dp_source.h @@ -81,9 +81,9 @@ void a2dp_source_init(void); * * @return local_stream_endpoint */ -avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, - uint8_t * codec_capabilities, uint16_t codec_capabilities_len, - uint8_t * codec_configuration, uint16_t codec_configuration_len); +avdtp_stream_endpoint_t * a2dp_source_create_stream_endpoint(avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, + const uint8_t *codec_capabilities, uint16_t codec_capabilities_len, + uint8_t * codec_configuration, uint16_t codec_configuration_len); /** * @brief Unregister stream endpoint and free it's memory diff --git a/src/classic/avdtp.c b/src/classic/avdtp.c index e710f017d..2c8321b78 100644 --- a/src/classic/avdtp.c +++ b/src/classic/avdtp.c @@ -384,7 +384,7 @@ void avdtp_register_header_compression_category(avdtp_stream_endpoint_t * stream stream_endpoint->sep.capabilities.header_compression.recovery = recovery; } -void avdtp_register_media_codec_category(avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len){ +void avdtp_register_media_codec_category(avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len){ if (!stream_endpoint){ log_error("Stream endpoint with given seid is not registered."); return; @@ -393,7 +393,8 @@ void avdtp_register_media_codec_category(avdtp_stream_endpoint_t * stream_endpoi stream_endpoint->sep.registered_service_categories = bitmap; stream_endpoint->sep.capabilities.media_codec.media_type = media_type; stream_endpoint->sep.capabilities.media_codec.media_codec_type = media_codec_type; - stream_endpoint->sep.capabilities.media_codec.media_codec_information = media_codec_info; + // @todo should be stored in struct as const + stream_endpoint->sep.capabilities.media_codec.media_codec_information = (uint8_t*) media_codec_info; stream_endpoint->sep.capabilities.media_codec.media_codec_information_len = media_codec_info_len; } diff --git a/src/classic/avdtp.h b/src/classic/avdtp.h index f344ac777..059cebdec 100644 --- a/src/classic/avdtp.h +++ b/src/classic/avdtp.h @@ -614,7 +614,7 @@ void avdtp_register_delay_reporting_category(avdtp_stream_endpoint_t * stream_en void avdtp_register_recovery_category(avdtp_stream_endpoint_t * stream_endpoint, uint8_t maximum_recovery_window_size, uint8_t maximum_number_media_packets); void avdtp_register_content_protection_category(avdtp_stream_endpoint_t * stream_endpoint, uint16_t cp_type, const uint8_t * cp_type_value, uint8_t cp_type_value_len); void avdtp_register_header_compression_category(avdtp_stream_endpoint_t * stream_endpoint, uint8_t back_ch, uint8_t media, uint8_t recovery); -void avdtp_register_media_codec_category(avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len); +void avdtp_register_media_codec_category(avdtp_stream_endpoint_t * stream_endpoint, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len); void avdtp_register_multiplexing_category(avdtp_stream_endpoint_t * stream_endpoint, uint8_t fragmentation); // sink only diff --git a/src/classic/avdtp_sink.c b/src/classic/avdtp_sink.c index 4a61ae2df..14792ab7f 100644 --- a/src/classic/avdtp_sink.c +++ b/src/classic/avdtp_sink.c @@ -82,7 +82,7 @@ void avdtp_sink_register_header_compression_category(uint8_t seid, uint8_t back_ avdtp_register_header_compression_category(stream_endpoint, back_ch, media, recovery); } -void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len){ +void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len){ avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid); avdtp_register_media_codec_category(stream_endpoint, media_type, media_codec_type, media_codec_info, media_codec_info_len); } diff --git a/src/classic/avdtp_sink.h b/src/classic/avdtp_sink.h index 77353d5ec..bdd1be1a4 100644 --- a/src/classic/avdtp_sink.h +++ b/src/classic/avdtp_sink.h @@ -77,7 +77,7 @@ void avdtp_sink_register_recovery_category(uint8_t seid, uint8_t maximum_recover void avdtp_sink_register_header_compression_category(uint8_t seid, uint8_t back_ch, uint8_t media, uint8_t recovery); void avdtp_sink_register_multiplexing_category(uint8_t seid, uint8_t fragmentation); -void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len); +void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len); void avdtp_sink_register_content_protection_category(uint8_t seid, uint16_t cp_type, const uint8_t * cp_type_value, uint8_t cp_type_value_len); /** diff --git a/src/classic/avdtp_source.c b/src/classic/avdtp_source.c index 6eaf80ab4..c23593e13 100644 --- a/src/classic/avdtp_source.c +++ b/src/classic/avdtp_source.c @@ -84,7 +84,7 @@ void avdtp_source_register_header_compression_category(uint8_t seid, uint8_t bac avdtp_register_header_compression_category(stream_endpoint, back_ch, media, recovery); } -void avdtp_source_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len){ +void avdtp_source_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len){ avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(seid); avdtp_register_media_codec_category(stream_endpoint, media_type, media_codec_type, media_codec_info, media_codec_info_len); } diff --git a/src/classic/avdtp_source.h b/src/classic/avdtp_source.h index 757c0fe67..be2398fd9 100644 --- a/src/classic/avdtp_source.h +++ b/src/classic/avdtp_source.h @@ -107,7 +107,7 @@ void avdtp_source_register_header_compression_category(uint8_t seid, uint8_t bac * @param media_codec_info * @param media_codec_info_len */ -void avdtp_source_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len); +void avdtp_source_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, const uint8_t *media_codec_info, uint16_t media_codec_info_len); /** * @brief Register multiplexing category with local stream endpoint identified by seid