mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
libtriple: add ChangePids() to cRecord
This is pretty much untested for now, handle with care!
This commit is contained in:
@@ -119,6 +119,45 @@ bool cRecord::Stop(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int numapids)
|
||||
{
|
||||
std::vector<pes_pids> pids;
|
||||
int j;
|
||||
bool found;
|
||||
unsigned short pid;
|
||||
INFO("\n");
|
||||
if (!dmx) {
|
||||
INFO("DMX = NULL\n");
|
||||
return false;
|
||||
}
|
||||
pids = dmx->getPesPids();
|
||||
/* the first PID is the video pid, so start with the second PID... */
|
||||
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) {
|
||||
found = false;
|
||||
pid = (*i).pid;
|
||||
for (j = 0; j < numapids; j++) {
|
||||
if (pid == apids[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
dmx->removePid(pid);
|
||||
}
|
||||
for (j = 0; j < numapids; j++) {
|
||||
found = false;
|
||||
for (std::vector<pes_pids>::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) {
|
||||
if ((*i).pid == apids[j]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
dmx->addPid(apids[j]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void cRecord::RecordThread()
|
||||
{
|
||||
INFO("begin\n");
|
||||
|
@@ -28,6 +28,7 @@ class cRecord
|
||||
bool Open(int numpids);
|
||||
bool Start(int fd, unsigned short vpid, unsigned short *apids, int numpids);
|
||||
bool Stop(void);
|
||||
bool ChangePids(unsigned short vpid, unsigned short *apids, int numapids);
|
||||
|
||||
void RecordThread();
|
||||
#if 0
|
||||
|
Reference in New Issue
Block a user