Skip to content

Commit b79bf06

Browse files
committed
Change hw_stream to not be const
In preparation for allowing to overwrite a stream's card and device numbers, change hw_stream member and related function to not be const. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
1 parent e8cb348 commit b79bf06

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

audio/audio_hw.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct stream_out_common {
126126

127127
out_close_fn close;
128128
struct audio_device *dev;
129-
const struct hw_stream *hw;
129+
struct hw_stream *hw;
130130

131131
pthread_mutex_t lock;
132132

@@ -203,7 +203,7 @@ struct stream_in_common {
203203

204204
in_close_fn close;
205205
struct audio_device *dev;
206-
const struct hw_stream *hw;
206+
struct hw_stream *hw;
207207

208208
pthread_mutex_t lock;
209209

@@ -1876,7 +1876,7 @@ static int change_input_source_locked(struct stream_in_pcm *in, const char *valu
18761876
{
18771877
struct audio_config config;
18781878
const char *stream_name;
1879-
const struct hw_stream *hw = NULL;
1879+
struct hw_stream *hw = NULL;
18801880
const int new_source = atoi(value);
18811881

18821882
*was_changed = false;
@@ -2159,7 +2159,7 @@ static int adev_open_output_stream_v3(struct audio_hw_device *dev,
21592159
config->format, config->channel_mask, config->sample_rate, flags);
21602160

21612161
devices &= AUDIO_DEVICE_OUT_ALL;
2162-
const struct hw_stream *hw = get_stream(adev->cm, devices, flags, config);
2162+
struct hw_stream *hw = get_stream(adev->cm, devices, flags, config);
21632163
if (!hw) {
21642164
ALOGE("No suitable output stream for devices=0x%x flags=0x%x format=0x%x",
21652165
devices, flags, config->format);
@@ -2257,7 +2257,7 @@ static int adev_open_input_stream_v3(struct audio_hw_device *dev,
22572257
*stream_in = NULL;
22582258

22592259
devices &= AUDIO_DEVICE_IN_ALL;
2260-
const struct hw_stream *hw = get_stream(adev->cm, devices, 0, config);
2260+
struct hw_stream *hw = get_stream(adev->cm, devices, 0, config);
22612261
if (!hw) {
22622262
ALOGE("No suitable input stream for devices=0x%x flags=0x%x format=0x%x",
22632263
devices, flags, config->format);

configmgr/audio_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ static bool open_stream_l(struct config_mgr *cm, struct stream *s)
865865
}
866866
}
867867

868-
const struct hw_stream *get_stream(struct config_mgr *cm,
868+
struct hw_stream *get_stream(struct config_mgr *cm,
869869
const audio_devices_t devices,
870870
const audio_output_flags_t flags,
871871
const struct audio_config *config )
@@ -909,7 +909,7 @@ const struct hw_stream *get_stream(struct config_mgr *cm,
909909
}
910910
}
911911

912-
const struct hw_stream *get_named_stream(struct config_mgr *cm,
912+
struct hw_stream *get_named_stream(struct config_mgr *cm,
913913
const char *name)
914914
{
915915
struct stream *s;

include/tinyhal/audio_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ uint32_t get_supported_output_devices( struct config_mgr *cm );
130130
* Note that this only considers unnamed streams (those without a 'name'
131131
* attribute). For named streams use get_named_stream().
132132
*/
133-
const struct hw_stream *get_stream( struct config_mgr *cm,
133+
struct hw_stream *get_stream( struct config_mgr *cm,
134134
const audio_devices_t devices,
135135
const audio_output_flags_t flags,
136136
const struct audio_config *config );
137137

138138
/** Find a named custom stream and return a pointer to it */
139-
const struct hw_stream *get_named_stream(struct config_mgr *cm,
139+
struct hw_stream *get_named_stream(struct config_mgr *cm,
140140
const char *name);
141141

142142
/** Return the value of a constant defined by a <set> element as a string

0 commit comments

Comments
 (0)