From e76b957e8496735784487afed4618446037b0288 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Wed, 24 Apr 2013 12:03:58 +0200 Subject: [PATCH] Initial work on DTSCMerge --- src/Makefile.am | 3 ++- src/converters/dtscfix.cpp | 5 ---- src/converters/dtscmerge.cpp | 52 ++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 src/converters/dtscmerge.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 325286fe..3fae94b7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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*) diff --git a/src/converters/dtscfix.cpp b/src/converters/dtscfix.cpp index c4d566eb..fe06afb6 100644 --- a/src/converters/dtscfix.cpp +++ b/src/converters/dtscfix.cpp @@ -48,11 +48,6 @@ namespace Converters { std::map 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; diff --git a/src/converters/dtscmerge.cpp b/src/converters/dtscmerge.cpp new file mode 100644 index 00000000..7baba65e --- /dev/null +++ b/src/converters/dtscmerge.cpp @@ -0,0 +1,52 @@ +/// \file dtscfix.cpp +/// Contains the code that will attempt to merge 2 files into a single DTSC file. + +#include +#include +#include +#include + +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 > trackMapping; + int nextTrackID = 1; + + bool fullSort = true; + std::map 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(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::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); +}