1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-20 07:11:46 -05:00
sdrangel/dsd/dsd_livescanner.c

53 lines
2.1 KiB
C

/*
* Copyright (C) 2010 DSD Author
* GPG Key ID: 0x3F1D7FD0 (74EF 430D F7F2 0A48 FCE6 F630 FAA2 635D 3F1D 7FD0)
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#include "dsd.h"
#include "dsd_nocarrier.h"
void liveScanner(dsd_opts * opts, dsd_state * state)
{
while (state->dsd_running) // FIXME: loop while input available
{
// if (pthread_cond_wait(&state->input_ready, &state->input_mutex)) {
// fprintf(stderr, "dsd::liveScanner: Error waiting for input ready condition\n");
// }
//
// fprintf (stderr, "dsd::liveScanner: input is ready\n");
noCarrier(opts, state);
state->synctype = getFrameSync(opts, state);
// recalibrate center/umid/lmid
state->center = ((state->max) + (state->min)) / 2;
state->umid = (((state->max) - state->center) * 5 / 8) + state->center;
state->lmid = (((state->min) - state->center) * 5 / 8) + state->center;
while (state->synctype != -1) // -1 -> exit thread
{
processFrame(opts, state);
state->synctype = getFrameSync(opts, state);
// recalibrate center/umid/lmid
state->center = ((state->max) + (state->min)) / 2;
state->umid = (((state->max) - state->center) * 5 / 8) + state->center;
state->lmid = (((state->min) - state->center) * 5 / 8) + state->center;
}
}
fprintf (stderr, "dsd::liveScanner: end loop\n");
}