You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Doc_BoxAlgorithm_EBMLStreamSpy.rst 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. .. _Doc_BoxAlgorithm_EBMLStreamSpy:
  2. EBML stream spy
  3. ===============
  4. .. container:: attribution
  5. :Author:
  6. Yann Renard
  7. :Company:
  8. INRIA/IRISA
  9. .. image:: images/Doc_BoxAlgorithm_EBMLStreamSpy.png
  10. This sample EBML stream analyzer prints the EBML tree structure to the console
  11. The purpose of this box is to spy an EBML stream and decode its structure to
  12. the log manager. In order to do so, the box has to know a list of expected EBML
  13. node identifiers and EBML node types. If you don't know what EBML is, you
  14. should check the `EBML Documentation
  15. <https://github.com/Matroska-Org/ebml-specification>`_ page. The list of
  16. expected node identifiers and types is collected from a configuration file.
  17. Also, the author is able to chose which log level to use in order to output the
  18. information.
  19. Such box is mostly useful for debug purpose. It allows
  20. a developper to check what arrives to a box in a human
  21. readable way.
  22. Inputs
  23. ------
  24. .. csv-table::
  25. :header: "Input Name", "Stream Type"
  26. "Spied EBML stream 1", "EBML stream"
  27. This box can receive as many input as necessary. All the inputs
  28. will be of type :ref:`Doc_Streams_EBML` in order to
  29. be parsed by this the reader.
  30. Spied EBML stream 1
  31. ~~~~~~~~~~~~~~~~~~~
  32. This is the default input of this box.
  33. .. _Doc_BoxAlgorithm_EBMLStreamSpy_Settings:
  34. Settings
  35. --------
  36. .. csv-table::
  37. :header: "Setting Name", "Type", "Default Value"
  38. "EBML nodes description", "Filename", "${Path_Data}/plugins/tools/config-ebml-stream-spy.txt"
  39. "Log level to use", "Log level", "Information"
  40. "Expand binary blocks", "Boolean", "false"
  41. "Number of values in expanded blocks", "Integer", "4"
  42. EBML nodes description
  43. ~~~~~~~~~~~~~~~~~~~~~~
  44. This first setting indicates where to find the configuration file.
  45. The box comes with a default configuration file containing all the
  46. default node identifiers of NeuroRT. You should extend this
  47. configuration in order to add your own EBML nodes in case you
  48. have created new EBML stream types.
  49. Log level to use
  50. ~~~~~~~~~~~~~~~~
  51. This second settings indicates what log level will be used to
  52. print the EBML stream structure.
  53. .. _Doc_BoxAlgorithm_EBMLStreamSpy_Examples:
  54. Examples
  55. --------
  56. As an example, we could connect an EBML stream spy to a sinus
  57. oscillator. Leave the default sinus oscillator settings to their
  58. default, except the sample count per buffer can be set to 8 for the
  59. example. Chose an appropriate log level for the EBML stream spy and
  60. press 'start'. You will probably notice that a lot of text is sent
  61. to the log manager, making the use of this box difficult in real time.
  62. Once again, consider it as a debugging box.
  63. The output should look like this :
  64. .. code::
  65. [ INF ] <Box algorithm::EBML stream spy>
  66. [ INF ] <Box algorithm::EBML stream spy> For input Spied EBML stream 1 of type EBML stream :
  67. [ INF ] <Box algorithm::EBML stream spy> For chunk [id:0 (0x0)] at [time:(0x00000000, 0x00000000),(0x00000000, 0x00000000)]
  68. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x002b395f, 0x108adfae)]-[name:OVTK_NodeId_Header]
  69. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00cdd0f7, 0x46b0278d)]-[name:OVTK_NodeId_Header_StreamType]-[type:uinteger]-[value:0 (0x0)]
  70. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x006f5a08, 0x7796ebc5)]-[name:OVTK_NodeId_Header_StreamVersion]-[type:uinteger]-[value:0 (0x0)]
  71. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x007855de, 0x3748d375)]-[name:OVTK_NodeId_Header_Signal]
  72. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00141c43, 0x0c37006b)]-[name:OVTK_NodeId_Header_Signal_Sampling]-[type:uinteger]-[value:512 (0x200)]
  73. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x0072f560, 0x7ed2cbed)]-[name:OVTK_NodeId_Header_StreamedMatrix]
  74. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x003febd4, 0x2725d428)]-[name:OVTK_NodeId_Header_StreamedMatrix_DimensionCount]-[type:uinteger]-[value:2 (0x2)]
  75. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x0000e3c0, 0x3a7d5141)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension]
  76. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x001302f7, 0x36d8438a)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Size]-[type:uinteger]-[value:4 (0x4)]
  77. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:Channel 0]
  78. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:Channel 1]
  79. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:Channel 2]
  80. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:Channel 3]
  81. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x0000e3c0, 0x3a7d5141)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension]
  82. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x001302f7, 0x36d8438a)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Size]-[type:uinteger]-[value:8 (0x8)]
  83. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  84. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  85. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  86. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  87. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  88. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  89. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  90. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00153e40, 0x190227e0)]-[name:OVTK_NodeId_Header_StreamedMatrix_Dimension_Label]-[type:string]-[value:]
  91. [ INF ] <Box algorithm::EBML stream spy>
  92. [ INF ] <Box algorithm::EBML stream spy>
  93. [ INF ] <Box algorithm::EBML stream spy> For input Spied EBML stream 1 of type EBML stream :
  94. [ INF ] <Box algorithm::EBML stream spy> For chunk [id:0 (0x0)] at [time:(0x00000000, 0x00000000),(0x00000000, 0x04000000)]
  95. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00cf2101, 0x02375310)]-[name:OVTK_NodeId_Buffer]
  96. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00120663, 0x08fbc165)]-[name:OVTK_NodeId_Buffer_StreamedMatrix]
  97. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00b18c10, 0x427d098c)]-[name:OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer]-[type:binary]-[bytes:256 (0x100)]
  98. [ INF ] <Box algorithm::EBML stream spy>
  99. [ INF ] <Box algorithm::EBML stream spy>
  100. [ INF ] <Box algorithm::EBML stream spy> For input Spied EBML stream 1 of type EBML stream :
  101. [ INF ] <Box algorithm::EBML stream spy> For chunk [id:0 (0x0)] at [time:(0x00000000, 0x04000000),(0x00000000, 0x08000000)]
  102. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00cf2101, 0x02375310)]-[name:OVTK_NodeId_Buffer]
  103. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00120663, 0x08fbc165)]-[name:OVTK_NodeId_Buffer_StreamedMatrix]
  104. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00b18c10, 0x427d098c)]-[name:OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer]-[type:binary]-[bytes:256 (0x100)]
  105. [ INF ] <Box algorithm::EBML stream spy>
  106. [ INF ] <Box algorithm::EBML stream spy>
  107. [ INF ] <Box algorithm::EBML stream spy> For input Spied EBML stream 1 of type EBML stream :
  108. [ INF ] <Box algorithm::EBML stream spy> For chunk [id:0 (0x0)] at [time:(0x00000000, 0x08000000),(0x00000000, 0x0c000000)]
  109. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00cf2101, 0x02375310)]-[name:OVTK_NodeId_Buffer]
  110. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00120663, 0x08fbc165)]-[name:OVTK_NodeId_Buffer_StreamedMatrix]
  111. [ INF ] <Box algorithm::EBML stream spy> Opened EBML node [id:(0x00b18c10, 0x427d098c)]-[name:OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer]-[type:binary]-[bytes:256 (0x100)]
  112. [ INF ] <Box algorithm::EBML stream spy>
  113. ...
  114. Now let's try to understand what is produced. First we notice a clear
  115. separation between the different chunk the box receives. In each chunk, we
  116. have an EBML hierarchy with the different nodes. Here we analyse a signal
  117. stream so we have a header followed by multiple buffers.
  118. Concerning the header, we can focuse on the signal header part and
  119. the streamed matrix header part. In the first one, we can see that the sampling
  120. rate node appears as an integer with value 512 (the default sinus oscillator
  121. sampling frequency). The second one contains the description of the streamed
  122. matrix. The matrix has two dimensions (electrodes and sample count per buffer).
  123. The first dimension has a size of 4 (the default sinus oscillator channel count)
  124. and each of this channel has a label (channel 0-3). Finally, the second dimension
  125. has a size of 8 (the sample count per buffer you manually put in the sinus
  126. oscillator configuration) and the samples themselves do not have a name.
  127. Now looking at the buffer, we only have the streamed matrix part (signal
  128. stream do not produce signal specific buffer). The buffer content can not
  129. be displayed in the console (it could be a huge amount of binary non human
  130. readable data, so it is not relevant to print it). But you have an information
  131. of the size of this buffer. 256 is exactly the number of channels (4) multiplied
  132. by the number of samples per buffer (8) multiplied by the size of a single sample
  133. (8 because a sample is coded on a 64 bits float).
  134. When familiar with EBML and OpenViBE streams, this box is a strong tool
  135. to analyze what is sent from a box to another.
  136. .. _Doc_BoxAlgorithm_EBMLStreamSpy_Miscellaneous:
  137. Miscellaneous
  138. -------------
  139. The syntax of the configuration file is simple. Each line of the file
  140. should contain 3 fields. The first field is the name of the EBML node
  141. that should be printed in the log manager (this is human readable).
  142. The second field is the EBML node identifier. The last field is the node
  143. type. Several types are supported :
  144. - \e master : this means that this node does not have data attached but has
  145. several children. Any non master node is a leaf, so can contain data.
  146. - \e integer : this means that this node contains a signed integer value
  147. - \e uinteger : this means that this node contains an unsigned integer value
  148. - \e string : this means that this node contains an ASCII string value
  149. - \e float : this means that this node contains a floating point value
  150. - \e binary : this means that this node contains a raw buffer of elements.
  151. In such case, only the size of the buffer is printed. The content of the
  152. buffer is not printed.
  153. Any node identifier found in the stream and not present in the configuration
  154. file will be considered of type \e unknown and treated as if it was a \e binary
  155. node.
  156. Following is a part of the sample configuration file to illustrate the syntax :
  157. .. code::
  158. ...
  159. OVTK_NodeId_Header_StreamedMatrix EBML::CIdentifier(0x0072F560, 0x7ED2CBED) master
  160. OVTK_NodeId_Header_StreamedMatrix_DimensionCount EBML::CIdentifier(0x003FEBD4, 0x2725D428) uinteger
  161. OVTK_NodeId_Header_StreamedMatrix_Dimension EBML::CIdentifier(0x0000E3C0, 0x3A7D5141) master
  162. OVTK_NodeId_Header_StreamedMatrix_Dimension_Size EBML::CIdentifier(0x001302F7, 0x36D8438A) uinteger
  163. OVTK_NodeId_Header_StreamedMatrix_Dimension_Label EBML::CIdentifier(0x00153E40, 0x190227E0) string
  164. OVTK_NodeId_Buffer_StreamedMatrix EBML::CIdentifier(0x00120663, 0x08FBC165) master
  165. OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer EBML::CIdentifier(0x00B18C10, 0x427D098C) binary
  166. OVTK_NodeId_Header_Signal EBML::CIdentifier(0x007855DE, 0x3748D375) master
  167. OVTK_NodeId_Header_Signal_Sampling EBML::CIdentifier(0x00141C43, 0x0C37006B) uinteger
  168. ...