summaryrefslogtreecommitdiffstats
path: root/binding/radio_impl_kingfisher.c
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-01-03 01:26:11 -0500
committerScott Murray <scott.murray@konsulko.com>2019-01-03 12:50:13 -0500
commitf1d5902c92eafd3aad62e29298502603a9b56d81 (patch)
tree4a8ee5509ee37e2a35f9ccbd163297777806d9e2 /binding/radio_impl_kingfisher.c
parentfd181d8a3d7cc8f39ae53bec6a098170ffda1fd5 (diff)
Add audio role open/close support
Rework things so that the 4A audio role is only opened while playing, and closed when stopped. Further work will need to be done to handle the possibility of the output device changing on subsequent opens, both the RTL SDR and Kingfisher case have complications around doing so: - The RTL SDR helper application needs to be enhanced to add an output setting command. Killing it and starting it again would also work, but likely will add noticeable UI latency. - On the Kingfisher, the binding currently has no control over the output used for the loopback, as it is being set up down in the soft-mixer based on HAL values. Change-Id: I4aa83c937972ec5d91f7b78421a11148c7fe0afc Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'binding/radio_impl_kingfisher.c')
-rw-r--r--binding/radio_impl_kingfisher.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/binding/radio_impl_kingfisher.c b/binding/radio_impl_kingfisher.c
index 7775d5b..8bfc6ff 100644
--- a/binding/radio_impl_kingfisher.c
+++ b/binding/radio_impl_kingfisher.c
@@ -77,7 +77,7 @@ static void *freq_callback_data;
static uint32_t kf_get_min_frequency(radio_band_t band);
static void kf_scan_stop(void);
-static int kf_init(const char *output)
+static int kf_init(void)
{
GKeyFile* conf_file;
int conf_file_present = 0;
@@ -85,10 +85,6 @@ static int kf_init(const char *output)
char *value_str;
char cmd[SI_CTL_CMDLINE_MAXLEN];
int rc;
-#ifndef HAVE_4A_FRAMEWORK
- char output_sink_opt[GST_SINK_OPT_LEN];
- char gst_pipeline_str[GST_PIPELINE_LEN];
-#endif /* !HAVE_4A_FRAMEWORK */
if(present)
return 0;
@@ -182,46 +178,14 @@ static int kf_init(const char *output)
return -1;
}
-#ifndef HAVE_4A_FRAMEWORK
- // Initialize GStreamer
- gst_init(NULL, NULL);
-
- if(output) {
- AFB_INFO("Using output device %s", output);
- rc = snprintf(output_sink_opt, GST_SINK_OPT_LEN, " device=%s", output);
- if(rc >= GST_SINK_OPT_LEN) {
- AFB_ERROR("output device string too long");
- return -1;
- }
- } else {
- output_sink_opt[0] = '\0';
- }
- // NOTE: If muting without pausing is desired, it can likely be done
- // by adding a "volume" element to the pipeline before the sink,
- // and setting the volume to 0 to mute.
- // Use PulseAudio output for compatibility with audiomanager / module_router
- rc = snprintf(gst_pipeline_str,
- sizeof(gst_pipeline_str),
- "alsasrc device=hw:radio ! queue ! audioconvert ! audioresample ! pulsesink stream-properties=\"props,media.role=radio\"");
-
- if(rc >= GST_PIPELINE_LEN) {
- AFB_ERROR("pipeline string too long");
- return -1;
- }
- pipeline = gst_parse_launch(gst_pipeline_str, NULL);
- if(!pipeline) {
- AFB_ERROR("pipeline construction failed!");
- return -1;
- }
-
- // Start pipeline in paused state
- gst_element_set_state(pipeline, GST_STATE_PAUSED);
-#endif /* !HAVE_4A_FRAMEWORK */
-
present = true;
return 0;
}
+static void kf_set_output(const char *output)
+{
+}
+
static uint32_t kf_get_frequency(void)
{
return current_frequency;
@@ -488,6 +452,7 @@ static void kf_set_stereo_mode(radio_stereo_mode_t mode)
radio_impl_ops_t kf_impl_ops = {
.name = "Kingfisher Si4689",
.init = kf_init,
+ .set_output = kf_set_output,
.get_frequency = kf_get_frequency,
.set_frequency = kf_set_frequency,
.set_frequency_callback = kf_set_frequency_callback,