Fixed a FLV header bug causing both video and audio to always be mentioned even when not present, added header-only parsing support to HTTP library.
This commit is contained in:
parent
62c4689ae2
commit
9228198097
3 changed files with 7 additions and 2 deletions
|
@ -587,11 +587,11 @@ bool FLV::Tag::DTSCAudioInit(DTSC::Stream & S){
|
||||||
/// Assumes metadata is available - so check before calling!
|
/// Assumes metadata is available - so check before calling!
|
||||||
bool FLV::Tag::DTSCMetaInit(DTSC::Stream & S){
|
bool FLV::Tag::DTSCMetaInit(DTSC::Stream & S){
|
||||||
//Unknown? Assume AAC.
|
//Unknown? Assume AAC.
|
||||||
if (S.metadata["audio"]["codec"].asString() == "?"){
|
if (S.metadata.isMember("audio") && S.metadata["audio"]["codec"].asString() == "?"){
|
||||||
S.metadata["audio"]["codec"] = "AAC";
|
S.metadata["audio"]["codec"] = "AAC";
|
||||||
}
|
}
|
||||||
//Unknown? Assume H264.
|
//Unknown? Assume H264.
|
||||||
if (S.metadata["video"]["codec"].asString() == "?"){
|
if (S.metadata.isMember("video") && S.metadata["video"]["codec"].asString() == "?"){
|
||||||
S.metadata["video"]["codec"] = "H264";
|
S.metadata["video"]["codec"] = "H264";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
/// This constructor creates an empty HTTP::Parser, ready for use for either reading or writing.
|
/// This constructor creates an empty HTTP::Parser, ready for use for either reading or writing.
|
||||||
/// All this constructor does is call HTTP::Parser::Clean().
|
/// All this constructor does is call HTTP::Parser::Clean().
|
||||||
HTTP::Parser::Parser(){
|
HTTP::Parser::Parser(){
|
||||||
|
headerOnly = false;
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +218,9 @@ bool HTTP::Parser::parse(std::string & HTTPbuffer){
|
||||||
}
|
}
|
||||||
if (seenHeaders){
|
if (seenHeaders){
|
||||||
if (length > 0){
|
if (length > 0){
|
||||||
|
if (headerOnly){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
unsigned int toappend = length - body.length();
|
unsigned int toappend = length - body.length();
|
||||||
if (toappend > 0){
|
if (toappend > 0){
|
||||||
body.append(HTTPbuffer, 0, toappend);
|
body.append(HTTPbuffer, 0, toappend);
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace HTTP {
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string protocol;
|
std::string protocol;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
|
bool headerOnly; ///< If true, do not parse body if the length is a known size.
|
||||||
private:
|
private:
|
||||||
bool seenHeaders;
|
bool seenHeaders;
|
||||||
bool seenReq;
|
bool seenReq;
|
||||||
|
|
Loading…
Add table
Reference in a new issue