Added raw PES dump mode to TS analyser
This commit is contained in:
parent
fc7a460c49
commit
385cfcb761
2 changed files with 17 additions and 0 deletions
|
@ -28,6 +28,7 @@ void AnalyserTS::init(Util::Config &conf){
|
|||
"= TS stream pkts, 32 = raw PES packet bytes, 64 = raw TS packet bytes";
|
||||
conf.addOption("detail", opt);
|
||||
opt.null();
|
||||
|
||||
opt["long"] = "pid";
|
||||
opt["short"] = "P";
|
||||
opt["arg"] = "num";
|
||||
|
@ -35,10 +36,21 @@ void AnalyserTS::init(Util::Config &conf){
|
|||
opt["help"] = "Only use the given PID, ignore others";
|
||||
conf.addOption("pid", opt);
|
||||
opt.null();
|
||||
|
||||
opt["long"] = "raw";
|
||||
opt["short"] = "R";
|
||||
opt["arg"] = "str";
|
||||
opt["default"] = "";
|
||||
opt["help"] = "Write raw PES payloads to given file";
|
||||
conf.addOption("raw", opt);
|
||||
opt.null();
|
||||
}
|
||||
|
||||
AnalyserTS::AnalyserTS(Util::Config &conf) : Analyser(conf){
|
||||
pidOnly = conf.getInteger("pid");
|
||||
if (conf.getString("raw").size()){
|
||||
outFile.open(conf.getString("raw").c_str());
|
||||
}
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
|
@ -172,6 +184,9 @@ std::string AnalyserTS::printPES(const std::string &d, size_t PID){
|
|||
}
|
||||
res << std::endl;
|
||||
|
||||
if (outFile){
|
||||
outFile.write(d.data() + 9 + headSize + padding, d.size()-(9 + headSize + padding));
|
||||
}
|
||||
if (detail & 32){
|
||||
size_t counter = 0;
|
||||
for (size_t i = 9 + headSize + padding; i < d.size(); ++i){
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "analyser.h"
|
||||
#include <mist/config.h>
|
||||
#include <mist/ts_packet.h>
|
||||
#include <fstream>
|
||||
|
||||
class AnalyserTS : public Analyser{
|
||||
public:
|
||||
|
@ -11,6 +12,7 @@ public:
|
|||
std::string printPES(const std::string &d, size_t PID);
|
||||
|
||||
private:
|
||||
std::ofstream outFile;
|
||||
std::map<size_t, std::string> payloads;
|
||||
size_t pidOnly;
|
||||
TS::Packet packet;
|
||||
|
|
Loading…
Add table
Reference in a new issue