Ejemplo n.º 1
0
    def setup_initialise(self):
        self.scheduler = scheduler()
        scheduler.run = self.scheduler

        self.rpsit = ReassemblePSITables()

        self.inSrc = Dummy()
        self.inSrc.link((self.inSrc, "outbox"), (self.rpsit, "inbox"))
        self.inSrc.link((self.inSrc, "signal"), (self.rpsit, "control"))

        self.outDest = Dummy()
        self.outDest.link((self.rpsit, "outbox"), (self.outDest, "inbox"))
        self.outDest.link((self.rpsit, "signal"), (self.outDest, "control"))

        self.children = [self.inSrc, self.rpsit, self.outDest]

        self.run = self.scheduler.main()
Ejemplo n.º 2
0
    def setup_initialise(self):
        self.scheduler = scheduler()
        scheduler.run = self.scheduler

        self.rpsit = ReassemblePSITables()
        
        self.inSrc = Dummy()
        self.inSrc.link((self.inSrc,"outbox"), (self.rpsit ,"inbox"))
        self.inSrc.link((self.inSrc,"signal"), (self.rpsit ,"control"))
        
        self.outDest = Dummy()
        self.outDest.link((self.rpsit ,"outbox"), (self.outDest,"inbox"))
        self.outDest.link((self.rpsit ,"signal"), (self.outDest,"control"))
        
        self.children=[ self.inSrc, self.rpsit, self.outDest ]

        self.run = self.scheduler.main()
Ejemplo n.º 3
0
    import dvb3.frontend
    feparams = {
        "inversion": dvb3.frontend.INVERSION_AUTO,
        "constellation": dvb3.frontend.QAM_16,
        "code_rate_HP": dvb3.frontend.FEC_3_4,
        "code_rate_LP": dvb3.frontend.FEC_3_4,
    }

    demo = "Now and next"
    #    demo="All schedule info"

    if demo == "Now and next":
        Pipeline(
            DVB_Multiplex(505833330.0 / 1000000.0, [EIT_PID], feparams),
            DVB_Demuxer({EIT_PID: ["outbox"]}),
            ReassemblePSITables(),
            ParseEventInformationTable_Subset(
                True, False, False, False),  # now and next for this mux only
            SimplifyEIT(),
            NowNextProgrammeJunctionDetect(),
            NowNextServiceFilter(4164),
            ConsoleEchoer(),
        ).run()

    elif demo == "All schedule info":
        Pipeline(
            DVB_Multiplex(505833330.0 / 1000000.0, [EIT_PID], feparams),
            DVB_Demuxer({EIT_PID: ["outbox"]}),
            ReassemblePSITables(),
            ParseEventInformationTable_Subset(
                True, True, True, True
Ejemplo n.º 4
0
class Test_ReassemblePSITables(unittest.TestCase):

    def setup_test(self):
        self.setup_initialise()
        self.setup_activate()

    def setup_initialise(self):
        self.scheduler = scheduler()
        scheduler.run = self.scheduler

        self.rpsit = ReassemblePSITables()
        
        self.inSrc = Dummy()
        self.inSrc.link((self.inSrc,"outbox"), (self.rpsit ,"inbox"))
        self.inSrc.link((self.inSrc,"signal"), (self.rpsit ,"control"))
        
        self.outDest = Dummy()
        self.outDest.link((self.rpsit ,"outbox"), (self.outDest,"inbox"))
        self.outDest.link((self.rpsit ,"signal"), (self.outDest,"control"))
        
        self.children=[ self.inSrc, self.rpsit, self.outDest ]

        self.run = self.scheduler.main()

    def setup_activate(self):
        self.rpsit.activate(Scheduler=self.scheduler)
        self.inSrc.activate(Scheduler=self.scheduler)
        self.outDest.activate(Scheduler=self.scheduler)
    
    def runFor(self, cycles):
        numcycles=cycles*(3+len(self.children))    # approx this many components in the system
        for i in range(0,numcycles): self.run.next()


    def test_assembleTableSections(self):
        """Test that sections are correctly extracted"""
        global section, tsPacket
        self.setup_test()
        
        sections = [
            section(0x4f, 100),
            section(0x4f, 50),
            section(0x4f, 500),
            section(0x4f, 500),
            section(0x4f, 10),
            section(0x4f, 10),
        ]

        inOut = [
            ( tsPacket(0x12,   0,  0, sections[0]),           [ sections[0], ] ),
            ( tsPacket(0x12,   0,  1, sections[1]),           [ sections[1], ] ),
            ( tsPacket(0x12,   0,  2, sections[2][0:183]),    [ ] ),
            ( tsPacket(0x12,  -1,  3, sections[2][183:367]),  [ ] ),
            ( tsPacket(0x12,  -1,  4, sections[2][367:500]),  [ sections[2], ] ),
            ( tsPacket(0x12,   0,  5, sections[3][0:183]),    [ ] ),
            ( tsPacket(0x12,  -1,  6, sections[3][183:367]),  [ ] ),
            ( tsPacket(0x12, 133,  7, sections[3][367:500]
                                     +sections[4]
                                     +sections[5]         ),  [ sections[3],
                                                                sections[4],
                                                                sections[5], ] ),
        ]

        self.runFor(cycles=100)
        
        for (tspacket, expectedOutput) in inOut:
            self.inSrc.send(tspacket, "outbox")
            self.runFor(cycles=10)
            
            for section in expectedOutput:
                self.assert_(self.outDest.dataReady("inbox"))
                self.assert_(self.outDest.recv("inbox") == section)
            self.assert_(not self.outDest.dataReady("inbox"))
Ejemplo n.º 5
0
class Test_ReassemblePSITables(unittest.TestCase):
    def setup_test(self):
        self.setup_initialise()
        self.setup_activate()

    def setup_initialise(self):
        self.scheduler = scheduler()
        scheduler.run = self.scheduler

        self.rpsit = ReassemblePSITables()

        self.inSrc = Dummy()
        self.inSrc.link((self.inSrc, "outbox"), (self.rpsit, "inbox"))
        self.inSrc.link((self.inSrc, "signal"), (self.rpsit, "control"))

        self.outDest = Dummy()
        self.outDest.link((self.rpsit, "outbox"), (self.outDest, "inbox"))
        self.outDest.link((self.rpsit, "signal"), (self.outDest, "control"))

        self.children = [self.inSrc, self.rpsit, self.outDest]

        self.run = self.scheduler.main()

    def setup_activate(self):
        self.rpsit.activate(Scheduler=self.scheduler)
        self.inSrc.activate(Scheduler=self.scheduler)
        self.outDest.activate(Scheduler=self.scheduler)

    def runFor(self, cycles):
        numcycles = cycles * (3 + len(self.children)
                              )  # approx this many components in the system
        for i in range(0, numcycles):
            self.run.next()

    def test_assembleTableSections(self):
        """Test that sections are correctly extracted"""
        global section, tsPacket
        self.setup_test()

        sections = [
            section(0x4f, 100),
            section(0x4f, 50),
            section(0x4f, 500),
            section(0x4f, 500),
            section(0x4f, 10),
            section(0x4f, 10),
        ]

        inOut = [
            (tsPacket(0x12, 0, 0, sections[0]), [
                sections[0],
            ]),
            (tsPacket(0x12, 0, 1, sections[1]), [
                sections[1],
            ]),
            (tsPacket(0x12, 0, 2, sections[2][0:183]), []),
            (tsPacket(0x12, -1, 3, sections[2][183:367]), []),
            (tsPacket(0x12, -1, 4, sections[2][367:500]), [
                sections[2],
            ]),
            (tsPacket(0x12, 0, 5, sections[3][0:183]), []),
            (tsPacket(0x12, -1, 6, sections[3][183:367]), []),
            (tsPacket(0x12, 133, 7,
                      sections[3][367:500] + sections[4] + sections[5]), [
                          sections[3],
                          sections[4],
                          sections[5],
                      ]),
        ]

        self.runFor(cycles=100)

        for (tspacket, expectedOutput) in inOut:
            self.inSrc.send(tspacket, "outbox")
            self.runFor(cycles=10)

            for section in expectedOutput:
                self.assert_(self.outDest.dataReady("inbox"))
                self.assert_(self.outDest.recv("inbox") == section)
            self.assert_(not self.outDest.dataReady("inbox"))