Attempt to make RTMP properly compatible with all codecs
This commit is contained in:
parent
013f6c1d17
commit
1f43dff92f
2 changed files with 26 additions and 0 deletions
|
@ -43,6 +43,31 @@ bool FLV::is_header(char * header){
|
|||
return true;
|
||||
}//FLV::is_header
|
||||
|
||||
/// True if this media type requires init data.
|
||||
/// Will always return false if the tag type is not 0x08 or 0x09.
|
||||
/// Returns true for H263, AVC (H264), AAC.
|
||||
/// \todo Check if MP3 does or does not require init data...
|
||||
bool FLV::Tag::needsInitData(){
|
||||
switch (data[0]){
|
||||
case 0x09:
|
||||
switch (data[11] & 0x0F){
|
||||
case 2: return true; break;//H263 requires init data
|
||||
case 7: return true; break;//AVC requires init data
|
||||
default: return false; break;//other formats do not
|
||||
}
|
||||
break;
|
||||
case 0x08:
|
||||
switch (data[11] & 0xF0){
|
||||
case 0x20: return false; break;//MP3 does not...? Unsure.
|
||||
case 0xA0: return true; break;//AAC requires init data
|
||||
case 0xE0: return false; break;//MP38kHz does not...?
|
||||
default: return false; break;//other formats do not
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;//only audio/video can require init data
|
||||
}
|
||||
|
||||
/// True if current tag is init data for this media type.
|
||||
bool FLV::Tag::isInitData(){
|
||||
switch (data[0]){
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace FLV {
|
|||
int len; ///< Actual length of tag.
|
||||
bool isKeyframe; ///< True if current tag is a video keyframe.
|
||||
char * data; ///< Pointer to tag buffer.
|
||||
bool needsInitData(); ///< True if this media type requires init data.
|
||||
bool isInitData(); ///< True if current tag is init data for this media type.
|
||||
std::string tagType(); ///< Returns a std::string describing the tag in detail.
|
||||
unsigned int tagTime(); ///< Returns the 32-bit timestamp of this tag.
|
||||
|
|
Loading…
Add table
Reference in a new issue