diff --git a/azbox/Makefile.am b/azbox/Makefile.am index 46a3f6c..0e6b74f 100644 --- a/azbox/Makefile.am +++ b/azbox/Makefile.am @@ -1,8 +1,8 @@ -INCLUDES = \ - -I$(top_srcdir)/common - noinst_LTLIBRARIES = libazbox.la +AM_CPPFLAGS = \ + -I$(top_srcdir)/common + AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = -lpthread diff --git a/azbox/dmx.cpp b/azbox/dmx.cpp index 1fe5561..a68327c 100644 --- a/azbox/dmx.cpp +++ b/azbox/dmx.cpp @@ -43,10 +43,10 @@ extern cVideo *videoDecoder; #define dmx_err(_errfmt, _errstr, _revents) do { \ uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PES_CHANNEL) { \ - _pid = p_flt.pid; \ - } else if (dmx_type == DMX_PSI_CHANNEL) { \ + if (dmx_type == DMX_PSI_CHANNEL) { \ _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ + } else { \ + _pid = p_flt.pid; \ }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ diff --git a/azbox/playback.cpp b/azbox/playback.cpp index 4523192..1e656f3 100644 --- a/azbox/playback.cpp +++ b/azbox/playback.cpp @@ -336,7 +336,7 @@ bool cPlayback::SetAPid(unsigned short pid, int /*ac3*/) return true; } -bool cPlayback::SetSPid(int pid) +bool cPlayback::SelectSubtitles(int pid) { lt_info("%s: pid %i\n", __func__, pid); if (pid != subpid) @@ -464,7 +464,7 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t } } -void cPlayback::FindAllSPids(int *spids, uint16_t *numpids, std::string *language) +void cPlayback::FindAllSubs(uint16_t *spids, unsigned short *supported, uint16_t *numpids, std::string *language) { lt_info("%s\n", __func__); char buf[32]; @@ -487,6 +487,7 @@ void cPlayback::FindAllSPids(int *spids, uint16_t *numpids, std::string *languag spu_lang[20] = '\0'; spids[sid] = atoi(streamidstring); language[sid] = spu_lang; + supported[sid] = 1; lt_info("%s: #%d apid:%d lang: %s\n", __func__, sid, spids[sid], spu_lang); } } @@ -496,6 +497,13 @@ void cPlayback::FindAllSPids(int *spids, uint16_t *numpids, std::string *languag language[spu_count] = "Disable"; } +/* DVD support is not yet ready... */ +void cPlayback::GetChapters(std::vector &positions, std::vector &titles) +{ + positions.clear(); + titles.clear(); +} + cPlayback::cPlayback(int /*num*/) { lt_info("%s: constructor\n", __func__); diff --git a/azbox/playback.h b/azbox/playback.h index d75a76f..c56c69e 100644 --- a/azbox/playback.h +++ b/azbox/playback.h @@ -3,6 +3,7 @@ #include #include +#include typedef enum { PLAYMODE_TS = 0, @@ -42,9 +43,9 @@ class cPlayback bool GetPosition(int &position, int &duration); /* pos: current time in ms, dur: file length in ms */ bool SetPosition(int position, bool absolute = false); /* position: jump in ms */ void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); - // AZbox specific - void FindAllSPids(int *spids, uint16_t *numpids, std::string *language); - bool SetSPid(int pid); + void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); + bool SelectSubtitles(int pid); + void GetChapters(std::vector &positions, std::vector &titles); #if 0 // Functions that are not used by movieplayer.cpp: bool Stop(void); diff --git a/configure.ac b/configure.ac index 88dbf02..cf816f5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -AC_INIT(libstb-hal,0.1.1) -AM_INIT_AUTOMAKE(libstb-hal,0.1.1) +AC_INIT([libstb-hal], [0.1.1]) +AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) AC_CONFIG_MACRO_DIR([m4]) AC_GNU_SOURCE diff --git a/generic-pc/Makefile.am b/generic-pc/Makefile.am index 130e419..f4dbbc7 100644 --- a/generic-pc/Makefile.am +++ b/generic-pc/Makefile.am @@ -1,9 +1,9 @@ -INCLUDES = \ - -I$(top_srcdir)/common - noinst_LTLIBRARIES = libgeneric.la AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS +AM_CPPFLAGS += \ + -I$(top_srcdir)/common + AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = \ diff --git a/generic-pc/dmx.cpp b/generic-pc/dmx.cpp index 19d8fc4..fe1d161 100644 --- a/generic-pc/dmx.cpp +++ b/generic-pc/dmx.cpp @@ -35,16 +35,20 @@ #include "dmx_lib.h" #include "lt_debug.h" +/* needed for getSTC :-( */ +#include "video_lib.h" +extern cVideo *videoDecoder; + #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PES_CHANNEL) { \ - _pid = p_flt.pid; \ - } else if (dmx_type == DMX_PSI_CHANNEL) { \ + if (dmx_type == DMX_PSI_CHANNEL) { \ _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ + } else { \ + _pid = p_flt.pid; \ }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ @@ -120,7 +124,9 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe num, DMX_T[pes_type], pes_type, uBufferSize, fd); if (dmx_type == DMX_VIDEO_CHANNEL) - uBufferSize = 0x40000; + uBufferSize = 0x100000; /* 1MB */ + if (dmx_type == DMX_AUDIO_CHANNEL) + uBufferSize = 0x10000; /* 64k */ #if 0 if (!pesfds.empty()) { @@ -472,6 +478,8 @@ void cDemux::removePid(unsigned short Pid) void cDemux::getSTC(int64_t * STC) { int64_t pts = 0; + if (videoDecoder) + pts = videoDecoder->GetPTS(); *STC = pts; } diff --git a/generic-pc/playback.cpp b/generic-pc/playback.cpp index e70d8d0..b5795a5 100644 --- a/generic-pc/playback.cpp +++ b/generic-pc/playback.cpp @@ -26,6 +26,12 @@ bool cPlayback::SetAPid(unsigned short pid, bool /*ac3*/) return true; } +bool cPlayback::SelectSubtitles(int pid) +{ + printf("%s:%s pid %i\n", FILENAME, __func__, pid); + return true; +} + bool cPlayback::SetSpeed(int speed) { printf("%s:%s playing %d speed %d\n", FILENAME, __func__, playing, speed); @@ -99,6 +105,18 @@ unsigned short cPlayback::GetTeletextPid(void) { } +void cPlayback::FindAllSubs(uint16_t *, unsigned short *, uint16_t *numpida, std::string *) +{ + printf("%s:%s\n", FILENAME, __func__); + *numpida = 0; +} + +void cPlayback::GetChapters(std::vector &positions, std::vector &titles) +{ + positions.clear(); + titles.clear(); +} + cPlayback::cPlayback(int /*num*/) { printf("%s:%s\n", FILENAME, __func__); diff --git a/generic-pc/playback.h b/generic-pc/playback.h index be5d1fc..c7f4628 100644 --- a/generic-pc/playback.h +++ b/generic-pc/playback.h @@ -3,6 +3,7 @@ #include #include +#include typedef enum { PLAYMODE_TS = 0, @@ -43,6 +44,9 @@ class cPlayback void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); void RequestAbort(void); + void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); + bool SelectSubtitles(int pid); + void GetChapters(std::vector &positions, std::vector &titles); // cPlayback(int num = 0); ~cPlayback(); diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index 03b9af7..7ec5055 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -650,3 +650,13 @@ bool cVideo::GetScreenImage(unsigned char * &data, int &xres, int &yres, bool ge return true; } + +int64_t cVideo::GetPTS(void) +{ + int64_t pts = 0; + buf_m.lock(); + if (buf_num != 0) + pts = buffers[buf_out].pts(); + buf_m.unlock(); + return pts; +} diff --git a/generic-pc/video_lib.h b/generic-pc/video_lib.h index f766c59..d6edb32 100644 --- a/generic-pc/video_lib.h +++ b/generic-pc/video_lib.h @@ -122,6 +122,7 @@ typedef enum class cVideo : public OpenThreads::Thread { friend class GLFramebuffer; + friend class cDemux; private: /* called from GL thread */ class SWFramebuffer : public std::vector @@ -143,6 +144,7 @@ class cVideo : public OpenThreads::Thread AVRational mAR; }; int buf_in, buf_out, buf_num; + int64_t GetPTS(void); public: /* constructor & destructor */ cVideo(int mode, void *, void *); diff --git a/libeplayer3/Makefile.am b/libeplayer3/Makefile.am index 56ef705..0746290 100644 --- a/libeplayer3/Makefile.am +++ b/libeplayer3/Makefile.am @@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libeplayer3.la CXXFLAGS = -Wall -INCLUDES = \ +AM_CPPFLAGS = \ -I$(srcdir)/include libeplayer3_la_SOURCES = \ diff --git a/libspark/Makefile.am b/libspark/Makefile.am index 8379f32..8785395 100644 --- a/libspark/Makefile.am +++ b/libspark/Makefile.am @@ -1,9 +1,9 @@ -INCLUDES = \ +noinst_LTLIBRARIES = libspark.la + +AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/libeplayer3/include -noinst_LTLIBRARIES = libspark.la - AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = -lpthread -lasound -lass \ @AVFORMAT_LIBS@ \ diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index 3d51a91..0dabea8 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -78,10 +78,10 @@ extern cVideo *videoDecoder; #define dmx_err(_errfmt, _errstr, _revents) do { \ uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PES_CHANNEL) { \ - _pid = p_flt.pid; \ - } else if (dmx_type == DMX_PSI_CHANNEL) { \ + if (dmx_type == DMX_PSI_CHANNEL) { \ _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ + } else { \ + _pid = p_flt.pid; \ }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ diff --git a/libspark/playback_libeplayer3.cpp b/libspark/playback_libeplayer3.cpp index 57f2d43..bc113fa 100644 --- a/libspark/playback_libeplayer3.cpp +++ b/libspark/playback_libeplayer3.cpp @@ -667,6 +667,26 @@ unsigned short cPlayback::GetTeletextPid(void) return (unsigned short)pid; } +/* dummy functions for subtitles */ +void cPlayback::FindAllSubs(uint16_t * /*pids*/, unsigned short * /*supp*/, uint16_t *num, std::string * /*lang*/) +{ + *num = 0; +} + +bool cPlayback::SelectSubtitles(int pid) +{ + printf("%s:%s pid %d\n", FILENAME, __func__, pid); + return false; +} + +/* another dummy function for DVD playback(?) */ +void cPlayback::GetChapters(std::vector &positions, std::vector &titles) +{ + positions.clear(); + titles.clear(); +} + +// cPlayback::cPlayback(int num __attribute__((unused)), void (*fbcb)(unsigned char **, unsigned int *, unsigned int *, unsigned int *, int *)) { printf("%s:%s\n", FILENAME, __FUNCTION__); diff --git a/libspark/playback_libeplayer3.h b/libspark/playback_libeplayer3.h index a13c446..a07834e 100644 --- a/libspark/playback_libeplayer3.h +++ b/libspark/playback_libeplayer3.h @@ -2,6 +2,7 @@ #define __HAL_PLAYBACK_H #include +#include typedef enum { PLAYMODE_TS = 0, @@ -45,8 +46,10 @@ class cPlayback void FindAllSubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllDvbsubtitlePids(uint16_t *pids, uint16_t *numpids, std::string *language); void FindAllTeletextsubtitlePids(uint16_t *pids, uint16_t *numpidt, std::string *tlanguage); - void RequestAbort(void); + void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); + bool SelectSubtitles(int pid); + void GetChapters(std::vector &positions, std::vector &titles); #if 0 // Functions that are not used by movieplayer.cpp: bool GetOffset(off64_t &offset); diff --git a/libtriple/Makefile.am b/libtriple/Makefile.am index 1bad773..6df87cb 100644 --- a/libtriple/Makefile.am +++ b/libtriple/Makefile.am @@ -1,9 +1,9 @@ -INCLUDES = \ +noinst_LTLIBRARIES = libtriple.la + +AM_CPPFLAGS = \ -I$(top_srcdir)/common \ @DIRECTFB_CFLAGS@ -noinst_LTLIBRARIES = libtriple.la - AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = \ @DIRECTFB_LIBS@ diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index 7ae9ffe..92242d3 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -40,10 +40,10 @@ extern cVideo *videoDecoder; #define dmx_err(_errfmt, _errstr, _revents) do { \ uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PES_CHANNEL) { \ - _pid = p_flt.pid; \ - } else if (dmx_type == DMX_PSI_CHANNEL) { \ + if (dmx_type == DMX_PSI_CHANNEL) { \ _pid = s_flt.pid; _f = s_flt.filter[0]; \ + } else { \ + _pid = p_flt.pid; \ }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ diff --git a/libtriple/playback_td.cpp b/libtriple/playback_td.cpp index a1c02e7..2fee33a 100644 --- a/libtriple/playback_td.cpp +++ b/libtriple/playback_td.cpp @@ -576,6 +576,24 @@ void cPlayback::FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida = i; } +/* it is unlikely that subtitle support will be implemented soon */ +void cPlayback::FindAllSubs(uint16_t *, unsigned short *, uint16_t *num, std::string *) +{ + *num = 0; +} + +bool cPlayback::SelectSubtitles(int) +{ + return false; +} + +/* DVD support is also unlikely... */ +void cPlayback::GetChapters(std::vector &positions, std::vector &titles) +{ + positions.clear(); + titles.clear(); +} + off_t cPlayback::seek_to_pts(int64_t pts) { off_t newpos = curr_pos; diff --git a/libtriple/playback_td.h b/libtriple/playback_td.h index dcb78e3..51d5ac1 100644 --- a/libtriple/playback_td.h +++ b/libtriple/playback_td.h @@ -109,6 +109,9 @@ class cPlayback bool GetPosition(int &position, int &duration); /* pos: current time in ms, dur: file length in ms */ bool SetPosition(int position, bool absolute = false); /* position: jump in ms */ void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); + void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language); + bool SelectSubtitles(int pid); + void GetChapters(std::vector &positions, std::vector &titles); #if 0 // Functions that are not used by movieplayer.cpp: bool Stop(void);