@@ -70,7 +70,7 @@ static const struct a2dp_bit_mapping a2dp_aac_channels[] = {
70
70
{ 0 }
71
71
};
72
72
73
- static const struct a2dp_bit_mapping a2dp_aac_samplings [] = {
73
+ static const struct a2dp_bit_mapping a2dp_aac_rates [] = {
74
74
{ AAC_SAMPLING_FREQ_8000 , { 8000 } },
75
75
{ AAC_SAMPLING_FREQ_11025 , { 11025 } },
76
76
{ AAC_SAMPLING_FREQ_12000 , { 12000 } },
@@ -111,15 +111,15 @@ static int a2dp_aac_caps_foreach_channel_mode(
111
111
return -1 ;
112
112
}
113
113
114
- static int a2dp_aac_caps_foreach_sampling_freq (
114
+ static int a2dp_aac_caps_foreach_sample_rate (
115
115
const void * capabilities ,
116
116
enum a2dp_stream stream ,
117
117
a2dp_bit_mapping_foreach_func func ,
118
118
void * userdata ) {
119
119
const a2dp_aac_t * caps = capabilities ;
120
120
if (stream == A2DP_MAIN ) {
121
121
const uint16_t sampling_freq = A2DP_AAC_GET_SAMPLING_FREQ (* caps );
122
- return a2dp_bit_mapping_foreach (a2dp_aac_samplings , sampling_freq , func , userdata );
122
+ return a2dp_bit_mapping_foreach (a2dp_aac_rates , sampling_freq , func , userdata );
123
123
}
124
124
return -1 ;
125
125
}
@@ -134,14 +134,14 @@ static void a2dp_aac_caps_select_channel_mode(
134
134
caps -> channel_mode , channels );
135
135
}
136
136
137
- static void a2dp_aac_caps_select_sampling_freq (
137
+ static void a2dp_aac_caps_select_sample_rate (
138
138
void * capabilities ,
139
139
enum a2dp_stream stream ,
140
- unsigned int frequency ) {
140
+ unsigned int rate ) {
141
141
a2dp_aac_t * caps = capabilities ;
142
142
if (stream == A2DP_MAIN ) {
143
- const uint16_t sampling_freq = a2dp_bit_mapping_lookup_value (a2dp_aac_samplings ,
144
- A2DP_AAC_GET_SAMPLING_FREQ (* caps ), frequency );
143
+ const uint16_t sampling_freq = a2dp_bit_mapping_lookup_value (a2dp_aac_rates ,
144
+ A2DP_AAC_GET_SAMPLING_FREQ (* caps ), rate );
145
145
A2DP_AAC_SET_SAMPLING_FREQ (* caps , sampling_freq );
146
146
}
147
147
}
@@ -150,9 +150,9 @@ static struct a2dp_caps_helpers a2dp_aac_caps_helpers = {
150
150
.intersect = a2dp_aac_caps_intersect ,
151
151
.has_stream = a2dp_caps_has_main_stream_only ,
152
152
.foreach_channel_mode = a2dp_aac_caps_foreach_channel_mode ,
153
- .foreach_sampling_freq = a2dp_aac_caps_foreach_sampling_freq ,
153
+ .foreach_sample_rate = a2dp_aac_caps_foreach_sample_rate ,
154
154
.select_channel_mode = a2dp_aac_caps_select_channel_mode ,
155
- .select_sampling_freq = a2dp_aac_caps_select_sampling_freq ,
155
+ .select_sample_rate = a2dp_aac_caps_select_sample_rate ,
156
156
};
157
157
158
158
static unsigned int a2dp_aac_get_fdk_vbr_mode (
@@ -185,7 +185,7 @@ void *a2dp_aac_enc_thread(struct ba_transport_pcm *t_pcm) {
185
185
const a2dp_aac_t * configuration = & t -> a2dp .configuration .aac ;
186
186
const unsigned int bitrate = A2DP_AAC_GET_BITRATE (* configuration );
187
187
const unsigned int channels = t_pcm -> channels ;
188
- const unsigned int samplerate = t_pcm -> sampling ;
188
+ const unsigned int rate = t_pcm -> rate ;
189
189
190
190
/* create AAC encoder without the Meta Data module */
191
191
if ((err = aacEncOpen (& handle , 0x0F , channels )) != AACENC_OK ) {
@@ -255,8 +255,8 @@ void *a2dp_aac_enc_thread(struct ba_transport_pcm *t_pcm) {
255
255
}
256
256
}
257
257
#endif
258
- if ((err = aacEncoder_SetParam (handle , AACENC_SAMPLERATE , samplerate )) != AACENC_OK ) {
259
- error ("Couldn't set sampling rate: %s" , aacenc_strerror (err ));
258
+ if ((err = aacEncoder_SetParam (handle , AACENC_SAMPLERATE , rate )) != AACENC_OK ) {
259
+ error ("Couldn't set sample rate: %s" , aacenc_strerror (err ));
260
260
goto fail_init ;
261
261
}
262
262
if ((err = aacEncoder_SetParam (handle , AACENC_CHANNELMODE , channel_mode )) != AACENC_OK ) {
@@ -317,7 +317,7 @@ void *a2dp_aac_enc_thread(struct ba_transport_pcm *t_pcm) {
317
317
318
318
struct rtp_state rtp = { .synced = false };
319
319
/* RTP clock frequency equal to 90kHz */
320
- rtp_state_init (& rtp , samplerate , 90000 );
320
+ rtp_state_init (& rtp , rate , 90000 );
321
321
322
322
int in_bufferIdentifiers [] = { IN_AUDIO_DATA };
323
323
int out_bufferIdentifiers [] = { OUT_BITSTREAM_DATA };
@@ -459,7 +459,7 @@ void *a2dp_aac_dec_thread(struct ba_transport_pcm *t_pcm) {
459
459
pthread_cleanup_push (PTHREAD_CLEANUP (aacDecoder_Close ), handle );
460
460
461
461
const unsigned int channels = t_pcm -> channels ;
462
- const unsigned int samplerate = t_pcm -> sampling ;
462
+ const unsigned int rate = t_pcm -> rate ;
463
463
464
464
#ifdef AACDECODER_LIB_VL0
465
465
if ((err = aacDecoder_SetParam (handle , AAC_PCM_MIN_OUTPUT_CHANNELS , channels )) != AAC_DEC_OK ) {
@@ -493,7 +493,7 @@ void *a2dp_aac_dec_thread(struct ba_transport_pcm *t_pcm) {
493
493
494
494
struct rtp_state rtp = { .synced = false };
495
495
/* RTP clock frequency equal to 90kHz */
496
- rtp_state_init (& rtp , samplerate , 90000 );
496
+ rtp_state_init (& rtp , rate , 90000 );
497
497
498
498
int markbit_quirk = -3 ;
499
499
@@ -614,11 +614,11 @@ static int a2dp_aac_configuration_select(
614
614
}
615
615
616
616
unsigned int sampling_freq = 0 ;
617
- if (a2dp_aac_caps_foreach_sampling_freq (caps , A2DP_MAIN ,
618
- a2dp_bit_mapping_foreach_get_best_sampling_freq , & sampling_freq ) != -1 )
617
+ if (a2dp_aac_caps_foreach_sample_rate (caps , A2DP_MAIN ,
618
+ a2dp_bit_mapping_foreach_get_best_sample_rate , & sampling_freq ) != -1 )
619
619
A2DP_AAC_SET_SAMPLING_FREQ (* caps , sampling_freq );
620
620
else {
621
- error ("AAC: No supported sampling frequencies : %#x" , A2DP_AAC_GET_SAMPLING_FREQ (saved ));
621
+ error ("AAC: No supported sample rates : %#x" , A2DP_AAC_GET_SAMPLING_FREQ (saved ));
622
622
return errno = ENOTSUP , -1 ;
623
623
}
624
624
@@ -692,9 +692,9 @@ static int a2dp_aac_configuration_check(
692
692
}
693
693
694
694
const uint16_t conf_sampling_freq = A2DP_AAC_GET_SAMPLING_FREQ (conf_v );
695
- if (a2dp_bit_mapping_lookup (a2dp_aac_samplings , conf_sampling_freq ) == -1 ) {
696
- debug ("AAC: Invalid sampling frequency : %#x" , A2DP_AAC_GET_SAMPLING_FREQ (* conf ));
697
- return A2DP_CHECK_ERR_SAMPLING ;
695
+ if (a2dp_bit_mapping_lookup (a2dp_aac_rates , conf_sampling_freq ) == -1 ) {
696
+ debug ("AAC: Invalid sample rate : %#x" , A2DP_AAC_GET_SAMPLING_FREQ (* conf ));
697
+ return A2DP_CHECK_ERR_RATE ;
698
698
}
699
699
700
700
if (a2dp_bit_mapping_lookup (a2dp_aac_channels , conf_v .channel_mode ) == -1 ) {
@@ -712,14 +712,14 @@ static int a2dp_aac_transport_init(struct ba_transport *t) {
712
712
t -> a2dp .configuration .aac .channel_mode )) == -1 )
713
713
return -1 ;
714
714
715
- ssize_t sampling_i ;
716
- if ((sampling_i = a2dp_bit_mapping_lookup (a2dp_aac_samplings ,
715
+ ssize_t rate_i ;
716
+ if ((rate_i = a2dp_bit_mapping_lookup (a2dp_aac_rates ,
717
717
A2DP_AAC_GET_SAMPLING_FREQ (t -> a2dp .configuration .aac ))) == -1 )
718
718
return -1 ;
719
719
720
720
t -> a2dp .pcm .format = BA_TRANSPORT_PCM_FORMAT_S16_2LE ;
721
721
t -> a2dp .pcm .channels = a2dp_aac_channels [channels_i ].value ;
722
- t -> a2dp .pcm .sampling = a2dp_aac_samplings [ sampling_i ].value ;
722
+ t -> a2dp .pcm .rate = a2dp_aac_rates [ rate_i ].value ;
723
723
724
724
memcpy (t -> a2dp .pcm .channel_map , a2dp_aac_channels [channels_i ].ch .map ,
725
725
t -> a2dp .pcm .channels * sizeof (* t -> a2dp .pcm .channel_map ));
0 commit comments