eDVBService::eDVBService()
:m_flags(0)
{
+ memset(m_cache, -1, sizeof(m_cache));
}
eDVBService::~eDVBService()
{
}
+bool eDVBService::cacheEmpty()
+{
+ for (int i=0; i < cacheMax; ++i)
+ if (m_cache[i] != -1)
+ return false;
+ return true;
+}
+
eDVBService &eDVBService::operator=(const eDVBService &s)
{
m_service_name = s.m_service_name;
m_service_name_sort = s.m_service_name_sort;
m_provider_name = s.m_provider_name;
m_flags = s.m_flags;
- m_ca = s.m_ca;
- m_cache = s.m_cache;
+// m_ca = s.m_ca;
+ memcpy(m_cache, s.m_cache, sizeof(m_cache));
return *this;
}
int eDVBService::getCachePID(cacheID id)
{
- std::map<int, int>::iterator it = m_cache.find(id);
- if ( it != m_cache.end() )
- return it->second;
- return -1;
+ if (id >= cacheMax)
+ return -1;
+ return m_cache[id];
}
void eDVBService::setCachePID(cacheID id, int pid)
{
- if (pid == -1)
- m_cache.erase(id);
- else
+ if (id < cacheMax)
m_cache[id] = pid;
}
int cid, val;
sscanf(v.c_str(), "%02d%04x", &cid, &val);
s->m_cache[cid]=val;
- } else if (p == 'C')
+ }/* else if (p == 'C')
{
int val;
sscanf(v.c_str(), "%04x", &val);
s->m_ca.insert(val);
- }
+ }*/
}
addService(ref, s);
}
fprintf(f, "p:%s", i->second->m_provider_name.c_str());
// write cached pids
- for (std::map<int,int>::const_iterator ca(i->second->m_cache.begin());
- ca != i->second->m_cache.end(); ++ca)
- fprintf(f, ",c:%02d%04x", ca->first, ca->second);
+ for (int x=0; x < eDVBService::cacheMax; ++x)
+ if (i->second->m_cache[x] != -1)
+ fprintf(f, ",c:%02d%04x", x, i->second->m_cache[x]);
+/*
// write cached ca pids
for (std::set<int>::const_iterator ca(i->second->m_ca.begin());
ca != i->second->m_ca.end(); ++ca)
fprintf(f, ",C:%04x", *ca);
+*/
if (i->second->m_flags)
fprintf(f, ",f:%x", i->second->m_flags);
eWarning("%s: %m", filename);
eDebug("demux device: %s", filename);
}
-
-int eDVBVideo::startPid(int pid)
+
+// not finally values i think.. !!
+#define VIDEO_STREAMTYPE_MPEG2 0
+#define VIDEO_STREAMTYPE_MPEG4_H264 1
+
+int eDVBVideo::startPid(int pid, int type)
{
if ((m_fd < 0) || (m_fd_demux < 0))
return -1;
dmx_pes_filter_params pes;
+ if (::ioctl(m_fd, VIDEO_SET_STREAMTYPE,
+ type == MPEG4_H264 ? VIDEO_STREAMTYPE_MPEG4_H264 : VIDEO_STREAMTYPE_MPEG2) < 0)
+ eWarning("video: VIDEO_SET_STREAMTYPE: %m");
+
pes.pid = pid;
pes.input = DMX_IN_FRONTEND;
pes.output = DMX_OUT_DECODER;
{
eDebug("new video");
m_video = new eDVBVideo(m_demux, m_decoder);
- if (m_video->startPid(m_vpid))
+ if (m_video->startPid(m_vpid, m_vtype))
{
eWarning("video: startpid failed!");
res = -1;
setState();
}
-RESULT eTSMPEGDecoder::setVideoPID(int vpid)
+RESULT eTSMPEGDecoder::setVideoPID(int vpid, int type)
{
if (m_vpid != vpid)
{
m_changed |= changeVideo;
m_vpid = vpid;
+ m_vtype = type;
}
return 0;
}
ePtr<eDVBDemux> m_demux;
int m_fd, m_fd_demux, m_dev;
public:
- enum {aMPEG, aAC3, aDTS };
+ enum { aMPEG, aAC3, aDTS, aAAC };
eDVBAudio(eDVBDemux *demux, int dev);
int startPid(int pid, int type);
void stop();
int m_is_slow_motion, m_is_fast_forward;
public:
+ enum { MPEG2, MPEG4_H264 };
eDVBVideo(eDVBDemux *demux, int dev);
- int startPid(int pid);
+ int startPid(int pid, int type);
void stop();
#if HAVE_DVB_API_VERSION < 3
void start();
ePtr<eDVBVideo> m_video;
ePtr<eDVBPCR> m_pcr;
ePtr<eDVBTText> m_text;
- int m_vpid, m_apid, m_atype, m_pcrpid, m_textpid;
+ int m_vpid, m_vtype, m_apid, m_atype, m_pcrpid, m_textpid;
enum
{
changeVideo = 1,
enum { pidNone = -1 };
eTSMPEGDecoder(eDVBDemux *demux, int decoder);
virtual ~eTSMPEGDecoder();
- RESULT setVideoPID(int vpid);
+ RESULT setVideoPID(int vpid, int type);
RESULT setAudioPID(int apid, int type);
RESULT setSyncPCR(int pcrpid);
RESULT setTextPID(int textpid);
public:
enum cacheID
{
- cVPID, cAPID, cTPID, cPCRPID, cAC3PID, cacheMax
+ cVPID, cAPID, cTPID, cPCRPID, cAC3PID, cVTYPE, cacheMax
};
int getCachePID(cacheID);
void setCachePID(cacheID, int);
- bool cacheEmpty() { return m_cache.empty(); }
+
+ bool cacheEmpty();
eDVBService();
/* m_service_name_sort is uppercase, with special chars removed, to increase sort performance. */
bool usePMT() const { return !(m_flags & dxNoDVB); }
- std::set<int> m_ca;
- std::map<int,int> m_cache;
+// std::set<int> m_ca;
+
+ int m_cache[cacheMax];
virtual ~eDVBService();
eDVBService &operator=(const eDVBService &);
{
public:
enum { pidDisabled = -1 };
- /** Set Displayed Video PID */
- virtual RESULT setVideoPID(int vpid)=0;
+ /** Set Displayed Video PID and type */
+ virtual RESULT setVideoPID(int vpid, int type)=0;
enum { af_MPEG, af_AC3, af_DTS };
/** Set Displayed Audio PID and type */
video.pid = (*es)->getPid();
audio.pid = (*es)->getPid();
+ video.type = videoStream::vtMPEG2;
switch ((*es)->getType())
{
+ case 0x1b: // AVC Video Stream (MPEG4 H264)
+ video.type = videoStream::vtMPEG4_H264;
case 0x01: // MPEG 1 video
case 0x02: // MPEG 2 video
isvideo = 1;
if ( program.textPid == -1 || (*es)->getPid() == cached_tpid )
program.textPid = (*es)->getPid();
break;
+ case DTS_DESCRIPTOR:
+ if (!isvideo)
+ {
+ isaudio = 1;
+ audio.type = audioStream::atDTS;
+ }
+ break;
case AC3_DESCRIPTOR:
if (!isvideo)
{
apid_mpeg = m_service->getCachePID(eDVBService::cAPID),
pcrpid = m_service->getCachePID(eDVBService::cPCRPID),
tpid = m_service->getCachePID(eDVBService::cTPID),
+ vpidtype = m_service->getCachePID(eDVBService::cVTYPE),
cnt=0;
+ if ( vpidtype == -1 )
+ vpidtype = videoStream::vtMPEG2;
if ( vpid != -1 )
{
videoStream s;
s.pid = vpid;
+ s.type = vpidtype;
program.videoStreams.push_back(s);
++cnt;
}
{
int pid;
int component_tag;
+ enum { vtMPEG2, vtMPEG4_H264 };
+ int type;
};
struct audioStream
{
int pid;
- enum { atMPEG, atAC3, atDTS };
+ enum { atMPEG, atAC3, atDTS, atAAC };
int type; // mpeg2, ac3, dts, ...
int component_tag;
SCAN_eDebug("name '%s', provider_name '%s'", service->m_service_name.c_str(), service->m_provider_name.c_str());
break;
}
+/*
case CA_IDENTIFIER_DESCRIPTOR:
{
CaIdentifierDescriptor &d = (CaIdentifierDescriptor&)**desc;
SCAN_eDebug("");
break;
}
+*/
default:
SCAN_eDebug("descr<%x>", (*desc)->getTag());
break;
void eDVBServicePlay::updateDecoder()
{
- int vpid = -1, apid = -1, apidtype = -1, pcrpid = -1, tpid = -1;
+ int vpid = -1, vpidtype = -1, apid = -1, apidtype = -1, pcrpid = -1, tpid = -1;
eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
bool defaultac3=false;
i != program.videoStreams.end(); ++i)
{
if (vpid == -1)
+ {
vpid = i->pid;
+ vpidtype = i->type;
+ }
if (i != program.videoStreams.begin())
eDebugNoNewLine(", ");
eDebugNoNewLine("%04x", i->pid);
if (m_decoder)
{
- m_decoder->setVideoPID(vpid);
+ m_decoder->setVideoPID(vpid, vpidtype);
m_current_audio_stream = 0;
m_decoder->setAudioPID(apid, apidtype);
if (!(m_is_pvr || m_timeshift_active || !m_is_primary))
m_dvb_service->setCachePID(eDVBService::cAC3PID, apid);
}
m_dvb_service->setCachePID(eDVBService::cVPID, vpid);
+ m_dvb_service->setCachePID(eDVBService::cVTYPE, vpidtype);
m_dvb_service->setCachePID(eDVBService::cPCRPID, pcrpid);
m_dvb_service->setCachePID(eDVBService::cTPID, tpid);
}