Working OGG and MP4
This commit is contained in:
parent
4ad866cc61
commit
62f1e25e8b
5 changed files with 21 additions and 6 deletions
|
@ -98,7 +98,7 @@ namespace Connector_HTTP {
|
||||||
HTTP_S.SetHeader("Content-Type", "video/MP4"); //Send the correct content-type for FLV files
|
HTTP_S.SetHeader("Content-Type", "video/MP4"); //Send the correct content-type for FLV files
|
||||||
HTTP_S.protocol = "HTTP/1.0";
|
HTTP_S.protocol = "HTTP/1.0";
|
||||||
conn.SendNow(HTTP_S.BuildResponse("200", "OK")); //no SetBody = unknown length - this is intentional, we will stream the entire file
|
conn.SendNow(HTTP_S.BuildResponse("200", "OK")); //no SetBody = unknown length - this is intentional, we will stream the entire file
|
||||||
conn.SendNow(Conv.DTSCMeta2MP4Header(Strm.metadata.toJSON()));//SENDING MP4HEADER
|
conn.SendNow(Conv.DTSCMeta2MP4Header(Strm.metadata));//SENDING MP4HEADER
|
||||||
keyPartIt = Conv.keyParts.begin();
|
keyPartIt = Conv.keyParts.begin();
|
||||||
{//using scope to have cmd not declared after action
|
{//using scope to have cmd not declared after action
|
||||||
std::stringstream cmd;
|
std::stringstream cmd;
|
||||||
|
|
|
@ -163,7 +163,7 @@ namespace Connector_HTTP {
|
||||||
HTTP_S.protocol = "HTTP/1.0";
|
HTTP_S.protocol = "HTTP/1.0";
|
||||||
conn.SendNow(HTTP_S.BuildResponse("200", "OK")); //no SetBody = unknown length - this is intentional, we will stream the entire file
|
conn.SendNow(HTTP_S.BuildResponse("200", "OK")); //no SetBody = unknown length - this is intentional, we will stream the entire file
|
||||||
//Fill in ogg header here
|
//Fill in ogg header here
|
||||||
oggMeta.readDTSCHeader(Strm.metadata.toJSON());
|
oggMeta.readDTSCHeader(Strm.metadata);
|
||||||
conn.SendNow((char*)oggMeta.parsedPages.c_str(), oggMeta.parsedPages.size());
|
conn.SendNow((char*)oggMeta.parsedPages.c_str(), oggMeta.parsedPages.size());
|
||||||
progressive_has_sent_header = true;
|
progressive_has_sent_header = true;
|
||||||
//setting sendReady to not ready
|
//setting sendReady to not ready
|
||||||
|
|
|
@ -23,8 +23,12 @@ namespace Converters {
|
||||||
///\return The return code for the converter.
|
///\return The return code for the converter.
|
||||||
int DTSC2MP4(Util::Config & conf){
|
int DTSC2MP4(Util::Config & conf){
|
||||||
DTSC::File input(conf.getString("filename"));//DTSC input
|
DTSC::File input(conf.getString("filename"));//DTSC input
|
||||||
|
|
||||||
|
//DTSC::readOnlyMeta fileMeta = input.getMeta();
|
||||||
|
DTSC::Meta giveMeta(input.getMeta());
|
||||||
|
|
||||||
MP4::DTSC2MP4Converter Conv;//DTSC to MP4 converter class will handle header creation and media parsing
|
MP4::DTSC2MP4Converter Conv;//DTSC to MP4 converter class will handle header creation and media parsing
|
||||||
std::cout << Conv.DTSCMeta2MP4Header(input.getMeta().toJSON());//Creating and outputting MP4 header from DTSC file
|
std::cout << Conv.DTSCMeta2MP4Header(giveMeta);//Creating and outputting MP4 header from DTSC file
|
||||||
|
|
||||||
//initialising JSON input
|
//initialising JSON input
|
||||||
std::set<int> selector;
|
std::set<int> selector;
|
||||||
|
@ -40,11 +44,12 @@ namespace Converters {
|
||||||
while (input.getJSON()){//as long as the file goes
|
while (input.getJSON()){//as long as the file goes
|
||||||
Conv.parseDTSC(input.getJSON());//parse 1 file DTSC packet
|
Conv.parseDTSC(input.getJSON());//parse 1 file DTSC packet
|
||||||
if(Conv.sendReady()){//if the converter has a part to send out
|
if(Conv.sendReady()){//if the converter has a part to send out
|
||||||
std::cout << Conv.sendString();//send out and clear Convverter buffer
|
std::cout << Conv.sendString();//send out and clear Converter buffer
|
||||||
}
|
}
|
||||||
input.seekNext();//get next DTSC packet
|
input.seekNext();//get next DTSC packet
|
||||||
}
|
}
|
||||||
//output remaining buffer
|
//output remaining buffer
|
||||||
|
std::cout << Conv.purgeBuffer();
|
||||||
return 0;
|
return 0;
|
||||||
} //DTSC2MP4
|
} //DTSC2MP4
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,17 @@ namespace Converters{
|
||||||
char* curNewPayload;
|
char* curNewPayload;
|
||||||
OGG::headerPages oggMeta;
|
OGG::headerPages oggMeta;
|
||||||
//Creating ID headers for theora and vorbis
|
//Creating ID headers for theora and vorbis
|
||||||
oggMeta.readDTSCHeader(DTSCFile.getMeta().toJSON());
|
DTSC::readOnlyMeta fileMeta = DTSCFile.getMeta();
|
||||||
|
DTSC::Meta giveMeta;
|
||||||
|
for ( std::map<int,DTSC::readOnlyTrack>::iterator it = fileMeta.tracks.begin(); it != fileMeta.tracks.end(); it ++) {
|
||||||
|
std::cerr << "TrackID: " << it->first << std::endl;
|
||||||
|
giveMeta.tracks[it->first].trackID = fileMeta.tracks[it->first].trackID;
|
||||||
|
giveMeta.tracks[it->first].idHeader = fileMeta.tracks[it->first].idHeader;
|
||||||
|
giveMeta.tracks[it->first].init = fileMeta.tracks[it->first].init;
|
||||||
|
giveMeta.tracks[it->first].commentHeader = fileMeta.tracks[it->first].commentHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
oggMeta.readDTSCHeader(giveMeta);
|
||||||
std::cout << oggMeta.parsedPages;//outputting header pages
|
std::cout << oggMeta.parsedPages;//outputting header pages
|
||||||
|
|
||||||
//create DTSC in OGG pages
|
//create DTSC in OGG pages
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace Converters{
|
||||||
if (trackData[sNum].codec == THEORA){
|
if (trackData[sNum].codec == THEORA){
|
||||||
trackData[sNum].lastTime += (mspft / 4);
|
trackData[sNum].lastTime += (mspft / 4);
|
||||||
}else{
|
}else{
|
||||||
trackData[sNum].lastTime += (mspfv / 4);
|
trackData[sNum].lastTime += (mspfv / 16);
|
||||||
}
|
}
|
||||||
DTSCOut["data"] = std::string(oggPage.getFullPayload()+offset, (*it)); //segment content put in JSON
|
DTSCOut["data"] = std::string(oggPage.getFullPayload()+offset, (*it)); //segment content put in JSON
|
||||||
if (trackData[sNum].codec == THEORA){
|
if (trackData[sNum].codec == THEORA){
|
||||||
|
|
Loading…
Add table
Reference in a new issue