Send only the first keyframe with command line file for FLV output.
This commit is contained in:
parent
ab5b904891
commit
e8eb3a36ee
1 changed files with 26 additions and 0 deletions
|
@ -57,6 +57,13 @@ namespace Mist {
|
||||||
opt["arg_num"] = 1ll;
|
opt["arg_num"] = 1ll;
|
||||||
opt["help"] = "Target filename to store FLV file as, or - for stdout.";
|
opt["help"] = "Target filename to store FLV file as, or - for stdout.";
|
||||||
cfg->addOption("target", opt);
|
cfg->addOption("target", opt);
|
||||||
|
|
||||||
|
|
||||||
|
opt.null();
|
||||||
|
opt["short"] = "k";
|
||||||
|
opt["long"] = "keyframe";
|
||||||
|
opt["help"] = "Send only a single video keyframe";
|
||||||
|
cfg->addOption("keyframeonly", opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutProgressiveFLV::isRecording(){
|
bool OutProgressiveFLV::isRecording(){
|
||||||
|
@ -66,6 +73,9 @@ namespace Mist {
|
||||||
void OutProgressiveFLV::sendNext(){
|
void OutProgressiveFLV::sendNext(){
|
||||||
tag.DTSCLoader(thisPacket, myMeta.tracks[thisPacket.getTrackId()]);
|
tag.DTSCLoader(thisPacket, myMeta.tracks[thisPacket.getTrackId()]);
|
||||||
myConn.SendNow(tag.data, tag.len);
|
myConn.SendNow(tag.data, tag.len);
|
||||||
|
if (config->getBool("keyframeonly")){
|
||||||
|
config->is_active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutProgressiveFLV::sendHeader(){
|
void OutProgressiveFLV::sendHeader(){
|
||||||
|
@ -76,6 +86,15 @@ namespace Mist {
|
||||||
H.setCORSHeaders();
|
H.setCORSHeaders();
|
||||||
H.SendResponse("200", "OK", myConn);
|
H.SendResponse("200", "OK", myConn);
|
||||||
}
|
}
|
||||||
|
if (config->getBool("keyframeonly")){
|
||||||
|
selectedTracks.clear();
|
||||||
|
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++){
|
||||||
|
if (it->second.type =="video"){
|
||||||
|
selectedTracks.insert(it->first);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
myConn.SendNow(FLV::Header, 13);
|
myConn.SendNow(FLV::Header, 13);
|
||||||
tag.DTSCMetaInit(myMeta, selectedTracks);
|
tag.DTSCMetaInit(myMeta, selectedTracks);
|
||||||
|
@ -88,6 +107,13 @@ namespace Mist {
|
||||||
myConn.SendNow(tag.data, tag.len);
|
myConn.SendNow(tag.data, tag.len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (config->getBool("keyframeonly")){
|
||||||
|
unsigned int tid = *selectedTracks.begin();
|
||||||
|
int keyNum = myMeta.tracks[tid].keys.rbegin()->getNumber();
|
||||||
|
int keyTime = myMeta.tracks[tid].getKey(keyNum).getTime();
|
||||||
|
INFO_MSG("Seeking for time %d on track %d key %d", keyTime, tid, keyNum);
|
||||||
|
seek(keyTime);
|
||||||
|
}
|
||||||
sentHeader = true;
|
sentHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue