Making DTSC2MP4 conversion
This commit is contained in:
parent
ef268f978f
commit
12fa04dffd
2 changed files with 62 additions and 5 deletions
|
@ -30,6 +30,7 @@ bin_PROGRAMS+=MistDTSCFix
|
|||
bin_PROGRAMS+=MistDTSCMerge
|
||||
bin_PROGRAMS+=MistDTSC2TS
|
||||
bin_PROGRAMS+=MistDTSC2OGG
|
||||
bin_PROGRAMS+=MistDTSC2MP4
|
||||
bin_PROGRAMS+=MistSRT2DTSC
|
||||
bin_PROGRAMS+=MistOGG2DTSC
|
||||
bin_PROGRAMS+=MistAnalyserRTMP
|
||||
|
@ -70,6 +71,7 @@ MistDTSCFix_SOURCES=converters/dtscfix.cpp
|
|||
MistDTSCMerge_SOURCES=converters/dtscmerge.cpp
|
||||
MistDTSC2TS_SOURCES=converters/dtsc2ts.cpp
|
||||
MistSRT2DTSC_SOURCES=converters/srt2dtsc.cpp
|
||||
MistDTSC2MP4_SOURCES=converters/dtsc2mp4.cpp
|
||||
|
||||
#analysers directory (MistAnalyser*)
|
||||
MistAnalyserRTMP_SOURCES=analysers/rtmp_analyser.cpp
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <mist/json.h>
|
||||
#include <mist/dtsc.h> //DTSC support
|
||||
#include <mist/mp4.h> //MP4 support
|
||||
#include <mist/config.h>
|
||||
|
||||
///\brief Holds everything unique to converters.
|
||||
|
@ -19,15 +21,68 @@ namespace Converters {
|
|||
///\brief Converts DTSC from file to MP4 on stdout.
|
||||
///\return The return code for the converter.
|
||||
int DTSC2MP4(Util::Config & conf){
|
||||
DTSC::File input(conf.getString("filename");
|
||||
DTSC::File input(conf.getString("filename"));
|
||||
std::cerr << input.getMeta()["tracks"]["video0"].size() << std::endl;
|
||||
//ftyp box
|
||||
//pdin box
|
||||
MP4::FTYP ftypBox;
|
||||
std::cout << std::string(ftypBox.asBox(),ftypBox.boxedSize());
|
||||
//moov box
|
||||
//moof box
|
||||
//mfra box
|
||||
MP4::MOOV moovBox;
|
||||
MP4::MVHD mvhdBox;
|
||||
moovBox.setContent(mvhdBox, 0);
|
||||
|
||||
//start arbitrary
|
||||
int boxOffset = 1;
|
||||
for (JSON::ObjIter it = input.getMeta()["tracks"].ObjBegin(); it != input.getMeta()["tracks"].ObjEnd(); it++){
|
||||
MP4::TRAK trakBox;
|
||||
MP4::TKHD tkhdBox;
|
||||
std::cerr << it->second["trackid"].asInt() << std::endl;
|
||||
tkhdBox.setTrackID(it->second["trackid"].asInt());
|
||||
|
||||
if (it->second.isMember("width")){
|
||||
tkhdBox.setWidth(it->second["width"].asInt() << 16);
|
||||
}
|
||||
if (it->second.isMember("height")){
|
||||
tkhdBox.setHeight(it->second["height"].asInt() << 16);
|
||||
}
|
||||
trakBox.setContent(tkhdBox, 0);
|
||||
|
||||
MP4::MDIA mdiaBox;
|
||||
MP4::MDHD mdhdBox;
|
||||
mdiaBox.setContent(mdhdBox, 0);
|
||||
|
||||
MP4::HDLR hdlrBox;
|
||||
mdiaBox.setContent(hdlrBox, 1);
|
||||
MP4::MINF minfBox;
|
||||
MP4::DINF dinfBox;
|
||||
MP4::DREF drefBox;
|
||||
dinfBox.setContent(drefBox,0);
|
||||
minfBox.setContent(dinfBox,0);
|
||||
|
||||
MP4::STBL stblBox;
|
||||
MP4::STSD stsdBox;
|
||||
stblBox.setContent(stsdBox,0);
|
||||
|
||||
MP4::STSS stssBox;
|
||||
stblBox.setContent(stssBox,1);
|
||||
|
||||
MP4::STSC stscBox;
|
||||
stblBox.setContent(stscBox,2);
|
||||
|
||||
MP4::STCO stcoBox;
|
||||
stblBox.setContent(stcoBox,3);
|
||||
minfBox.setContent(stblBox,1);
|
||||
mdiaBox.setContent(minfBox, 2);
|
||||
trakBox.setContent(mdiaBox, 1);
|
||||
moovBox.setContent(trakBox, boxOffset);
|
||||
boxOffset++;
|
||||
}
|
||||
//end arbitrary
|
||||
//std::cout << input.getMeta()["audio"].toPrettyString() << std::endl;
|
||||
std::cout << std::string(moovBox.asBox(),moovBox.boxedSize());
|
||||
//mdat box alot
|
||||
return 0;
|
||||
} //FLV2DTSC
|
||||
} //DTSC2MP4
|
||||
|
||||
} //Converter namespace
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue