input/vcd: deprecate struct sr_rational
This commit is contained in:
parent
76e107d68c
commit
e48a546292
10
input/vcd.c
10
input/vcd.c
|
@ -211,6 +211,7 @@ static void remove_empty_parts(gchar **parts)
|
||||||
*/
|
*/
|
||||||
static gboolean parse_header(FILE *file, struct context *ctx)
|
static gboolean parse_header(FILE *file, struct context *ctx)
|
||||||
{
|
{
|
||||||
|
uint64_t p, q;
|
||||||
gchar *name = NULL, *contents = NULL;
|
gchar *name = NULL, *contents = NULL;
|
||||||
gboolean status = FALSE;
|
gboolean status = FALSE;
|
||||||
|
|
||||||
|
@ -227,15 +228,14 @@ static gboolean parse_header(FILE *file, struct context *ctx)
|
||||||
{
|
{
|
||||||
/* The standard allows for values 1, 10 or 100
|
/* The standard allows for values 1, 10 or 100
|
||||||
* and units s, ms, us, ns, ps and fs. */
|
* and units s, ms, us, ns, ps and fs. */
|
||||||
struct sr_rational period;
|
if (sr_parse_period(contents, &p, &q) == SR_OK)
|
||||||
if (sr_parse_period(contents, &period) == SR_OK)
|
|
||||||
{
|
{
|
||||||
ctx->samplerate = period.q / period.p;
|
ctx->samplerate = q / p;
|
||||||
if (period.q % period.p != 0)
|
if (q % p != 0)
|
||||||
{
|
{
|
||||||
/* Does not happen unless time value is non-standard */
|
/* Does not happen unless time value is non-standard */
|
||||||
sr_warn("Inexact rounding of samplerate, %" PRIu64 " / %" PRIu64 " to %" PRIu64 " Hz.",
|
sr_warn("Inexact rounding of samplerate, %" PRIu64 " / %" PRIu64 " to %" PRIu64 " Hz.",
|
||||||
period.q, period.p, ctx->samplerate);
|
q, p, ctx->samplerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
sr_dbg("Samplerate: %" PRIu64, ctx->samplerate);
|
sr_dbg("Samplerate: %" PRIu64, ctx->samplerate);
|
||||||
|
|
Loading…
Reference in New Issue