Example #1
0
void
ASDCP::KLVPacket::Dump(FILE* stream, const Dictionary& Dict, bool show_value)
{
  char buf[64];

  if ( stream == 0 )
    stream = stderr;

  if ( m_KeyStart != 0 )
    {
      assert(m_ValueStart);
      UL TmpUL(m_KeyStart);
      fprintf(stream, "%s", TmpUL.EncodeString(buf, 64));

      const MDDEntry* Entry = Dict.FindUL(m_KeyStart);
      fprintf(stream, "  len: %7u (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown"));

      if ( show_value && m_ValueLength < 1000 )
	Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui32_t)128), stream);
    }
  else if ( m_UL.HasValue() )
    {
      fprintf(stream, "%s\n", m_UL.EncodeString(buf, 64));
    }
  else
    {
      fprintf(stream, "*** Malformed KLV packet ***\n");
    }
}