/// <summary> /// Writes the rtpdump file header /// </summary> public void WriteFileHeader(bool force = false) { //If not forcing and the header was already written then do nothing if (false == force && m_WroteHeader) { return; } //Header is only written in Binary files if (m_Format < FileFormat.Text) { //Create the file header now if null if (m_FileIdentifier == null) { m_FileIdentifier = RtpDumpExtensions.CreateFileIdentifier(m_Source); } //Write the file header m_Writer.Write(m_FileIdentifier, 0, m_FileIdentifier.Length); if (m_FileHeader == null) { m_FileHeader = RtpDumpExtensions.CreateFileHeader(m_Start, m_Source); } //Write the RD_hdr_t m_Writer.Write(m_FileHeader, 0, m_FileHeader.Length); } //We wrote the header... m_WroteHeader = true; }
/// <summary> /// Reads the Binary File Identifier '#!rtpplay..' and the RD_hdr_t. /// </summary> void ReadFileHeader() { //If identifier has not been read and the format is unknown or non text if (m_FileIdentifier == null && RtpDumpExtensions.HasFileHeader(m_Format)) { //Identify the Binary file ReadBinaryFileIdentifier(); //If the format is non text if (m_Format < FileFormat.Text) { //Read the RD_hdr_t ReadBinaryFileHeader(); } } }