libtriple: add getPesPids() and removePid() to cDemux

Origin commit data
------------------
Branch: master
Commit: ec0cd38962
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-05 (Sat, 05 Feb 2011)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2011-02-05 11:54:04 +01:00
parent b3594e10f0
commit c24dbeaa76
2 changed files with 26 additions and 1 deletions

View File

@@ -426,6 +426,28 @@ void cDemux::addPid(unsigned short Pid)
return;
}
void cDemux::removePid(unsigned short Pid)
{
if (dmx_type != DMX_TP_CHANNEL)
{
fprintf(stderr, "cDemux::%s pes_type!=DMX_TP_CHANNEL (%s) not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid);
return;
}
for (std::vector<pes_pids>::iterator i = pesfds.begin(); i != pesfds.end(); ++i)
{
if ((*i).pid == Pid) {
lt_debug("cDemux::removePid: removing demux fd %d pid 0x%04x\n", (*i).fd, Pid);
if (ioctl((*i).fd, DEMUX_STOP) < 0)
perror("DEMUX_STOP");
if (close((*i).fd) < 0)
perror("close");
pesfds.erase(i);
return; /* TODO: what if the same PID is there multiple times */
}
}
fprintf(stderr, "cDemux::removePid: pid 0x%04x not found\n", Pid);
}
void cDemux::getSTC(int64_t * STC)
{
lt_debug("cDemux::%s #%d\n", __FUNCTION__, num);

View File

@@ -54,7 +54,10 @@ class cDemux
void addPid(unsigned short pid);
void getSTC(int64_t * STC);
int getUnit(void);
int getFD(void) { return fd; }; /* needed by cPlayback class */
// TD only functions
int getFD(void) { return fd; }; /* needed by cPlayback class */
void removePid(unsigned short Pid); /* needed by cRecord class */
std::vector<pes_pids> getPesPids(void) { return pesfds; };
//
cDemux(int num = 0);
~cDemux();