From 7b2563cd3851bb8deb9aed6e2043b87b1fc5b063 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 25 Nov 2008 19:07:44 +0100 Subject: some refcounting fixes and speedups --- lib/dvb/pmt.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/dvb/pmt.cpp') diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 842d6979..25ac5465 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -1143,8 +1143,8 @@ void eDVBCAService::sendCAPMT() static PyObject *createTuple(int pid, const char *type) { PyObject *r = PyTuple_New(2); - PyTuple_SetItem(r, 0, PyInt_FromLong(pid)); - PyTuple_SetItem(r, 1, PyString_FromString(type)); + PyTuple_SET_ITEM(r, 0, PyInt_FromLong(pid)); + PyTuple_SET_ITEM(r, 1, PyString_FromString(type)); return r; } @@ -1154,17 +1154,18 @@ static inline void PyList_AppendSteal(PyObject *list, PyObject *item) Py_DECREF(item); } +extern void PutToDict(ePyObject &dict, const char*key, ePyObject item); // defined in dvb/frontend.cpp + PyObject *eDVBServicePMTHandler::program::createPythonObject() { - PyObject *r = PyDict_New(); + ePyObject r = PyDict_New(); + ePyObject l = PyList_New(0); - PyObject *l = PyList_New(0); - PyList_AppendSteal(l, createTuple(0, "pat")); if (pmtPid != -1) PyList_AppendSteal(l, createTuple(pmtPid, "pmt")); - + for (std::vector::const_iterator i(videoStreams.begin()); i != videoStreams.end(); ++i) @@ -1184,7 +1185,8 @@ PyObject *eDVBServicePMTHandler::program::createPythonObject() if (textPid != -1) PyList_AppendSteal(l, createTuple(textPid, "text")); - - PyDict_SetItemString(r, "pids", l); + + PutToDict(r, "pids", l); + return r; } -- cgit v1.2.3 From 5e51797eb41e94004ac12c5303ca10000e04397e Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 18 Dec 2008 16:58:13 +0100 Subject: dont use pat/pmt when the dxNoDVB Flag is set --- lib/dvb/pmt.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/dvb/pmt.cpp') diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 25ac5465..0c21272a 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -50,10 +50,13 @@ void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel) { eDebug("ok ... now we start!!"); - if (m_pmt_pid == -1) - m_PAT.begin(eApp, eDVBPATSpec(), m_demux); - else - m_PMT.begin(eApp, eDVBPMTSpec(m_pmt_pid, m_reference.getServiceID().get()), m_demux); + if (!m_service || m_service->usePMT()) + { + if (m_pmt_pid == -1) + m_PAT.begin(eApp, eDVBPATSpec(), m_demux); + else + m_PMT.begin(eApp, eDVBPMTSpec(m_pmt_pid, m_reference.getServiceID().get()), m_demux); + } if ( m_service && !m_service->cacheEmpty() ) serviceEvent(eventNewProgramInfo); -- cgit v1.2.3 From a0f0f0b446b7b0fd941194299fa4840b609df1f0 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 20 Jan 2009 23:39:33 +0100 Subject: support much more audio/video codecs encapsulated in TS files (not all stb hardware can handle all codecs!!!) --- lib/dvb/decoder.cpp | 41 +++++++++++++++++++++++++---- lib/dvb/decoder.h | 4 +-- lib/dvb/pmt.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++--- lib/dvb/pmt.h | 4 +-- lib/service/servicedvb.cpp | 2 ++ 5 files changed, 104 insertions(+), 12 deletions(-) (limited to 'lib/dvb/pmt.cpp') diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 8bc07e60..065a49c2 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -187,11 +187,15 @@ int eDVBAudio::startPid(int pid, int type) case aAC3: bypass = 0; break; - /* case aDTS: bypass = 2; break; - */ + case aAAC: + bypass = 8; + break; + case aAACHE: + bypass = 9; + break; } eDebugNoNewLine("AUDIO_SET_BYPASS - "); @@ -334,6 +338,10 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev) // not finally values i think.. !! #define VIDEO_STREAMTYPE_MPEG2 0 #define VIDEO_STREAMTYPE_MPEG4_H264 1 +#define VIDEO_STREAMTYPE_VC1 3 +#define VIDEO_STREAMTYPE_MPEG4_Part2 4 +#define VIDEO_STREAMTYPE_VC1_SM 5 +#define VIDEO_STREAMTYPE_MPEG1 6 #if HAVE_DVB_API_VERSION < 3 int eDVBVideo::setPid(int pid) @@ -395,13 +403,36 @@ int eDVBVideo::stopPid() #else int eDVBVideo::startPid(int pid, int type) { + int streamtype = VIDEO_STREAMTYPE_MPEG2; + if ((m_fd < 0) || (m_fd_demux < 0)) return -1; dmx_pes_filter_params pes; - eDebugNoNewLine("VIDEO_SET_STREAMTYPE %d - ",type == MPEG4_H264 ? VIDEO_STREAMTYPE_MPEG4_H264 : VIDEO_STREAMTYPE_MPEG2); - if (::ioctl(m_fd, VIDEO_SET_STREAMTYPE, - type == MPEG4_H264 ? VIDEO_STREAMTYPE_MPEG4_H264 : VIDEO_STREAMTYPE_MPEG2) < 0) + switch(type) + { + default: + case MPEG2: + break; + case MPEG4_H264: + streamtype = VIDEO_STREAMTYPE_MPEG4_H264; + break; + case MPEG1: + streamtype = VIDEO_STREAMTYPE_MPEG1; + break; + case MPEG4_Part2: + streamtype = VIDEO_STREAMTYPE_MPEG4_Part2; + break; + case VC1: + streamtype = VIDEO_STREAMTYPE_VC1; + break; + case VC1_SM: + streamtype = VIDEO_STREAMTYPE_VC1_SM; + break; + } + + eDebugNoNewLine("VIDEO_SET_STREAMTYPE %d - ", streamtype); + if (::ioctl(m_fd, VIDEO_SET_STREAMTYPE, streamtype) < 0) eDebug("failed (%m)"); else eDebug("ok"); diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index 5b9d352a..f2e10bb9 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -13,7 +13,7 @@ private: ePtr m_demux; int m_fd, m_fd_demux, m_dev, m_is_freezed; public: - enum { aMPEG, aAC3, aDTS, aAAC }; + enum { aMPEG, aAC3, aDTS, aAAC, aAACHE }; eDVBAudio(eDVBDemux *demux, int dev); enum { aMonoLeft, aStereo, aMonoRight }; void setChannel(int channel); @@ -49,7 +49,7 @@ private: Signal1 m_event; int m_width, m_height, m_framerate, m_aspect, m_progressive; public: - enum { MPEG2, MPEG4_H264 }; + enum { MPEG2, MPEG4_H264, MPEG1, MPEG4_Part2, VC1, VC1_SM }; eDVBVideo(eDVBDemux *demux, int dev); void stop(); #if HAVE_DVB_API_VERSION < 3 diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index 0c21272a..279ec74f 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -16,6 +16,7 @@ #include #include #include +#include eDVBServicePMTHandler::eDVBServicePMTHandler() :m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF) @@ -217,25 +218,49 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) audioStream audio; audio.component_tag=video.component_tag=-1; video.type = videoStream::vtMPEG2; + audio.type = audioStream::atMPEG; switch ((*es)->getType()) { case 0x1b: // AVC Video Stream (MPEG4 H264) video.type = videoStream::vtMPEG4_H264; + isvideo = 1; + //break; fall through !!! + case 0x10: // MPEG 4 Part 2 + if (!isvideo) + { + video.type = videoStream::vtMPEG4_Part2; + isvideo = 1; + } + //break; fall through !!! case 0x01: // MPEG 1 video + if (!isvideo) + video.type = videoStream::vtMPEG1; + //break; fall through !!! case 0x02: // MPEG 2 video isvideo = 1; //break; fall through !!! case 0x03: // MPEG 1 audio case 0x04: // MPEG 2 audio: if (!isvideo) + isaudio = 1; + //break; fall through !!! + case 0x0f: // MPEG 2 AAC + if (!isvideo && !isaudio) { isaudio = 1; - audio.type = audioStream::atMPEG; + audio.type = audioStream::atAAC; } //break; fall through !!! + case 0x11: // MPEG 4 AAC + if (!isvideo && !isaudio) + { + isaudio = 1; + audio.type = audioStream::atAACHE; + } case 0x06: // PES Private case 0x81: // user private + case 0xEA: // TS_PSI_ST_SMPTE_VC1 for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin(); desc != (*es)->getDescriptors()->end(); ++desc) { @@ -246,6 +271,17 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) check descriptors to get the exakt type. */ switch (tag) { + case AUDIO_STREAM_DESCRIPTOR: + isaudio = 1; + break; + case VIDEO_STREAM_DESCRIPTOR: + { + isvideo = 1; + VideoStreamDescriptor *d = (VideoStreamDescriptor*)(*desc); + if (d->getMpeg1OnlyFlag()) + video.type = videoStream::vtMPEG1; + break; + } case SUBTITLING_DESCRIPTOR: { SubtitlingDescriptor *d = (SubtitlingDescriptor*)(*desc); @@ -304,9 +340,14 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) isaudio = 1; audio.type = audioStream::atDTS; break; + case 0x2B: // TS_PSI_DT_MPEG2_AAC + isaudio = 1; + audio.type = audioStream::atAAC; // MPEG2-AAC + break; + case 0x1C: // TS_PSI_DT_MPEG4_Audio case AAC_DESCRIPTOR: isaudio = 1; - audio.type = audioStream::atAAC; + audio.type = audioStream::atAACHE; // MPEG4-AAC break; case AC3_DESCRIPTOR: isaudio = 1; @@ -315,7 +356,7 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) case REGISTRATION_DESCRIPTOR: /* some services don't have a separate AC3 descriptor */ { /* libdvbsi++ doesn't yet support this descriptor type, so work around. */ - if ((*desc)->getLength() != 4) + if ((*desc)->getLength() < 4) break; unsigned char descr[6]; (*desc)->writeToBuffer(descr); @@ -326,11 +367,29 @@ int eDVBServicePMTHandler::getProgramInfo(struct program &program) isaudio = 1; audio.type = audioStream::atAC3; break; + case 0x56432d31: + if (descr[6] == 0x01) // subdescriptor tag + { + if (descr[7] >= 0x90) // profile_level + video.type = videoStream::vtVC1; // advanced profile + else + video.type = videoStream::vtVC1_SM; // simple main + isvideo = 1; + } + break; default: break; } break; } + case 0x28: // TS_PSI_DT_AVC + isvideo = 1; + video.type = videoStream::vtMPEG4_H264; + break; + case 0x1B: // TS_PSI_DT_MPEG4_Video + isvideo = 1; + video.type = videoStream::vtMPEG4_Part2; + break; default: break; } diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index ff0ef046..3e22174b 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -135,14 +135,14 @@ public: { int pid; int component_tag; - enum { vtMPEG2, vtMPEG4_H264 }; + enum { vtMPEG2, vtMPEG4_H264, vtMPEG1, vtMPEG4_Part2, vtVC1, vtVC1_SM }; int type; }; struct audioStream { int pid; - enum { atMPEG, atAC3, atDTS, atAAC }; + enum { atMPEG, atAC3, atDTS, atAAC, atAACHE }; int type; // mpeg2, ac3, dts, ... int component_tag; diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 59831680..d4a3a562 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -1600,6 +1600,8 @@ RESULT eDVBServicePlay::getTrackInfo(struct iAudioTrackInfo &info, unsigned int info.m_description = "AC3"; else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atAAC) info.m_description = "AAC"; + else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atAACHE) + info.m_description = "AAC-HE"; else if (program.audioStreams[i].type == eDVBServicePMTHandler::audioStream::atDTS) info.m_description = "DTS"; else -- cgit v1.2.3