Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include "boxx.h"
+#include <stdlib.h>
+
+#include "defines.h"
#include "bitmap.h"
#include "log.h"
#include "osd.h"
-#include <stdlib.h>
+#include "boxx.h"
char Boxx::numBoxxes = 0;
Boxx::Boxx()
return area.y;
}
-int Boxx::getRootBoxOffsetX() // convert this to be getX and silently do the parent/not thing? same for Y below?
+int Boxx::getRootBoxOffsetX() // convert this to be getX and silently do the parent/not thing? same for Y below?
{
if (parent) return area.x + parent->getRootBoxOffsetX();
return 0;
while(1)
{
printLine = 0;
- unsigned int cur_length=1;
- wchar_t cur_char=getWChar(text+textPos,&cur_length);
+ UINT cur_length = 1;
+ wchar_t cur_char = getWChar(text + textPos, &cur_length);
if (cur_char == '\0') break;
if (cur_char == '\n')
{
- textPos+=cur_length; // ignore the \n
+ textPos += cur_length; // ignore the \n
printLine = 1;
break;
}
if (cur_char == ' ')
{
// this char is a space, ignore and break
- textPos+=cur_length;
+ textPos += cur_length;
break;
}
else
// Need to go back to the last space in the line
while ((cur_char != ' ') && (linePos >= 0))
{
- textPos-=cur_length;
- cur_char=getWChar(text+textPos,&cur_length);
+ textPos -= cur_length;
+ cur_char = getWChar(text + textPos, &cur_length);
linePos--;
}
// Now take the space we just found
- textPos+=cur_length;
+ textPos += cur_length;
break;
}
}
- for (int n=0;n<cur_length;n++) line[linePos++] = text[textPos+n];
+ for (UINT n = 0; n < cur_length; n++) line[linePos++] = text[textPos + n];
lineWidth += thisCharWidth;
- textPos+=cur_length;
+ textPos += cur_length;
}
// line[linePos++] = '\0';
- if (linePos>=0) line[linePos++] = '\0'; //Here is the change
+ if (linePos >= 0) line[linePos++] = '\0'; //Here is the change
if (printLine || (linePos > 1)) // if some text was put in line
{
else if (surface) surface->drawBitmap(x, y, bm, region);
}
-void Boxx::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
+void Boxx::drawJpeg(const char *fileName, int x, int y, int *width, int *height)
{
- if (parent) parent->drawJpeg(fileName,area.x +x,area.y +y,width,height);
- else if (surface) surface->drawJpeg(fileName,x,y,width,height);
+ if (parent) parent->drawJpeg(fileName, area.x + x, area.y + y, width, height);
+ else if (surface) surface->drawJpeg(fileName, x, y, width, height);
}
-void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour)
+void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, UINT height, UINT width, Colour& nextColour)
{
- if (parent) parent->drawMonoBitmap(base, area.x +dx,area.y +dy, height,width, nextColour);
- else if (surface) surface->drawMonoBitmap(base, dx,dy, height,width, nextColour);
+ if (parent) parent->drawMonoBitmap(base, area.x +dx, area.y + dy, height, width, nextColour);
+ else if (surface) surface->drawMonoBitmap(base, dx,dy, height, width, nextColour);
}
int Boxx::getFontHeight()
{
- if (parent) return parent->getFontHeight();
- else if (surface) return surface->getFontHeight();
- else return 18;
+ if (parent) return parent->getFontHeight();
+ else if (surface) return surface->getFontHeight();
+ else return 18;
}
void Boxx::startFastDraw()
{
- if (parent) parent->startFastDraw();
- else
- {
- if (surface) surface->startFastDraw();
- }
+ if (parent)
+ {
+ parent->startFastDraw();
+ }
+ else
+ {
+ if (surface) surface->startFastDraw();
+ }
}
void Boxx::endFastDraw()
{
- if (parent) parent->endFastDraw();
- else
- {
- if (surface) surface->endFastDraw();
- }
+ if (parent)
+ {
+ parent->endFastDraw();
+ }
+ else
+ {
+ if (surface) surface->endFastDraw();
+ }
}
-
float Boxx::charWidth(wchar_t c)
{
if (parent) return parent->charWidth(c);
- else if (surface) return surface->getCharWidth(c);
+ else if (surface) return surface->getCharWidth(c);
else return 16.; //?
}
-wchar_t Boxx::getWChar(const char* str, unsigned int *length)
+wchar_t Boxx::getWChar(const char* str, UINT *length)
{
- if (parent) return parent->getWChar(str,length);
- else if (surface) return surface->getWChar(str,length);
- else return '?'; //?
+ if (parent) return parent->getWChar(str, length);
+ else if (surface) return surface->getWChar(str, length);
+ else return '?'; //?
}
-Surface * Boxx::getSurface() {
+Surface* Boxx::getSurface()
+{
if (parent) return parent->getSurface();
return surface;
}
-
#include "playerliveradio.h"
+#include "defines.h"
#include "log.h"
#include "audio.h"
#include "demuxerts.h"
demuxer = new DemuxerTS();
if (!demuxer) return 0;
- if (!demuxer->init(this, audio, NULL, NULL, 0, 200000,0))
+ if (!demuxer->init(this, audio, NULL, NULL, 0, 200000, 0))
{
logger->log("PlayerLiveRadio", Log::ERR, "Demuxer failed to init");
shutdown();
if (!initted) return 0;
stop();
initted = false;
-
delete demuxer;
-
-
-
return 1;
}
return demuxer->getAID();
}
-int *PlayerLiveRadio::getTeletxtSubtitlePages(){
- return NULL;
+int* PlayerLiveRadio::getTeletxtSubtitlePages()
+{
+ return NULL;
}
-int PlayerLiveRadio::getCurrentSubtitleChannel(){
- return demuxer->getSubID();
+int PlayerLiveRadio::getCurrentSubtitleChannel()
+{
+ return demuxer->getSubID();
}
-void PlayerLiveRadio::setAudioChannel(int newChannel, int type,int streamtype)
+void PlayerLiveRadio::setAudioChannel(int newChannel, int type, int streamtype)
{
- demuxer->setAID(newChannel, type,streamtype,true);
+ demuxer->setAID(newChannel, type, streamtype, true);
}
void PlayerLiveRadio::setSubtitleChannel(int newChannel)
if (chan->numAPids > 0)
{
- int j=0;
- while (j<chan->numAPids && !found) {
- if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type)) {
- demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type,true);
- audio->setStreamType(Audio::MPEG2_PES);
- logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid,chan->apids[j].type);
- found=true;
- }
- j++;
- }
+ ULONG j = 0;
+ while (j < chan->numAPids && !found)
+ {
+ if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type))
+ {
+ demuxer->setAID(chan->apids[j].pid, 0, chan->apids[j].type, true);
+ audio->setStreamType(Audio::MPEG2_PES);
+ logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid, chan->apids[j].type);
+ found = true;
+ }
+ j++;
+ }
}
if (!found)
{
- if (chan->numDPids > 0 && audio->maysupportAc3())
- {
- int j=0;
- while (j<chan->numDPids && !found) {
- if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type)) {
- demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type,true);
- audio->setStreamType(Audio::MPEG2_PES);
- logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid,chan->dpids[j].type);
- found=true;
- }
- j++;
- }
- }
- else
- {
- logger->log("PlayerLiveRadio", Log::WARN, "Demuxer no pids!");
- }
+ if (chan->numDPids > 0 && audio->maysupportAc3())
+ {
+ ULONG j = 0;
+ while (j < chan->numDPids && !found)
+ {
+ if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type))
+ {
+ demuxer->setAID(chan->dpids[j].pid, 1, chan->dpids[j].type, true);
+ audio->setStreamType(Audio::MPEG2_PES);
+ logger->log("PlayerLiveRadio", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid, chan->dpids[j].type);
+ found=true;
+ }
+ j++;
+ }
+ }
+ else
+ {
+ logger->log("PlayerLiveRadio", Log::WARN, "Demuxer no pids!");
+ }
}
-
-
int streamSuccess = vdr->streamChannel(chan->number, this);
if (!checkError() && !streamSuccess)
{
logger->log("PlayerLiveRadio", Log::DEBUG, "End of thread");
}
-
#include "playerlivetv.h"
+#include "defines.h"
#include "log.h"
#include "audio.h"
#include "video.h"
teletext = new TeletextDecoderVBIEBU();
- unsigned int demux_video_size=2097152;
- unsigned int demux_audio_size=524288;
- if (video->supportsh264()) {
- demux_video_size*=5*1;//5;
+ unsigned int demux_video_size = 2097152;
+ unsigned int demux_audio_size = 524288;
- }
- if (audio->maysupportAc3()) {
- //demux_audio_size*=2;
- }
+ if (video->supportsh264())
+ {
+ demux_video_size *= 5 * 1;//5;
+ }
+
+ if (audio->maysupportAc3())
+ {
+ //demux_audio_size*=2;
+ }
- int text_fak=video->getTeletextBufferFaktor();
+ int text_fak = video->getTeletextBufferFaktor();
-
- if (!demuxer->init(this, audio, video, teletext, demux_video_size,demux_audio_size, 65536*text_fak,25./*unimportant*/,subtitles))
+ if (!demuxer->init(this, audio, video, teletext, demux_video_size, demux_audio_size, 65536 * text_fak, 25./*unimportant*/, subtitles))
{
logger->log("PlayerLiveTV", Log::ERR, "Demuxer failed to init");
shutdown();
void PlayerLiveTV::setAudioChannel(int newChannel, int type,int streamtype)
{
- demuxer->setAID(newChannel,type,streamtype,true);
+ demuxer->setAID(newChannel, type, streamtype, true);
}
void PlayerLiveTV::setSubtitleChannel(int newChannel)
{
- demuxer->setSubID(newChannel);
+ demuxer->setSubID(newChannel);
}
-int *PlayerLiveTV::getTeletxtSubtitlePages()
+int* PlayerLiveTV::getTeletxtSubtitlePages()
{
- return teletext->getSubtitlePages();
+ return teletext->getSubtitlePages();
}
-int PlayerLiveTV::getCurrentSubtitleChannel(){
- return demuxer->getSubID();
+int PlayerLiveTV::getCurrentSubtitleChannel()
+{
+ return demuxer->getSubID();
}
bool PlayerLiveTV::toggleSubtitles()
return subtitlesShowing;
}
-
-void PlayerLiveTV::turnSubtitlesOn(bool ison) {
- if (ison)
+void PlayerLiveTV::turnSubtitlesOn(bool ison)
+{
+ if (ison)
{
subtitlesShowing = true;
subtitles->show();
subtitlesShowing = false;
subtitles->hide();
}
-
}
void PlayerLiveTV::tellSubtitlesOSDVisible(bool visible)
{
-subtitles->setOSDMenuVisibility(visible);
+ subtitles->setOSDMenuVisibility(visible);
}
// ----------------------------------- Externally called events
logger->log("PlayerLiveTV", Log::DEBUG, "Callback from demuxer");
int parx,pary;
- int dxCurrentAspect = demuxer->getAspectRatio(&parx,&pary);
+ int dxCurrentAspect = demuxer->getAspectRatio(&parx, &pary);
if (dxCurrentAspect == Demuxer::ASPECT_4_3)
{
if (video->getTVsize() == Video::ASPECT16X9)
{
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV");
- video->setAspectRatio(Video::ASPECT4X3,parx,pary);
+ video->setAspectRatio(Video::ASPECT4X3, parx, pary);
}
else
{
if (video->getTVsize() == Video::ASPECT16X9)
{
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is 16:9 aspect, switching TV");
- video->setAspectRatio(Video::ASPECT16X9,parx,pary);
+ video->setAspectRatio(Video::ASPECT16X9, parx, pary);
}
else
{
else
{
logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer said video is something else... switch anyway");
- video->setAspectRatio( dxCurrentAspect,parx,pary);
+ video->setAspectRatio(dxCurrentAspect, parx, pary);
}
}
else if (caller == &afeed)
/* int a =*/ demuxer->put((UCHAR*)s.data, s.len);
// logger->log("PlayerLiveTV", Log::DEBUG, "put %i to demuxer", a);
free(s.data);
- if (pendingAudioPlay && (demuxer->getHorizontalSize()|| !video->independentAVStartUp())) //Horizontal Size is zero, if not parsed
+ if (pendingAudioPlay && (demuxer->getHorizontalSize() || !video->independentAVStartUp())) //Horizontal Size is zero, if not parsed
{
- video->sync();
- video->play();
- video->pause();
- //audio->setStreamType(Audio::MPEG2_PES);
- audio->sync();
- audio->play();
- audio->pause();
- pendingAudioPlay = false;
+ video->sync();
+ video->play();
+ video->pause();
+ //audio->setStreamType(Audio::MPEG2_PES);
+ audio->sync();
+ audio->play();
+ audio->pause();
+ pendingAudioPlay = false;
}
}
tfeed.start();
state = newState;
- if (!video->independentAVStartUp()){
- videoStartup = true;
- threadSignalNoLock();
+ if (!video->independentAVStartUp())
+ {
+ videoStartup = true;
+ threadSignalNoLock();
}
return;
}
case S_VIDEOSTARTUP:
{
-
vdr->stopStreaming();
clearStreamChunks();
vfeed.stop();
subtitles->start();
tfeed.start();
state = newState;
- if (!video->independentAVStartUp()){
- videoStartup = true;
- threadSignalNoLock();
+ if (!video->independentAVStartUp())
+ {
+ videoStartup = true;
+ threadSignalNoLock();
}
return;
}
subtitles->start();
tfeed.start();
state = newState;
- if (!video->independentAVStartUp()){
- videoStartup = true;
- threadSignalNoLock();
+ if (!video->independentAVStartUp())
+ {
+ videoStartup = true;
+ threadSignalNoLock();
}
return;
}
logger->log("PlayerLiveTV", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState);
abort();
break;
- }
+ }
}
}
}
{
while(1)
{
-
- //logger->log("PlayerLiveTV", Log::DEBUG, "VS: %d pA %d",videoStartup,pendingAudioPlay);
+ //logger->log("PlayerLiveTV", Log::DEBUG, "VS: %d pA %d",videoStartup,pendingAudioPlay);
if (videoStartup && !pendingAudioPlay) // we are in S_VIDEOSTARTUP, afeed has signalled that it has written some data
{
- logger->log("PlayerLiveTV", Log::DEBUG, "Enter prebuffering");
+ logger->log("PlayerLiveTV", Log::DEBUG, "Enter prebuffering");
switchState(S_PREBUFFERING);
videoStartup = false;
preBufferCount = 0;
-
checkError();
}
if (i.instruction == I_SETCHANNEL)
{
logger->log("PlayerLiveTV", Log::DEBUG, "start new stream");
-
switchState(S_VIDEOSTARTUP);
if (chan->numAPids > 0)
{
- int j=0;
- while (j<chan->numAPids && !found) {
- if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type)) {
- demuxer->setAID(chan->apids[j].pid,0,chan->apids[j].type,true);
- audio->setStreamType(Audio::MPEG2_PES);
- logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid,chan->apids[j].type);
- found=true;
- }
- j++;
- }
+ ULONG j = 0;
+ while (j < chan->numAPids && !found)
+ {
+ if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type))
+ {
+ demuxer->setAID(chan->apids[j].pid, 0, chan->apids[j].type, true);
+ audio->setStreamType(Audio::MPEG2_PES);
+ logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u %u", chan->vpid, chan->apids[j].pid, chan->apids[j].type);
+ found = true;
+ }
+ j++;
+ }
}
if (!found)
{
- if (chan->numDPids > 0 && audio->maysupportAc3())
- {
- int j=0;
- while (j<chan->numDPids && !found) {
- if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type)) {
- demuxer->setAID(chan->dpids[j].pid,1,chan->dpids[j].type,true);
- audio->setStreamType(Audio::MPEG2_PES);
- logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid,chan->dpids[j].type);
- found=true;
- }
- j++;
- }
- }
- else
+ if (chan->numDPids > 0 && audio->maysupportAc3())
+ {
+ ULONG j = 0;
+ while (j < chan->numDPids && !found)
{
- logger->log("PlayerLiveTV", Log::WARN, "Demuxer video pid only: %u", chan->vpid);
+ if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type))
+ {
+ demuxer->setAID(chan->dpids[j].pid, 1, chan->dpids[j].type, true);
+ audio->setStreamType(Audio::MPEG2_PES);
+ logger->log("PlayerLiveTV", Log::DEBUG, "Demuxer pids: %u %u (ac3) %u", chan->vpid, chan->dpids[j].pid, chan->dpids[j].type);
+ found = true;
+ }
+ j++;
}
+ }
+ else
+ {
+ logger->log("PlayerLiveTV", Log::WARN, "Demuxer video pid only: %u", chan->vpid);
+ }
}
+
if (chan->numSPids > 0)
demuxer->setSubID(chan->spids[0].pid);
+
demuxer->setTID(chan->tpid);
teletext->ResetDecoder();
int streamSuccess = vdr->streamChannel(chan->number, this);
}
}
- threadCheckExit();
+ threadCheckExit();
if (stopNow) break;
while(streamChunks.size())
{
- //logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark1 %d", streamChunks.size());
+ //logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark1 %d", streamChunks.size());
chunkToDemuxer();
//logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark2 %d", streamChunks.size());
if (state == S_PREBUFFERING)
{
- // logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark3");
+ // logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark3");
++preBufferCount;
ULONG percentDone = (ULONG)(preBufferCount / (float)preBufferAmount * 100);
logger->log("PlayerLiveTV", Log::DEBUG, "Prebuffering %lu%%", percentDone);
}
}
}
- // logger->log("PlayerLiveTV", Log::DEBUG, "wait for signal %d", streamChunks.size());
+ //logger->log("PlayerLiveTV", Log::DEBUG, "wait for signal %d", streamChunks.size());
threadLock();
threadWaitForSignal(); // unlocks and waits for signal
threadUnlock();
logger->log("PlayerLiveTV", Log::DEBUG, "End of thread");
}
-