Initial work on DTSCMerge

This commit is contained in:
Erik Zandvliet 2013-04-24 12:03:58 +02:00
parent 60c9c2b67c
commit e76b957e84
3 changed files with 54 additions and 6 deletions

View file

@ -11,7 +11,7 @@ RELEASE ?= "Generic_`getconf LONG_BIT`"
AM_CPPFLAGS = $(global_CFLAGS) $(MIST_CFLAGS) -DRELEASE=\"$(RELEASE)\"
LDADD = $(MIST_LIBS)
bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic MistConnHTTPSmooth MistConnHTTPLive MistConnTS MistPlayer MistDTSC2FLV MistFLV2DTSC MistDTSCFix MistDTSC2TS MistAnalyserRTMP MistAnalyserFLV MistAnalyserDTSC MistAnalyserAMF MistAnalyserMP4
bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic MistConnHTTPSmooth MistConnHTTPLive MistConnTS MistPlayer MistDTSC2FLV MistFLV2DTSC MistDTSCFix MistDTSCMerge MistDTSC2TS MistAnalyserRTMP MistAnalyserFLV MistAnalyserDTSC MistAnalyserAMF MistAnalyserMP4
#buffer folder (MistBuffer, MistPlayer)
MistBuffer_SOURCES=buffer/buffer.cpp buffer/buffer_user.h buffer/buffer_user.cpp buffer/buffer_stream.h buffer/buffer_stream.cpp tinythread.cpp tinythread.h ../VERSION
@ -36,6 +36,7 @@ MistConnTS_SOURCES=connectors/conn_ts.cpp ../VERSION
MistDTSC2FLV_SOURCES=converters/dtsc2flv.cpp
MistFLV2DTSC_SOURCES=converters/flv2dtsc.cpp
MistDTSCFix_SOURCES=converters/dtscfix.cpp
MistDTSCMerge_SOURCES=converters/dtscmerge.cpp
MistDTSC2TS_SOURCES=converters/dtsc2ts.cpp
#analysers directory (MistAnalyser*)

View file

@ -48,11 +48,6 @@ namespace Converters {
std::map<std::string,HeaderEntryDTSC> trackData;
long long int nowpack = 0;
// long long int lastaudio = 0;
// long long int lastvideo = 0;
// long long unsigned int totalvideo = 0;
// long long unsigned int totalaudio = 0;
// long long int keynum = 0;
std::string currentID;
int nextFreeID = 0;

View file

@ -0,0 +1,52 @@
/// \file dtscfix.cpp
/// Contains the code that will attempt to merge 2 files into a single DTSC file.
#include <string>
#include <vector>
#include <mist/config.h>
#include <mist/dtsc.h>
namespace Converters {
int DTSCMerge(int argc, char ** argv){
Util::Config conf = Util::Config(argv[0], PACKAGE_VERSION);
conf.addOption("output", JSON::fromString("{\"arg_num\":1, \"arg\":\"string\", \"help\":\"Filename of the output file.\"}"));
conf.addOption("input", JSON::fromString("{\"arg_num\":2, \"arg\":\"string\", \"help\":\"Filename of the first input file.\"}"));
conf.addOption("[additional_inputs ...]", JSON::fromString("{\"arg_num\":3, \"arg\":\"string\", \"help\":\"Filenames of any number of aditional inputs.\"}"));
conf.parseArgs(argc, argv);
DTSC::File outFile("/dev/null",true);
JSON::Value meta;
std::map<std::string,std::map<int, int> > trackMapping;
int nextTrackID = 1;
bool fullSort = true;
std::map<std::string, DTSC::File> inFiles;
std::string tmpFileName;
for (int i = 2; i < argc; i++){
tmpFileName = argv[i];
if (tmpFileName == std::string(argv[1])){
fullSort = false;
}else{
inFiles.insert(std::pair<std::string, DTSC::File>(tmpFileName, DTSC::File(tmpFileName)));
}
}
if (fullSort){
outFile = DTSC::File(argv[1], true);
}else{
outFile = DTSC::File(argv[1]);
meta = outFile.getMeta();
}
JSON::Value newMeta = meta;
for (std::map<std::string,DTSC::File>::iterator it = inFiles.begin(); it != inFiles.end(); it++){
JSON::Value tmpMeta = it->second.getMeta();
//for (JSON::ObjIter oIt =
}
return 0;
}
}
int main(int argc, char ** argv){
return Converters::DTSCMerge(argc, argv);
}