don't just assume a device has a samplerate setting

This commit is contained in:
Bert Vermeulen 2011-02-01 02:33:54 +01:00
parent 4a1b18f86d
commit 3a28509817
5 changed files with 6 additions and 6 deletions

View File

@ -133,7 +133,7 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING); snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->device->probes); num_probes = g_slist_length(o->device->probes);
if (o->device->plugin) { if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info( samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(samplerate_s = sr_samplerate_string(samplerate))) { if (!(samplerate_s = sr_samplerate_string(samplerate))) {

View File

@ -79,7 +79,7 @@ static int init(struct sr_output *o)
num_probes = g_slist_length(o->device->probes); num_probes = g_slist_length(o->device->probes);
comment[0] = '\0'; comment[0] = '\0';
if (o->device->plugin) { if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info( samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(frequency_s = sr_samplerate_string(samplerate))) { if (!(frequency_s = sr_samplerate_string(samplerate))) {
@ -226,7 +226,7 @@ static int analog_init(struct sr_output *o)
num_probes = g_slist_length(o->device->probes); num_probes = g_slist_length(o->device->probes);
comment[0] = '\0'; comment[0] = '\0';
if (o->device->plugin) { if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info( samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(frequency_s = sr_samplerate_string(samplerate))) { if (!(frequency_s = sr_samplerate_string(samplerate))) {

View File

@ -102,7 +102,7 @@ static int init(struct sr_output *o)
/* TODO: Currently not available in the demo module. */ /* TODO: Currently not available in the demo module. */
if (o->device->plugin) { if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info( samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(frequency_s = sr_samplerate_string(samplerate))) { if (!(frequency_s = sr_samplerate_string(samplerate))) {

View File

@ -91,7 +91,7 @@ static int init(struct sr_output *o)
g_string_append_printf(ctx->header, "$version %s %s $end\n", g_string_append_printf(ctx->header, "$version %s %s $end\n",
PACKAGE, PACKAGE_VERSION); PACKAGE, PACKAGE_VERSION);
if (o->device->plugin) { if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info( ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) { if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {

View File

@ -107,7 +107,7 @@ int init(struct sr_output *o, int default_spl, enum outputmode mode)
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING); snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->device->probes); num_probes = g_slist_length(o->device->probes);
if (o->device->plugin) { if (o->device->plugin || device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
samplerate = *((uint64_t *) o->device->plugin->get_device_info( samplerate = *((uint64_t *) o->device->plugin->get_device_info(
o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
if (!(samplerate_s = sr_samplerate_string(samplerate))) { if (!(samplerate_s = sr_samplerate_string(samplerate))) {