Merge remote-tracking branch 'neutrino-mp/master' into pu/mp

Conflicts:
	src/neutrino.cpp
	src/nhttpd/tuxboxapi/neutrinoyparser.cpp


Origin commit data
------------------
Branch: ni/coolstream
Commit: 8bdb16cec6
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-13 (Mon, 13 Mar 2017)



------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-03-13 16:14:33 +01:00
181 changed files with 6320 additions and 987 deletions

View File

@@ -50,7 +50,7 @@ static void clear_queue();
int dvbsub_init() {
int trc;
sub_debug.set_level(3);
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;

View File

@@ -32,7 +32,7 @@ extern "C" {
#endif
// Set these to 'true' for debug output:
static bool DebugConverter = true;
static bool DebugConverter = false;
#define dbgconverter(a...) if (DebugConverter) sub_debug.print(Debug::VERBOSE, a)
@@ -62,7 +62,7 @@ cDvbSubtitleBitmaps::cDvbSubtitleBitmaps(int64_t pPts)
cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps()
{
dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
// dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
int i;
if(sub.rects) {
@@ -88,12 +88,16 @@ fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors,
fb_pixel_t *cr,*l;
int i,j,k,ip;
#ifndef HAVE_SPARK_HARDWARE
cr = (fb_pixel_t *) malloc(dx*dy*sizeof(fb_pixel_t));
if(cr == NULL) {
printf("Error: malloc\n");
return NULL;
}
#else
cr = CFrameBuffer::getInstance()->getBackBufferPointer();
#endif
l = cr;
for(j = 0; j < dy; j++, l += dx)
@@ -112,19 +116,27 @@ fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors,
void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
{
int i;
#ifndef HAVE_SPARK_HARDWARE
int stride = CFrameBuffer::getInstance()->getScreenWidth(true);
#if 0
int wd = CFrameBuffer::getInstance()->getScreenWidth();
int xstart = CFrameBuffer::getInstance()->getScreenX();
int yend = CFrameBuffer::getInstance()->getScreenY() + CFrameBuffer::getInstance()->getScreenHeight();
int ystart = CFrameBuffer::getInstance()->getScreenY();
#endif
uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer();
#endif
dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride);
// dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride);
int sw = CFrameBuffer::getInstance()->getScreenWidth(true);
int sh = CFrameBuffer::getInstance()->getScreenHeight(true);
#if 0
double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720;
double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576;
xc = yc; //FIXME should we scale also to full width ?
int xf = int(xc * (double) 720);
#endif
for (i = 0; i < Count(); i++) {
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0)
@@ -136,6 +148,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
int height = sub.rects[i]->h;
int xoff, yoff;
#if 0
int nw = int(width == 1280 ? ((double) width / xc) : ((double) width * xc));
int nh = int((double) height * yc);
@@ -148,14 +161,26 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
if(yoff < ystart)
yoff = ystart;
}
#endif
int h2 = (width == 1280) ? 720 : 576;
xoff = sub.rects[i]->x * sw / width;
yoff = sub.rects[i]->y * sh / h2;
int nw = width * sw / width;
int nh = height * sh / h2;
// dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1,
// sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh);
dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1,
sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 5, 0)
fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh);
#else
fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh);
#endif
#ifdef HAVE_SPARK_HARDWARE
// CFrameBuffer::getInstance()->waitForIdle();
CFrameBuffer::getInstance()->blit2FB(newdata, nw, nh, xoff, yoff, 0, 0);
#else
fb_pixel_t * ptr = newdata;
for (int y2 = 0; y2 < nh; y2++) {
int y = (yoff + y2) * stride;
@@ -163,6 +188,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
*(sublfb + xoff + x2 + y) = *ptr++;
}
free(newdata);
#endif
if(min_x > xoff)
min_x = xoff;
@@ -173,11 +199,13 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
if(max_y < (yoff + nh))
max_y = yoff + nh;
}
if(Count())
dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
dbgconverter("\n");
// if(Count())
// dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
// dbgconverter("\n");
}
static int screen_w, screen_h, screen_x, screen_y;
// --- cDvbSubtitleConverter -------------------------------------------------
cDvbSubtitleConverter::cDvbSubtitleConverter(void)
@@ -208,10 +236,10 @@ cDvbSubtitleConverter::cDvbSubtitleConverter(void)
//if(DebugConverter)
// av_log_set_level(AV_LOG_INFO);
min_x = CFrameBuffer::getInstance()->getScreenWidth();
min_y = CFrameBuffer::getInstance()->getScreenHeight();
max_x = CFrameBuffer::getInstance()->getScreenX();
max_y = CFrameBuffer::getInstance()->getScreenY();
screen_w = min_x = CFrameBuffer::getInstance()->getScreenWidth();
screen_h = min_y = CFrameBuffer::getInstance()->getScreenHeight();
screen_x = max_x = CFrameBuffer::getInstance()->getScreenX();
screen_y = max_y = CFrameBuffer::getInstance()->getScreenY();
Timeout.Set(0xFFFF*1000);
}
@@ -254,9 +282,14 @@ void cDvbSubtitleConverter::Pause(bool pause)
void cDvbSubtitleConverter::Clear(void)
{
dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
// dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
if(running && (max_x-min_x > 0) && (max_y-min_y > 0)) {
CFrameBuffer::getInstance()->paintBackgroundBoxRel (min_x, min_y, max_x-min_x, max_y-min_y);
/* reset area to clear */
min_x = screen_w;
min_y = screen_h;
max_x = screen_x;
max_y = screen_h;
//CFrameBuffer::getInstance()->paintBackground();
}
}
@@ -290,18 +323,18 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts)
avpkt.data = (uint8_t*) Data;
avpkt.size = Length;
dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts);
// dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts);
//avctx->sub_id = (anc_page << 16) | comp_page; //FIXME not patched ffmpeg needs this !
avcodec_decode_subtitle2(avctx, sub, &got_subtitle, &avpkt);
dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects);
// dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects);
if(got_subtitle) {
if(DebugConverter) {
unsigned int i;
for(i = 0; i < sub->num_rects; i++) {
dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1,
sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors);
// dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1,
// sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors);
}
}
bitmaps->Add(Bitmaps);
@@ -322,7 +355,10 @@ void dvbsub_get_stc(int64_t * STC);
int cDvbSubtitleConverter::Action(void)
{
int WaitMs = WAITMS;
#if 0
retry:
bool shown = false;
#endif
if (!running)
return 0;
@@ -339,11 +375,12 @@ int cDvbSubtitleConverter::Action(void)
Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC);
Delta /= 90; // STC and PTS are in 1/90000s
dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout());
// dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout());
if (Delta <= MAXDELTA) {
if (Delta <= SHOW_DELTA) {
dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1);
dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) timeout: %d bmp %d/%d\n", sb->Pts(), STC, Delta, sb->Timeout(), bitmaps->Count(), sb->Index() + 1);
// dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1);
if (running) {
Clear();
sb->Draw(min_x, min_y, max_x, max_y);
@@ -352,12 +389,16 @@ int cDvbSubtitleConverter::Action(void)
if(sb->Count())
WaitMs = MIN_DISPLAY_TIME;
bitmaps->Del(sb, true);
// shown = true;
}
else if (Delta < WaitMs)
WaitMs = int((Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta);
}
else
{
dbgconverter("deleted because delta (%lld) > MAXDELTA (%d)\n", Delta, MAXDELTA);
bitmaps->Del(sb, true);
}
} else {
if (Timeout.TimedOut()) {
dbgconverter("cDvbSubtitleConverter::Action: timeout, elapsed %lld\n", Timeout.Elapsed());
@@ -366,6 +407,10 @@ int cDvbSubtitleConverter::Action(void)
}
}
Unlock();
#if 0
if (shown)
goto retry;
#endif
if(WaitMs != WAITMS)
dbgconverter("cDvbSubtitleConverter::Action: finish, WaitMs %d\n", WaitMs);

View File

@@ -19,6 +19,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* something is fishy with ppc compilers: if vector gets included later from
* iwscan.h it blows up in the c++config.h libstdc++ header...
* probably caused by the redefinition of the "inline" keyword in iwlib.h. */
#include <vector>
#include <sys/time.h>
extern "C" {
#include "iwlib.h" /* Header */

View File

@@ -1,5 +1,6 @@
AM_CPPFLAGS = \
@HWLIB_CFLAGS@ \
-I$(top_builddir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/lib/connection \

View File

@@ -28,6 +28,11 @@
#include <sectionsdclient/sectionsdclient.h>
#include <sectionsdclient/sectionsdMsg.h>
#ifdef PEDANTIC_VALGRIND_SETUP
#define VALGRIND_PARANOIA(x) memset(&x, 0, sizeof(x))
#else
#define VALGRIND_PARANOIA(x) {}
#endif
unsigned char CSectionsdClient::getVersion () const
{
@@ -59,6 +64,7 @@ int CSectionsdClient::readResponse(char* data,unsigned int size)
bool CSectionsdClient::send(const unsigned char command, const char* data, const unsigned int size)
{
sectionsd::msgRequestHeader msgHead;
VALGRIND_PARANOIA(msgHead);
msgHead.version = getVersion();
msgHead.command = command;
@@ -78,6 +84,7 @@ bool CSectionsdClient::send(const unsigned char command, const char* data, const
void CSectionsdClient::registerEvent(const unsigned int eventID, const unsigned int clientID, const char * const udsName)
{
CEventServer::commandRegisterEvent msg2;
VALGRIND_PARANOIA(msg2);
msg2.eventID = eventID;
msg2.clientID = clientID;
@@ -92,6 +99,7 @@ void CSectionsdClient::registerEvent(const unsigned int eventID, const unsigned
void CSectionsdClient::unRegisterEvent(const unsigned int eventID, const unsigned int clientID)
{
CEventServer::commandUnRegisterEvent msg2;
VALGRIND_PARANOIA(msg2);
msg2.eventID = eventID;
msg2.clientID = clientID;
@@ -150,6 +158,7 @@ bool CSectionsdClient::getIsScanningActive()
void CSectionsdClient::setServiceChanged(const t_channel_id channel_id, const bool requestEvent, int dnum)
{
sectionsd::commandSetServiceChanged msg;
VALGRIND_PARANOIA(msg);
msg.channel_id = channel_id;
msg.requestEvent = requestEvent;

View File

@@ -150,7 +150,16 @@ class CSectionsdClient : private CBasicClient
};
struct CurrentNextInfo : public responseGetCurrentNextInfoChannelID
{};
{
CurrentNextInfo() {
current_uniqueKey = 0;
current_name = "";
current_fsk = 0x0;
next_uniqueKey = 0;
next_name = "";
flags = 0x0;
}
};
typedef struct
{

View File

@@ -1,5 +1,6 @@
AM_CPPFLAGS = \
@HWLIB_CFLAGS@ \
-I$(top_builddir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/lib/connection \

View File

@@ -28,6 +28,12 @@
#include <timerdclient/timerdmsg.h>
#include <timerdclient/timerdclient.h>
#ifdef PEDANTIC_VALGRIND_SETUP
#define VALGRIND_PARANOIA(x) memset(&x, 0, sizeof(x))
#else
#define VALGRIND_PARANOIA(x) {}
#endif
unsigned char CTimerdClient::getVersion () const
{
return CTimerdMsg::ACTVERSION;
@@ -43,6 +49,7 @@ const char * CTimerdClient::getSocketName() const
void CTimerdClient::registerEvent(unsigned int eventID, unsigned int clientID, const char * const udsName)
{
CEventServer::commandRegisterEvent msg2;
VALGRIND_PARANOIA(msg2);
msg2.eventID = eventID;
msg2.clientID = clientID;
@@ -58,6 +65,7 @@ void CTimerdClient::registerEvent(unsigned int eventID, unsigned int clientID, c
void CTimerdClient::unRegisterEvent(unsigned int eventID, unsigned int clientID)
{
CEventServer::commandUnRegisterEvent msg2;
VALGRIND_PARANOIA(msg2);
msg2.eventID = eventID;
msg2.clientID = clientID;
@@ -165,6 +173,7 @@ bool CTimerdClient::modifyTimerEvent(int eventid, time_t announcetime, time_t al
// set new time values for event eventid
CTimerdMsg::commandModifyTimer msgModifyTimer;
VALGRIND_PARANOIA(msgModifyTimer);
msgModifyTimer.eventID = eventid;
msgModifyTimer.announceTime = announcetime;
msgModifyTimer.alarmTime = alarmtime;
@@ -203,6 +212,7 @@ bool CTimerdClient::rescheduleTimerEvent(int eventid, time_t diff)
bool CTimerdClient::rescheduleTimerEvent(int eventid, time_t announcediff, time_t alarmdiff, time_t stopdiff)
{
CTimerdMsg::commandModifyTimer msgModifyTimer;
VALGRIND_PARANOIA(msgModifyTimer);
msgModifyTimer.eventID = eventid;
msgModifyTimer.announceTime = announcediff;
msgModifyTimer.alarmTime = alarmdiff;
@@ -298,6 +308,9 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data,
CTimerd::TransferEventInfo tei;
CTimerd::TransferRecordingInfo tri;
CTimerdMsg::commandAddTimer msgAddTimer;
VALGRIND_PARANOIA(tei);
VALGRIND_PARANOIA(tri);
VALGRIND_PARANOIA(msgAddTimer);
msgAddTimer.alarmTime = alarmtime;
msgAddTimer.announceTime = announcetime;
msgAddTimer.stopTime = stoptime;
@@ -368,6 +381,8 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data,
void CTimerdClient::removeTimerEvent( int evId)
{
CTimerdMsg::commandRemoveTimer msgRemoveTimer;
VALGRIND_PARANOIA(msgRemoveTimer);
msgRemoveTimer.eventID = evId;
send(CTimerdMsg::CMD_REMOVETIMER, (char*) &msgRemoveTimer, sizeof(msgRemoveTimer));
@@ -436,6 +451,7 @@ bool CTimerdClient::shutdown()
void CTimerdClient::modifyTimerAPid(int eventid, unsigned char apids)
{
CTimerdMsg::commandSetAPid data;
VALGRIND_PARANOIA(data);
data.eventID=eventid;
data.apids = apids;
send(CTimerdMsg::CMD_SETAPID, (char*) &data, sizeof(data));
@@ -446,6 +462,7 @@ void CTimerdClient::modifyTimerAPid(int eventid, unsigned char apids)
void CTimerdClient::setRecordingSafety(int pre, int post)
{
CTimerdMsg::commandRecordingSafety data;
VALGRIND_PARANOIA(data);
data.pre = pre;
data.post = post;
send(CTimerdMsg::CMD_SETRECSAFETY, (char*) &data, sizeof(data));
@@ -518,6 +535,7 @@ void CTimerdClient::setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, std::string
void CTimerdClient::stopTimerEvent( int evId)
{
CTimerdMsg::commandRemoveTimer msgRemoveTimer;
VALGRIND_PARANOIA(msgRemoveTimer);
msgRemoveTimer.eventID = evId;

View File

@@ -21,6 +21,17 @@ Contributor(s):
#ifndef XmlTok_INCLUDED
#define XmlTok_INCLUDED 1
/* ugly: prefix all functions to avoid clashing with "real" libexpat
* or similar pulled in by other libs e.g. on PC */
#define XmlParseXmlDecl NEUTRINO_MP_XmlParseXmlDecl
#define XmlInitEncoding NEUTRINO_MP_XmlInitEncoding
#define XmlGetUtf8InternalEncoding NEUTRINO_MP_XmlGetUtf8InternalEncoding
#define XmlGetUtf16InternalEncoding NEUTRINO_MP_XmlGetUtf16InternalEncoding
#define XmlUtf8Encode NEUTRINO_MP_XmlUtf8Encode
#define XmlUtf16Encode NEUTRINO_MP_XmlUtf16Encode
#define XmlSizeOfUnknownEncoding NEUTRINO_MP_XmlSizeOfUnknownEncoding
#define XmlInitUnknownEncoding NEUTRINO_MP_XmlInitUnknownEncoding
#ifdef __cplusplus
extern "C" {
#endif