[alsa-devel] ascenario: Second batch
Hello.
Two more patches for ascenario. To be applied on top of the batch from yesterday.
[PATCH 1/2] ascenario: Bring back a bugfix and config token change from latest ascenario
That one got missed as Jaroslav applied the initial ascenario patch. There was a later one which added this changes.
[PATCH 2/2] ascenario: Reduce SND_SCN_* defines to the basics.
I still need feedback here how you guys want to handle the defines. Could be seen as an RFC if you like.
For the better part of the day I'm looking into some bug regarding the control_id fucntion. Hopefully another fix I can submit tomorrow.
regards Stefan Schmidt
From: Stefan Schmidt stefan@slimlogic.co.uk
The initial applied ascenario patch was not the latest one posted. This brings back a small bugfix and the token name change requested by Mark (MasterPlaybackVolume -> Master Playback Volume).
Signed-off-by: Stefan Schmidt stefan@slimlogic.co.uk --- src/ascenario.c | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/ascenario.c b/src/ascenario.c index d753de0..11912ab 100644 --- a/src/ascenario.c +++ b/src/ascenario.c @@ -583,14 +583,16 @@ close: static int parse_scenario(snd_scenario_t *scn, FILE *f, int line_) { struct scenario_info *info; - int line = line_ - 1, id = 0, file = 0; + int line = line_ - 1, id = 0, file = 0, len, offset; char buf[MAX_BUF], *tbuf;
+ offset = sizeof(scn->scenario); scn->scenario = realloc(scn->scenario, (scn->num_scenarios + 1) * sizeof(struct scenario_info)); + len = sizeof(scn->scenario) - offset; if (scn->scenario == NULL) return -ENOMEM; - bzero(scn->scenario, sizeof(struct scenario_info)); + bzero(scn->scenario + offset, len); info = scn->scenario + scn->num_scenarios;
/* Set sequence filename to NULL as it is optional and we want to check @@ -640,40 +642,40 @@ static int parse_scenario(snd_scenario_t *scn, FILE *f, int line_) continue; }
- if (strncmp(tbuf, "MasterPlaybackVolume", 20) == 0) { - info->playback_volume_id = get_int(tbuf + 20); + if (strncmp(tbuf, "Master Playback Volume", 22) == 0) { + info->playback_volume_id = get_int(tbuf + 22); if (info->playback_volume_id < 0) { - scn_error("%s: failed to get MasterPlaybackVolume\n", + scn_error("%s: failed to get Master Playback Volume\n", __func__); goto err; } continue; }
- if (strncmp(tbuf, "MasterPlaybackSwitch", 20) == 0) { - info->playback_switch_id = get_int(tbuf + 20); + if (strncmp(tbuf, "Master Playback Switch", 22) == 0) { + info->playback_switch_id = get_int(tbuf + 22); if (info->playback_switch_id < 0) { - scn_error("%s: failed to get MasterPlaybackSwitch\n", + scn_error("%s: failed to get Master Playback Switch\n", __func__); goto err; } continue; }
- if (strncmp(tbuf, "MasterCaptureVolume", 19) == 0) { - info->capture_volume_id = get_int(tbuf + 19); + if (strncmp(tbuf, "Master Capture Volume", 21) == 0) { + info->capture_volume_id = get_int(tbuf + 21); if (info->capture_volume_id < 0) { - scn_error("%s: failed to get MasterCaptureVolume\n", + scn_error("%s: failed to get Master Capture Volume\n", __func__); goto err; } continue; }
- if (strncmp(tbuf, "MasterCaptureSwitch", 19) == 0) { - info->capture_switch_id = get_int(tbuf + 19); + if (strncmp(tbuf, "Master Capture Switch", 21) == 0) { + info->capture_switch_id = get_int(tbuf + 21); if (info->capture_switch_id < 0) { - scn_error("%s: failed to get MasterCaptureSwitch\n", + scn_error("%s: failed to get Master Capture Switch\n", __func__); goto err; } @@ -1242,7 +1244,7 @@ close: return ret; }
-int snd_scenario_dump(snd_output_t *output, const char *card_name) +int snd_scenario_dump(snd_output_t *output ATTRIBUTE_UNUSED, const char *card_name) { snd_ctl_t *handle; snd_ctl_card_info_t *info;
From: Stefan Schmidt stefan@slimlogic.co.uk
Also fix two minor qhitespace issues while being at it.
Signed-off-by: Stefan Schmidt stefan@slimlogic.co.uk --- include/ascenario.h | 25 ++----------------------- 1 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/include/ascenario.h b/include/ascenario.h index 6119f49..bc1543a 100644 --- a/include/ascenario.h +++ b/include/ascenario.h @@ -48,7 +48,7 @@ extern "C" { * See \ref ascenario page for more details. * { */ - + /** * Scenario IDs * @@ -61,12 +61,8 @@ extern "C" { #define SND_SCN_PLAYBACK_HEADPHONES "playback headphone" /** use headset for playback */ #define SND_SCN_PLAYBACK_HEADSET "playback headset" -/** use bluetooth interface for playback */ -#define SND_SCN_PLAYBACK_BLUETOOTH "playback bluetooth" /** use handset interface for playback */ #define SND_SCN_PLAYBACK_HANDSET "playback handset" -/** use gsm interface for playback */ -#define SND_SCN_PLAYBACK_GSM "playback gsm" /** use line interface for playback */ #define SND_SCN_PLAYBACK_LINE "playback line"
@@ -78,23 +74,6 @@ extern "C" { #define SND_SCN_CAPTURE_HEADSET "capture headset" /** use handset input for capture */ #define SND_SCN_CAPTURE_HANDSET "capture handset" -/** use bluetooth input for capture */ -#define SND_SCN_CAPTURE_BLUETOOTH "capture bluetooth" -/** use gsm input for capture */ -#define SND_SCN_CAPTURE_GSM "capture gsm" - -/** phone call through gsm handset */ -#define SND_SCN_PHONECALL_GSM_HANDSET "phonecall gsm handset" -/** phone call through bluetooth handset */ -#define SND_SCN_PHONECALL_BT_HANDSET "phonecall bt handset" -/** phone call through ip handset */ -#define SND_SCN_PHONECALL_IP_HANDSET "phonecall ip handset" -/** phone call through gsm headset */ -#define SND_SCN_PHONECALL_GSM_HEADSET "phonecall gsm headset" -/** phone call through bluetooth headset */ -#define SND_SCN_PHONECALL_BT_HEADSET "phonecall bt headset" -/** phone call through ip headset */ -#define SND_SCN_PHONECALL_IP_HEADSET "phonecall ip headset"
/** * QOS @@ -224,4 +203,4 @@ int snd_scenario_dump(snd_output_t *output, const char *card_name); } #endif
-#endif /* __ALSA_ASCENARIO_H */ +#endif /* __ALSA_ASCENARIO_H */
participants (1)
-
Stefan Schmidt