From 28c3aa4a6935d870b15087992536341d390f969c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 18 Jul 2015 22:57:00 +0200 Subject: Add FIG0/17 to FIB0 --- src/fig/FIG0.cpp | 75 ++++++++++++++++++++++++++++++++++++ src/fig/FIG0.h | 16 ++++++++ src/fig/FIGCarousel.cpp | 100 ++---------------------------------------------- src/fig/FIGCarousel.h | 1 + 4 files changed, 96 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index a255445..612aa20 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -384,3 +384,78 @@ size_t FIG0_3::fill(uint8_t *buf, size_t max_size) return max_size - remaining; } +//=========== FIG 0/17 =========== + +FIG0_17::FIG0_17(FIGRuntimeInformation *rti) : + m_rti(rti) +{ + serviceFIG0_17 = m_rti->ensemble->services.end(); +} + +size_t FIG0_17::fill(uint8_t *buf, size_t max_size) +{ + ssize_t remaining = max_size; + auto ensemble = m_rti->ensemble; + + FIGtype0* fig0 = NULL; + + if (serviceFIG0_17 == ensemble->services.end()) { + serviceFIG0_17 = ensemble->services.begin(); + } + for (; serviceFIG0_17 != ensemble->services.end(); + ++serviceFIG0_17) { + + if ( (*serviceFIG0_17)->pty == 0 && + (*serviceFIG0_17)->language == 0) { + continue; + } + + if (fig0 == NULL) { + fig0 = (FIGtype0*)buf; + fig0->FIGtypeNumber = 0; + fig0->Length = 1; + fig0->CN = 0; + fig0->OE = 0; + fig0->PD = 0; + fig0->Extension = 17; + buf += 2; + remaining -= 2; + } + + if ((*serviceFIG0_17)->language == 0) { + if (remaining < 4) { + break; + } + } + else { + if (remaining < 5) { + break; + } + } + + auto programme = (FIGtype0_17_programme*)buf; + programme->SId = htons((*serviceFIG0_17)->id); + programme->SD = 1; + programme->PS = 0; + programme->L = (*serviceFIG0_17)->language != 0; + programme->CC = 0; + programme->Rfa = 0; + programme->NFC = 0; + if ((*serviceFIG0_17)->language == 0) { + buf[3] = (*serviceFIG0_17)->pty; + fig0->Length += 4; + buf += 4; + remaining -= 4; + } + else { + buf[3] = (*serviceFIG0_17)->language; + buf[4] = (*serviceFIG0_17)->pty; + fig0->Length += 5; + buf += 5; + remaining -= 5; + } + } + + return max_size - remaining; +} + diff --git a/src/fig/FIG0.h b/src/fig/FIG0.h index 3530e5f..2c7c848 100644 --- a/src/fig/FIG0.h +++ b/src/fig/FIG0.h @@ -98,5 +98,21 @@ class FIG0_3 : public IFIG FIGRuntimeInformation *m_rti; }; +// FIG type 0/17 +class FIG0_17 : public IFIG +{ + public: + FIG0_17(FIGRuntimeInformation* rti); + virtual size_t fill(uint8_t *buf, size_t max_size); + virtual FIG_rate repetition_rate(void) { return FIG_rate::A; } + + virtual const int figtype(void) const { return 0; } + virtual const int figextension(void) const { return 17; } + + private: + FIGRuntimeInformation *m_rti; + std::vector >::iterator serviceFIG0_17; +}; + #endif // __FIG0_H_ diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index 235cf66..2634a32 100644 --- a/src/fig/FIGCarousel.cpp +++ b/src/fig/FIGCarousel.cpp @@ -47,7 +47,8 @@ FIGCarousel::FIGCarousel(boost::shared_ptr ensemble) : m_fig0_0(&m_rti), m_fig0_1(&m_rti), m_fig0_2(&m_rti), - m_fig0_3(&m_rti) + m_fig0_3(&m_rti), + m_fig0_17(&m_rti) { m_rti.ensemble = ensemble; m_rti.currentFrame = 0; @@ -57,12 +58,14 @@ FIGCarousel::FIGCarousel(boost::shared_ptr ensemble) : m_figs_available[std::make_pair(0, 1)] = &m_fig0_1; m_figs_available[std::make_pair(0, 2)] = &m_fig0_2; m_figs_available[std::make_pair(0, 3)] = &m_fig0_3; + m_figs_available[std::make_pair(0, 17)] = &m_fig0_17; const int fib0 = 0; allocate_fig_to_fib(0, 0, fib0); allocate_fig_to_fib(0, 1, fib0); allocate_fig_to_fib(0, 2, fib0); allocate_fig_to_fib(0, 3, fib0); + allocate_fig_to_fib(0, 17, fib0); } void FIGCarousel::set_currentFrame(unsigned long currentFrame) @@ -152,98 +155,3 @@ void FIGCarousel::fib0(int framephase) { } } -#if 0 -void fib0 { - switch (insertFIG) { - - case 0: case 4: case 8: case 12: - // FIG type 0/0, Multiplex Configuration Info (MCI), - // Ensemble information - // ERASED - break; - - case 1: case 6: case 10: case 13: - // FIG type 0/1, MIC, Sub-Channel Organization, - // one instance of the part for each subchannel - // ERASED - break; - - case 2: case 9: case 11: case 14: - // FIG type 0/2, MCI, Service Organization, one instance of - // FIGtype0_2_Service for each subchannel - // ERASED - break; - - case 3: - // FIG type 0/2 for Data - // ERASED - break; - - case 5: - // ERASED - break; - - case 7: - fig0 = NULL; - if (serviceFIG0_17 == ensemble->services.end()) { - serviceFIG0_17 = ensemble->services.begin(); - } - for (; serviceFIG0_17 != ensemble->services.end(); - ++serviceFIG0_17) { - - if ( (*serviceFIG0_17)->pty == 0 && - (*serviceFIG0_17)->language == 0) { - continue; - } - - if (fig0 == NULL) { - fig0 = (FIGtype0*)&etiFrame[index]; - fig0->FIGtypeNumber = 0; - fig0->Length = 1; - fig0->CN = 0; - fig0->OE = 0; - fig0->PD = 0; - fig0->Extension = 17; - index += 2; - figSize += 2; - } - - if ((*serviceFIG0_17)->language == 0) { - if (figSize + 4 > 30) { - break; - } - } - else { - if (figSize + 5 > 30) { - break; - } - } - - programme = - (FIGtype0_17_programme*)&etiFrame[index]; - programme->SId = htons((*serviceFIG0_17)->id); - programme->SD = 1; - programme->PS = 0; - programme->L = (*serviceFIG0_17)->language != 0; - programme->CC = 0; - programme->Rfa = 0; - programme->NFC = 0; - if ((*serviceFIG0_17)->language == 0) { - etiFrame[index + 3] = (*serviceFIG0_17)->pty; - fig0->Length += 4; - index += 4; - figSize += 4; - } - else { - etiFrame[index + 3] = (*serviceFIG0_17)->language; - etiFrame[index + 4] = (*serviceFIG0_17)->pty; - fig0->Length += 5; - index += 5; - figSize += 5; - } - } - break; - } -} -#endif - diff --git a/src/fig/FIGCarousel.h b/src/fig/FIGCarousel.h index 84299ac..c8a250e 100644 --- a/src/fig/FIGCarousel.h +++ b/src/fig/FIGCarousel.h @@ -64,6 +64,7 @@ class FIGCarousel { FIG0_1 m_fig0_1; FIG0_2 m_fig0_2; FIG0_3 m_fig0_3; + FIG0_17 m_fig0_17; }; #endif // __FIG_CAROUSEL_H_ -- cgit v1.2.3