<item text="Network setup">self.openSetup("network")</item>-->
<!--<item text="CI"><screen module="Ci" screen="CiSelection" /></item>-->
<!--<item text="Radio"><code>print "radio mode"</code></item>-->
+ <item text="Subtitles"><screen module="Subtitles" screen="Subtitles" /></item>
<item text="Media player"><screen module="MediaPlayer" screen="MediaPlayer" /></item>
<item text="Timer"><screen module="TimerEdit" screen="TimerEditList" /></item>
<item text="VCR scart"><code>self.session.scart.VCRSbChanged(3)</code></item>
<widget name="footer" position="20,250" size="360,25" font="Regular;23"/>
<!--<widget name="introduction" position="20,360" size="280,30" font="Regular;23" />-->
</screen>
+ <screen name="Subtitles" position="150,100" size="420,350" title="Subtitle selection">
+ <widget name="config" position="10,10" size="500,330" scrollbarMode="showOnDemand" />
+ </screen>
<screen name="ParentalControlSetup" position="100,88" size="520,400" title="Parental control setup">
<widget name="config" position="20,10" size="460,350" scrollbarMode="showOnDemand" />
</screen>
#include <dvbsi++/iso639_language_descriptor.h>
#include <dvbsi++/stream_identifier_descriptor.h>
#include <dvbsi++/subtitling_descriptor.h>
+#include <dvbsi++/teletext_descriptor.h>
eDVBServicePMTHandler::eDVBServicePMTHandler()
:m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF)
s.composition_page_id = (*it)->getCompositionPageId();
s.ancillary_page_id = (*it)->getAncillaryPageId();
s.language_code = (*it)->getIso639LanguageCode();
- eDebug("add subtitle %s PID %04x, type %d, composition page %d, ancillary_page %d",
- s.language_code.c_str(), s.pid, s.subtitling_type, s.composition_page_id, s.ancillary_page_id);
+// eDebug("add dvb subtitle %s PID %04x, type %d, composition page %d, ancillary_page %d",
+// s.language_code.c_str(), s.pid, s.subtitling_type, s.composition_page_id, s.ancillary_page_id);
program.subtitleStreams.push_back(s);
}
break;
}
case TELETEXT_DESCRIPTOR:
if ( program.textPid == -1 || (*es)->getPid() == cached_tpid )
- program.textPid = (*es)->getPid();
+ {
+ subtitleStream s;
+ s.subtitling_type = 0x01; // EBU TELETEXT SUBTITLES
+ s.pid = program.textPid = (*es)->getPid();
+ TeletextDescriptor *d = (TeletextDescriptor*)(*desc);
+ const VbiTeletextList *list = d->getVbiTeletexts();
+ for (VbiTeletextConstIterator it(list->begin()); it != list->end(); ++it)
+ {
+ switch((*it)->getTeletextType())
+ {
+ case 0x02: // Teletext subtitle page
+ case 0x05: // Teletext subtitle page for hearing impaired pepople
+ s.language_code = (*it)->getIso639LanguageCode();
+ s.teletext_page_number = (*it)->getTeletextPageNumber();
+ s.teletext_magazine_number = (*it)->getTeletextMagazineNumber();
+// eDebug("add teletext subtitle %s PID %04x, page number %d, magazine number %d",
+// s.language_code.c_str(), s.pid, s.teletext_page_number, s.teletext_magazine_number);
+ program.subtitleStreams.push_back(s);
+ break;
+ }
+ }
+ }
break;
case DTS_DESCRIPTOR:
isaudio = 1;
struct subtitleStream
{
int pid;
- int subtitling_type;
- int composition_page_id;
- int ancillary_page_id;
+ int subtitling_type; /* see ETSI EN 300 468 table 26 component_type
+ when stream_content is 0x03
+ 0x10..0x13, 0x20..0x23 is used for dvb subtitles
+ 0x01 is used for teletext subtitles */
+ union
+ {
+ int composition_page_id; // used for dvb subtitles
+ int teletext_page_number; // used for teletext subtitles
+ };
+ union
+ {
+ int ancillary_page_id; // used for dvb subtitles
+ int teletext_magazine_number; // used for teletext subtitles
+ };
std::string language_code;
+ bool operator<(const subtitleStream &s)
+ {
+ if (pid != s.pid)
+ return pid < s.pid;
+ if (teletext_page_number != s.teletext_page_number)
+ return teletext_page_number < s.teletext_page_number;
+ return teletext_magazine_number < s.teletext_magazine_number;
+ }
};
struct program
segment_length |= *segment++;
if (segment_type == 0xFF)
return segment_length + 6;
+ if (page_id != m_composition_page_id && page_id != m_ancillary_page_id)
+ return segment_length + 6;
// //eDebug("have %d bytes of segment data", segment_length);
// //eDebug("page_id %d, segtype %02x", page_id, segment_type);
subtitle_page *page, **ppage;
- page = this->pages; ppage = &this->pages;
+ page = m_pages; ppage = &m_pages;
while (page)
{
void eDVBSubtitleParser::subtitle_process_pes(__u8 *pkt, int len)
{
// eDebug("subtitle_process_pes");
- if (!extract_pts(show_time, pkt))
+ if (!extract_pts(m_show_time, pkt))
{
pkt += 6; len -= 6;
// skip PES header
void eDVBSubtitleParser::subtitle_redraw_all()
{
#if 1
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
while(page)
{
subtitle_redraw(page->page_id);
page = page->next;
}
#else
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
//eDebug("----------- end of display set");
//eDebug("active pages:");
while (page)
void eDVBSubtitleParser::subtitle_reset()
{
- while (subtitle_page *page = this->pages)
+ while (subtitle_page *page = m_pages)
{
/* free page regions */
while (page->page_regions)
delete clut;
}
- this->pages = page->next;
+ m_pages = page->next;
delete page;
}
}
void eDVBSubtitleParser::subtitle_redraw(int page_id)
{
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
//eDebug("displaying page id %d", page_id);
subtitle_page_region *region = page->page_regions;
eDVBSubtitlePage Page;
- Page.m_show_time = show_time;
+ Page.m_show_time = m_show_time;
for (; region; region=region->next)
{
// eDebug("region %d", region->region_id);
int x0 = region->region_horizontal_address;
int y0 = region->region_vertical_address;
- int x1 = x0 + reg->region_width;
- int y1 = y0 + reg->region_height;
if ((x0 < 0) || (y0 < 0))
{
DEFINE_REF(eDVBSubtitleParser);
eDVBSubtitleParser::eDVBSubtitleParser(iDVBDemux *demux)
- :pages(0)
+ :m_pages(0)
{
setStreamID(0xBD);
return -1;
}
-int eDVBSubtitleParser::start(int pid)
+int eDVBSubtitleParser::start(int pid, int composition_page_id, int ancillary_page_id)
{
if (m_pes_reader)
{
- eDebug("start dvb subtitles on pid 0x%04x", pid);
+ eDebug("start dvb subtitles on pid 0x%04x with composition_page_id %d and ancillary_page_id %d",
+ pid, composition_page_id, ancillary_page_id);
+ m_composition_page_id = composition_page_id;
+ m_ancillary_page_id = ancillary_page_id;
return m_pes_reader->start(pid);
}
return -1;
:public iObject, public ePESParser, public Object
{
DECLARE_REF(eDVBSubtitleParser);
- subtitle_page *pages;
+ subtitle_page *m_pages;
ePtr<iDVBPESReader> m_pes_reader;
ePtr<eConnection> m_read_connection;
- pts_t show_time;
+ pts_t m_show_time;
Signal1<void,const eDVBSubtitlePage&> m_new_subtitle_page;
+ int m_composition_page_id, m_ancillary_page_id;
public:
eDVBSubtitleParser(iDVBDemux *demux);
virtual ~eDVBSubtitleParser();
- int start(int pid);
+ int start(int pid, int composition_page_id, int ancillary_page_id);
int stop();
void connectNewPage(const Slot1<void, const eDVBSubtitlePage&> &slot, ePtr<eConnection> &connection);
private:
{
setStreamID(0xBD); /* as per en 300 472 */
- setPage(-1);
+ setPageAndMagazine(0,0);
if (demux->createPESReader(eApp, m_pes_reader))
eDebug("failed to create teletext subtitle PES reader!");
int serial_mode = m_C & (1<<11);
/* page on the same magazine? end current page. */
- if ((serial_mode || (m_M == m_page_M)) && (m_page_open))
+ if ((serial_mode || m_M == m_page_M) && m_page_open)
{
handlePageEnd(have_pts, pts);
m_page_open = 0;
m_X = decode_hamming_84(data+1) * 0x10 + decode_hamming_84(data);
if ((m_C & (1<<6)) && (m_X != 0xFF)) /* scan for pages with subtitle bit set */
- m_found_subtitle_pages.insert((m_M << 8) | m_X);
-
+ {
+ eDVBServicePMTHandler::subtitleStream s;
+ s.pid = m_pid;
+ s.subtitling_type = 0x01; // ebu teletext subtitle
+ s.teletext_page_number = m_X & 0xFF;
+ s.teletext_magazine_number = m_M & 7;
+ m_found_subtitle_pages.insert(s);
+ }
+
/* correct page on correct magazine? open page. */
- if ((m_M == m_page_M) && (m_X == m_page_X))
+ if (m_M == m_page_M && m_X == m_page_X)
{
handlePageStart();
m_page_open = 1;
}
} else
{
- /* data for the selected page? */
- if ((m_M == m_page_M) && m_page_open)
+ /* data for the selected page ? */
+ if (m_M == m_page_M && m_page_open)
handleLine(data, 40);
}
}
m_page_open = 0;
if (m_pes_reader)
+ {
+ m_pid = pid;
return m_pes_reader->start(pid);
+ }
else
return -1;
}
m_subtitle_page.m_have_pts = have_pts;
m_subtitle_page.m_pts = pts;
m_subtitle_page.m_timeout = 90000 * 20; /* 20s */
- if (m_page_number != -1)
+ if (m_page_X != 0)
sendSubtitlePage(); /* send assembled subtitle page to display */
}
-void eDVBTeletextParser::setPage(int page)
+void eDVBTeletextParser::setPageAndMagazine(int page, int magazine)
{
if (page > 0)
eDebug("enable teletext subtitle page %d", page);
else
eDebug("disable teletext subtitles");
- m_page_number = page;
- m_page_M = (page >> 8) & 7; /* magazine to look for */
- m_page_X = page & 0xFF; /* page number */
+ m_page_M = magazine&7; /* magazine to look for */
+ m_page_X = page&0xFF; /* page number */
}
void eDVBTeletextParser::connectNewPage(const Slot1<void, const eDVBTeletextSubtitlePage&> &slot, ePtr<eConnection> &connection)
#include <lib/base/object.h>
#include <lib/dvb/idvb.h>
#include <lib/dvb/pesparse.h>
+#include <lib/dvb/pmt.h>
#include <lib/gdi/gpixmap.h>
struct eDVBTeletextSubtitlePageElement
eDVBTeletextParser(iDVBDemux *demux);
virtual ~eDVBTeletextParser();
int start(int pid);
- void setPage(int page);
-
+ void setPageAndMagazine(int page, int magazine);
+ void setMagazine(int magazine);
void connectNewPage(const Slot1<void,const eDVBTeletextSubtitlePage &> &slot, ePtr<eConnection> &connection);
-
- std::set<int> m_found_subtitle_pages;
+ std::set<eDVBServicePMTHandler::subtitleStream> m_found_subtitle_pages;
private:
void processPESPacket(__u8 *pkt, int len);
int m_M, m_Y, m_X, m_S1, m_S2, m_S3, m_S4, m_C;
- int m_page_number, m_page_M, m_page_X, m_page_open, m_double_height;
+ int m_pid, m_page_M, m_page_X, m_page_open, m_double_height;
void handlePageStart();
void handleLine(unsigned char *line, int len);
InfoBarSubserviceSelection, InfoBarTuner, InfoBarShowMovies, InfoBarTimeshift, \
InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
- InfoBarSubtitleSupport, InfoBarPiP, InfoBarSubtitles, InfoBarPlugins
+ InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins
from Screens.HelpMenu import HelpableScreen, HelpMenu
HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish,
InfoBarSubserviceSelection, InfoBarTuner, InfoBarTimeshift, InfoBarSeek,
InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
- InfoBarPiP, InfoBarSubtitles, InfoBarPlugins,
- InfoBarSubtitleSupport, Screen):
+ InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, Screen):
ALLOW_SUSPEND = True
InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
InfoBarTuner, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \
- InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitles, InfoBarSubtitleSupport, \
+ InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, \
InfoBarPlugins:
x.__init__(self)
InfoBarMenu, \
InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
- InfoBarSummarySupport, InfoBarTeletextPlugin, InfoBarSubtitleSupport, Screen):
+ InfoBarSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarExtensions):
ENABLE_RESUME_SUPPORT = True
ALLOW_SUSPEND = True
InfoBarServiceName, InfoBarSeek, InfoBarShowMovies, \
InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \
InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \
- InfoBarSummarySupport, InfoBarTeletextPlugin, InfoBarSubtitleSupport:
+ InfoBarSummarySupport, InfoBarSubtitleSupport, InfoBarExtensions:
x.__init__(self)
self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference()
{
"mainMenu": (self.mainMenu, _("Enter main menu...")),
})
+ self.session.infobar = None
def mainMenu(self):
print "loading mainmenu XML..."
menu = mdom.childNodes[0]
assert menu.tagName == "menu", "root element in menu must be 'menu'!"
- self.session.open(MainMenu, menu, menu.childNodes)
+
+ self.session.infobar = self
+ # so we can access the currently active infobar from screens opened from within the mainmenu
+ # at the moment used from the SubserviceSelection
+
+ self.session.openWithCallback(self.mainMenuClosed, MainMenu, menu, menu.childNodes)
+
+ def mainMenuClosed(self, *val):
+ self.session.infobar = None
class InfoBarSimpleEventView:
""" Opens the Eventview for now/next """
def runPlugin(self, plugin):
plugin(session = self.session)
-# depends on InfoBarExtensions and InfoBarSubtitleSupport
-class InfoBarSubtitles:
- def __init__(self):
- self.addExtension((self.getDisableSubtitleName, self.disableSubtitles, self.subtitlesEnabled), "4")
- self.addExtension(extension = self.getSubtitleList, type = InfoBarExtensions.EXTENSION_LIST)
-
- def getDisableSubtitleName(self):
- return _("Disable subtitles")
-
- def getSubtitleList(self):
- list = []
- s = self.getCurrentServiceSubtitle()
- l = s and s.getSubtitleList() or [ ]
-
- for x in l:
- list.append(((boundFunction(self.getSubtitleEntryName, x[0]), boundFunction(self.enableSubtitle, x[1]), lambda: True), None))
- return list
-
- def getSubtitleEntryName(self, name):
- return "Enable Subtitles: " + name
-
- def enableSubtitle(self, subtitles):
- if self.selected_subtitle != subtitles:
- print "enable subtitles", subtitles
- self.subtitles_enabled = False
- self.selected_subtitle = subtitles
- self.subtitles_enabled = True
-
- def subtitlesEnabled(self):
- return self.subtitles_enabled
-
- def disableSubtitles(self):
- self.subtitles_enabled = False
-
# depends on InfoBarExtensions
class InfoBarPiP:
def __init__(self):
#include <byteswap.h>
#include <netinet/in.h>
-#define INTERNAL_TELETEXT
-
#ifndef BYTE_ORDER
#error no byte order defined!
#endif
m_decode_demux->getMPEGDecoder(m_decoder, m_is_primary);
if (m_cue)
m_cue->setDecodingDemux(m_decode_demux, m_decoder);
-#ifdef INTERNAL_TELETEXT
m_teletext_parser = new eDVBTeletextParser(m_decode_demux);
m_teletext_parser->connectNewPage(slot(*this, &eDVBServicePlay::newSubtitlePage), m_new_subtitle_page_connection);
-#endif
m_subtitle_parser = new eDVBSubtitleParser(m_decode_demux);
m_subtitle_parser->connectNewPage(slot(*this, &eDVBServicePlay::newDVBSubtitlePage), m_new_dvb_subtitle_page_connection);
}
m_cue->commitSpans();
}
-RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *entry)
+RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *tuple)
{
if (m_subtitle_widget)
disableSubtitles(parent);
-
- if (!PyInt_Check(entry))
- return -1;
- int page = PyInt_AsLong(entry);
+ PyObject *entry = 0;
+ int tuplesize = PyTuple_Size(tuple);
+ int type = 0;
- if (page > 0 && !m_teletext_parser)
- return -1;
- if (page < 0 && !m_subtitle_parser)
- return -1;
+ if (!PyTuple_Check(tuple))
+ goto error_out;
- m_subtitle_widget = new eSubtitleWidget(parent);
- m_subtitle_widget->resize(parent->size()); /* full size */
+ if (tuplesize < 1)
+ goto error_out;
- if (page > 0)
+ entry = PyTuple_GET_ITEM(tuple, 0);
+
+ if (!PyInt_Check(entry))
+ goto error_out;
+
+ type = PyInt_AsLong(entry);
+
+ if (type == 1) // teletext subtitles
{
-/* eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
- eDVBServicePMTHandler::program program;
- if (h.getProgramInfo(program))
- eDebug("getting program info failed.");
- else
+ int page, magazine;
+ if (tuplesize < 4)
+ goto error_out;
+
+ if (!m_teletext_parser)
{
- eDebug("start teletext on pid %04x, page %d", program.textPid, page);
- m_teletext_parser->start(program.textPid);*/
- m_teletext_parser->setPage(page);
-// }
+ eDebug("enable teletext subtitles.. no parser !!!");
+ return -1;
+ }
+
+ // PyTuple_GET_ITEM(tuple, 1); //we dont need pid yet
+ entry = PyTuple_GET_ITEM(tuple, 2);
+ if (!PyInt_Check(entry))
+ goto error_out;
+ page = PyInt_AsLong(entry);
+
+ entry = PyTuple_GET_ITEM(tuple, 3);
+ if (!PyInt_Check(entry))
+ goto error_out;
+ magazine = PyInt_AsLong(entry);
+
+ m_subtitle_widget = new eSubtitleWidget(parent);
+ m_subtitle_widget->resize(parent->size()); /* full size */
+ m_teletext_parser->setPageAndMagazine(page, magazine);
}
- else
+ else if (type == 0)
{
- int pid = -page;
- m_subtitle_parser->start(pid);
- }
+ int pid = 0, composition_page_id = 0, ancillary_page_id = 0;
+ if (!m_subtitle_parser)
+ {
+ eDebug("enable dvb subtitles.. no parser !!!");
+ return -1;
+ }
+ if (tuplesize < 4)
+ goto error_out;
+
+ entry = PyTuple_GET_ITEM(tuple, 1);
+ if (!PyInt_Check(entry))
+ goto error_out;
+ pid = PyInt_AsLong(entry);
+
+ entry = PyTuple_GET_ITEM(tuple, 2);
+ if (!PyInt_Check(entry))
+ goto error_out;
+ composition_page_id = PyInt_AsLong(entry);
+ entry = PyTuple_GET_ITEM(tuple, 3);
+ if (!PyInt_Check(entry))
+ goto error_out;
+ ancillary_page_id = PyInt_AsLong(entry);
+
+ m_subtitle_widget = new eSubtitleWidget(parent);
+ m_subtitle_widget->resize(parent->size()); /* full size */
+ m_subtitle_parser->start(pid, composition_page_id, ancillary_page_id);
+ }
+ else
+ goto error_out;
return 0;
+error_out:
+ eDebug("enableSubtitles needs a tuple as 2nd argument!\n"
+ "for teletext subtitles (0, pid, teletext_page, teletext_magazine)\n"
+ "for dvb subtitles (1, pid, composition_page_id, ancillary_page_id)");
+ return -1;
}
RESULT eDVBServicePlay::disableSubtitles(eWidget *parent)
}
if (m_teletext_parser)
{
- m_teletext_parser->setPage(-1);
+ m_teletext_parser->setPageAndMagazine(0,0);
m_subtitle_pages.clear();
}
return 0;
}
PyObject *l = PyList_New(0);
-
- for (std::set<int>::iterator i(m_teletext_parser->m_found_subtitle_pages.begin()); i != m_teletext_parser->m_found_subtitle_pages.end(); ++i)
- {
- PyObject *tuple = PyTuple_New(2);
- char desc[20];
- sprintf(desc, "Page %d", *i);
- PyTuple_SetItem(tuple, 0, PyString_FromString(desc));
- PyTuple_SetItem(tuple, 1, PyInt_FromLong(*i));
- PyList_Append(l, tuple);
- Py_DECREF(tuple);
- }
+ std::set<int> added_ttx_pages;
+
+ std::set<eDVBServicePMTHandler::subtitleStream> &subs =
+ m_teletext_parser->m_found_subtitle_pages;
eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
eDVBServicePMTHandler::program program;
for (std::vector<eDVBServicePMTHandler::subtitleStream>::iterator it(program.subtitleStreams.begin());
it != program.subtitleStreams.end(); ++it)
{
- PyObject *tuple = PyTuple_New(2);
- char desc[20];
- sprintf(desc, "DVB %s", it->language_code.c_str());
- PyTuple_SetItem(tuple, 0, PyString_FromString(desc));
- PyTuple_SetItem(tuple, 1, PyInt_FromLong(-it->pid));
+ switch(it->subtitling_type)
+ {
+ case 0x01: // ebu teletext subtitles
+ {
+ int page_number = it->teletext_page_number & 0xFF;
+ int magazine_number = it->teletext_magazine_number & 7;
+ int hash = magazine_number << 8 | page_number;
+ if (added_ttx_pages.find(hash) == added_ttx_pages.end())
+ {
+ PyObject *tuple = PyTuple_New(5);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
+ PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
+ PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong(magazine_number));
+ PyTuple_SET_ITEM(tuple, 4, PyString_FromString(it->language_code.c_str()));
+ PyList_Append(l, tuple);
+ Py_DECREF(tuple);
+ added_ttx_pages.insert(hash);
+ }
+ break;
+ }
+ case 0x10 ... 0x13:
+ case 0x20 ... 0x23: // dvb subtitles
+ {
+ PyObject *tuple = PyTuple_New(5);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
+ PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->composition_page_id));
+ PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong(it->ancillary_page_id));
+ PyTuple_SET_ITEM(tuple, 4, PyString_FromString(it->language_code.c_str()));
+ PyList_Insert(l, 0, tuple);
+ Py_DECREF(tuple);
+ break;
+ }
+ }
+ }
+ }
+
+ for (std::set<eDVBServicePMTHandler::subtitleStream>::iterator it(subs.begin());
+ it != subs.end(); ++it)
+ {
+ int page_number = it->teletext_page_number & 0xFF;
+ int magazine_number = it->teletext_magazine_number & 7;
+ int hash = magazine_number << 8 | page_number;
+ if (added_ttx_pages.find(hash) == added_ttx_pages.end())
+ {
+ PyObject *tuple = PyTuple_New(5);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(1));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->pid));
+ PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(page_number));
+ PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong(magazine_number));
+ PyTuple_SET_ITEM(tuple, 4, PyString_FromString("und")); // undetermined
PyList_Append(l, tuple);
Py_DECREF(tuple);
}
}
} else
{
- eDebug("start subtitle delay %d", diff / 90);
+// eDebug("start subtitle delay %d", diff / 90);
m_subtitle_sync_timer.start(diff / 90, 1);
break;
}