libdvbsub: port usefull code from Neutrino-MP to make dvbsub nice again

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8cb54f4922
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-06-16 (Fri, 16 Jun 2017)

Origin message was:
------------------
- libdvbsub: port usefull code from Neutrino-MP to make dvbsub nice again

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-06-16 11:10:31 +02:00
parent 98bed6910a
commit afc4d55652
2 changed files with 57 additions and 10 deletions

View File

@@ -50,7 +50,7 @@ static void clear_queue();
int dvbsub_init() {
int trc;
sub_debug.set_level(0); //NI
sub_debug.set_level(2);
reader_running = true;
dvbsub_stopped = 1;
@@ -103,8 +103,8 @@ int dvbsub_start(int pid)
pid_change_req = 1;
}
}
printf("[dvb-sub] ***************************************** start, stopped %d pid %x\n", dvbsub_stopped, dvbsub_pid);
#if 0
printf("[dvb-sub] ***************************************** start, stopped %d pid %x\n", dvbsub_stopped, dvbsub_pid);
while(!dvbsub_stopped)
usleep(10);
#endif
@@ -244,11 +244,15 @@ static void* reader_thread(void * /*arg*/)
int len;
uint16_t packlen;
uint8_t* buf;
bool bad_startcode = false;
set_threadname("dvbsub:reader");
dmx = new cDemux(0);
#if HAVE_TRIPLEDRAGON
dmx->Open(DMX_PES_CHANNEL, NULL, 16*1024);
#else
dmx->Open(DMX_PES_CHANNEL, NULL, 64*1024);
#endif
while (reader_running) {
if(dvbsub_stopped /*dvbsub_paused*/) {
sub_debug.print(Debug::VERBOSE, "%s stopped\n", __FUNCTION__);
@@ -283,9 +287,13 @@ static void* reader_thread(void * /*arg*/)
continue;
if(memcmp(tmp, "\x00\x00\x01\xbd", 4)) {
sub_debug.print(Debug::VERBOSE, "[subtitles] bad start code: %02x%02x%02x%02x\n", tmp[0], tmp[1], tmp[2], tmp[3]);
if (!bad_startcode) {
sub_debug.print(Debug::VERBOSE, "[subtitles] bad start code: %02x%02x%02x%02x\n", tmp[0], tmp[1], tmp[2], tmp[3]);
bad_startcode = true;
}
continue;
}
bad_startcode = false;
count = 6;
packlen = getbits(tmp, 4*8, 16) + 6;
@@ -372,7 +380,7 @@ static void* dvbsub_thread(void* /*arg*/)
if(packet_queue.size() == 0) {
continue;
}
sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n\n", packet_queue.size());
sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n", packet_queue.size());
if(dvbsub_stopped /*dvbsub_paused*/) {
clear_queue();
continue;