From 7fe0b5471b8b3fe55313b7c9746ab0c7c2b6599e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 5 Feb 2011 11:55:51 +0100 Subject: [PATCH] libtriple: add ChangePids() to cRecord This is pretty much untested for now, handle with care! Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/b0b348e4d1eebc69411be831b90b45ae71508429 Author: Stefan Seyfried Date: 2011-02-05 (Sat, 05 Feb 2011) ------------------ This commit was generated by Migit --- libtriple/record_td.cpp | 39 +++++++++++++++++++++++++++++++++++++++ libtriple/record_td.h | 1 + 2 files changed, 40 insertions(+) diff --git a/libtriple/record_td.cpp b/libtriple/record_td.cpp index 1ab9ed7..69ae551 100644 --- a/libtriple/record_td.cpp +++ b/libtriple/record_td.cpp @@ -119,6 +119,45 @@ bool cRecord::Stop(void) return true; } +bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int numapids) +{ + std::vector 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::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::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"); diff --git a/libtriple/record_td.h b/libtriple/record_td.h index 3ee61c3..fc1261f 100644 --- a/libtriple/record_td.h +++ b/libtriple/record_td.h @@ -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