Table Of Contents

Previous topic

speect.uttproc_cb – Utterance Processor Callback

Next topic

speect.utt_ebml – Utterance EBML Serialization

Extensible Binary Meta Language (EBML) is a generalized file format for any kind of data, aiming to be a binary equivalent to XML. It provides a basic framework for storing data in XML-like tags.

speect.ebml – Extensible Binary Markup Language

EBML Reader

class speect.ebml.SEbmlRead(*args)

SEbmlRead(path)

EBML data reader class. Create an Ebml reader object with a path to an EBML format file from which to read. The header of the file is read on successful opening of the file. The file is closed when the reader is deleted.

Parameters:path (string) – Full path and file name of the file to read from.
Returns:EBML data reader object.
Return type:SEbmlRead
SEbmlRead.ebml_version Get the EBML version of the file.
SEbmlRead.reader_version Get the EBML reader version of the file.
SEbmlRead.max_id_width Get the maximum ID width of the file.
SEbmlRead.max_size_width Get the maximum size width of the file.
SEbmlRead.doc_type_version Get the document type version of the file.
SEbmlRead.doc_type_reader_version Get the document type reader version of the file.
SEbmlRead.doc_type(*args) doctype()
SEbmlRead.peek_id() Peek the ID of the next element in the ebml data source.
SEbmlRead.skip_element() Skip the current ebml element.
SEbmlRead.read_uint() Read current element as an unsigned integer.
SEbmlRead.read_sint() Read current element as a signed integer.
SEbmlRead.read_double() Read current element as a double.
SEbmlRead.read_str() Read current element as a str.
SEbmlRead.read_object() Read current element as an object.
SEbmlRead.open_container() Open a container element and return it’s ID.
SEbmlRead.container_exhausted() Query if all of a currently open container’s elements have been read.
SEbmlRead.ebml_version

Get the EBML version of the file. The version of EBML to which the document conforms to.

Returns:EBML version.
Return type:int
SEbmlRead.reader_version

Get the EBML reader version of the file. The minimum EBML version a parser has to support in order to read the document.

Returns:EBML reader version.
Return type:int
SEbmlRead.max_id_width

Get the maximum ID width of the file. The maximum width of the IDs used in this document.

Returns:maximum ID width.
Return type:int
Note :Speect can not read EBML format file with a ID width greater than 4.
SEbmlRead.max_size_width

Get the maximum size width of the file. The maximum width of the size descriptors used in this document.

Returns:maximum size width.
Return type:int
Note :Speect can not read EBML format file with a size width greater than 4.
SEbmlRead.doc_type_version

Get the document type version of the file. The version of document type to which the document conforms to.

Returns:document type version.
Return type:int
SEbmlRead.doc_type_reader_version

Get the document type reader version of the file. The minimum doc_type_version version an interpreter has to support in order to read the document.

Returns:document type reader version.
Return type:int
SEbmlRead.doc_type()

doctype()

Get the document type of the file. An ASCII string that identifies the type of the document.

Returns:document type.
Return type:string
SEbmlRead.peek_id()

peek_id()

Peek the ID of the next element in the ebml data source.

Returns:Ebml ID.
Return type:int
SEbmlRead.skip_element()

skip_element()

Skip the current ebml element.

SEbmlRead.read_uint()

read_uint()

Read current element as an unsigned integer.

Returns:[ID, element]
Return type:tuple
SEbmlRead.read_sint()

read_sint()

Read current element as a signed integer.

Returns:[ID, element]
Return type:tuple
SEbmlRead.read_double()

read_double()

Read current element as a double.

Returns:[ID, element]
Return type:tuple
SEbmlRead.read_str()

read_str()

Read current element as a str.

Returns:[ID, element]
Return type:tuple
SEbmlRead.read_object()

read_object()

Read current element as an object.

Returns:[ID, element]
Return type:tuple
Note :The object must have an appropriate serialization formatter defined and registered for the spct_ebml format. If not, then the object can not be read.
SEbmlRead.open_container()

open_container()

Open a container element and return it’s ID.

Returns:ID
Return type:int
SEbmlRead.container_exhausted()

container_exhausted()

Query if all of a currently open container’s elements have been read. Thus, if true then the container is ‘exhausted’.

Returns:True of False.
Return type:bool

EBML Writer

class speect.ebml.SEbmlWrite(*args)
SEbmlWrite(path [, doc_type = ‘spct’ [, doc_type_version = 1 [, doc_type_read_version = 1 [,
ebml_version = 1 [, ebml_read_version = 1 [, max_id_width = 4 [, max_size_width = 4]]]]]]])

EBML data writer class. Create an Ebml writer object with a path to the file to write to and EBML header information. The header will be written to file. The file is closed when the reader is deleted.

Parameters:
  • path (string) – Full path and file name of the file to write to.
  • doc_type (string) – An ASCII string that identifies the type of the document.
  • doc_type_version (int) – The version of document type to which the document conforms to.
  • doc_type_read_version (int) – The minimum doc_type_version version an interpreter has to support in order to read the document.
  • ebml_version (int) – The version of EBML to which the document conforms to.
  • ebml_read_version (int) – The minimum EBML version a parser has to support in order to read the document.
  • max_id_width (int) – The maximum width of the IDs used in this document.
  • max_size_width (int) – The maximum width of the size descriptors used in this document.
Returns:

EBML data writer object.

Return type:

SEbmlWrite

Note :

Speect does not support max_id_width or max_size_width greater than 4.

SEbmlWrite.write_uint(val, id) Write an unsigned integer to the EBML data source.
SEbmlWrite.write_sint(val, id) Write an signed integer to the EBML data source.
SEbmlWrite.write_double(val, id) Write a double value to the EBML data source.
SEbmlWrite.write_str(*args) write_string(val, id)
SEbmlWrite.write_object(val, id) Write an object to the EBML data source.
SEbmlWrite.start_container(id) Start a container element with the given id.
SEbmlWrite.end_container(id) End (close) a previously started a container element.
SEbmlWrite.write_uint()

write_uint(val, id)

Write an unsigned integer to the EBML data source.

Parameters:
  • val (int) – The unsigned integer to write.
  • id (int) – The ID of the unsigned integer element.
SEbmlWrite.write_sint()

write_sint(val, id)

Write an signed integer to the EBML data source.

Parameters:
  • val (int) – The signed integer to write.
  • id (int) – The ID of the signed integer element.
SEbmlWrite.write_double()

write_double(val, id)

Write a double value to the EBML data source.

Parameters:
  • val (float) – The double value to write.
  • id (int) – The ID of the double element.
SEbmlWrite.write_str()

write_string(val, id)

Write a string to the EBML data source.

Parameters:
  • val (string) – The string to write.
  • id (int) – The ID of the string.
SEbmlWrite.write_object()

write_object(val, id)

Write an object to the EBML data source.

Parameters:
  • val (SObject) – The object to write.
  • id (int) – The ID of the object.
Note :

The object must have an appropriate serialization formatter defined and registered for the spct_ebml format. If not, then the object can not be written.

SEbmlWrite.start_container()

start_container(id)

Start a container element with the given id.

Parameters:id (int) – The ID of the container.
SEbmlWrite.end_container()

end_container(id)

End (close) a previously started a container element.