mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-01-02 23:00:16 +01:00
pass through programme information
This commit is contained in:
parent
41bbdef15c
commit
df6fe8971a
|
|
@ -1,8 +1,8 @@
|
|||
from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio
|
||||
from csdr.chain.demodulator import BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, MetaProvider
|
||||
from csdr.module import PickleModule
|
||||
from csdreti.modules import EtiDecoder
|
||||
from owrx.dab.dablin import DablinModule
|
||||
from pycsdr.modules import Downmix, Buffer, Shift
|
||||
from pycsdr.modules import Downmix, Buffer, Shift, Writer
|
||||
from pycsdr.types import Format
|
||||
from typing import Optional
|
||||
from random import random
|
||||
|
|
@ -21,6 +21,7 @@ class MetaProcessor(PickleModule):
|
|||
super().__init__()
|
||||
|
||||
def process(self, data):
|
||||
result = {}
|
||||
if "coarse_frequency_shift" in data:
|
||||
value = int(data["coarse_frequency_shift"])
|
||||
if value > 0:
|
||||
|
|
@ -36,9 +37,13 @@ class MetaProcessor(PickleModule):
|
|||
logger.debug("ffs: %f", value)
|
||||
logger.debug("fine adjustment - new shift: %f", self.shift)
|
||||
self.shifter.setRate(self.shift)
|
||||
if "programmes" in data:
|
||||
result["programmes"] = data["programmes"]
|
||||
# don't send out data if there was nothing interesting for the client
|
||||
return result if result else None
|
||||
|
||||
|
||||
class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio):
|
||||
class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, MetaProvider):
|
||||
def __init__(self):
|
||||
shift = Shift(0)
|
||||
decoder = EtiDecoder()
|
||||
|
|
@ -47,6 +52,8 @@ class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain,
|
|||
decoder.setMetaWriter(metaBuffer)
|
||||
self.processor = MetaProcessor(shift)
|
||||
self.processor.setReader(metaBuffer.getReader())
|
||||
# use a dummy to start with. it won't run without.
|
||||
# will be replaced by setMetaWriter().
|
||||
self.processor.setWriter(Buffer(Format.CHAR))
|
||||
|
||||
workers = [
|
||||
|
|
@ -71,3 +78,6 @@ class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain,
|
|||
|
||||
def stop(self):
|
||||
self.processor.stop()
|
||||
|
||||
def setMetaWriter(self, writer: Writer) -> None:
|
||||
self.processor.setWriter(writer)
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ class ThreadModule(AutoStartModule, Thread, metaclass=ABCMeta):
|
|||
self.reader.stop()
|
||||
|
||||
def start(self):
|
||||
# don't start twice.
|
||||
if self.is_alive():
|
||||
return
|
||||
Thread.start(self)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue