NAME
Parse::Matroska::Definitions
VERSION
version 0.001
SYNOPSIS
use Parse::Matroska::Definitions qw{elem_by_hexid};
my $ebml_id = elem_by_hexid('1a45dfa3');
print "EBML ID $ebml_id->{elid}'s name: $ebml_id->{name}";
DESCRIPTION
Contains the definition of the EBML grammar as expected in Matroska files. This module is meant mostly for internal use.
As this was extended from a script in mpv-player, some data generated is apparently useless for regular module users but is still relevant to the mpv-player script. Such data is annotated as being for mpv compatibility.
NOTE
The API of this module is not yet considered stable.
GLOBALS
These global variables are considered immutable.
- @Parse::Matroska::Definitions::global_elem_list
-
A global list of known matroska elements. Useful for mpv's matroska script, used for generating C headers that parse matroska.
- %Parse::Matroska::Definitions::global_elem_dict
-
A global hash of known matroska elements. Used internally by "elem_by_hexid".
- %EBML_DEFINITION
-
Optionally-importable hash of known EBML IDs belonging to the EBML generic grammar.
- %MATROSKA_DEFINITION
-
Optionally-importable hash of known EBML IDs belonging to the Matroska-specific grammar.
METHODS
- elem_by_hexid(id)
-
Returns an EBML Element Definition corresponding to the provided hexadecimal string. Returns
undef
if the element is unknown. - elem(name,elid,valtype)
-
NOTE: never call this function yourself; it changes data structures that are considered immutable outside of this package.
Internal API function that generates the EBML Element Definitions.
This API function returns an array which first element is
elid
and the second is a generated hash. The generated hash is stored in the @global_elem_list and %global_elem_dict.The generated hash contains:
- name
-
The EBML Element's name, given through
name
. - elid
-
The EBML Element's hex id, given through
elid
. Used for lookups by "elem_by_hexid". - valtype
-
The EBML Element's type, given through
valtype
, except whenvaltype
is an arrayref. - multiple
-
If
name
ends with a '*', is set as true and strips the '*' from "name". Used to mark elements that may be repeated. - subelements
-
An arrayref of elements that may be children of this element, given through
valtype
if it is an arrayref. Sets "type" to 'sub' if there are subelements. - subids
-
An arrayref listing all the "elid"s of subelements,
uniq
ified.
The following elements are for mpv compatibility:
- definename
-
Name used for generating C #defines.
- fieldname
-
Name used for generating C struct fields.
- structname
-
Name used for generating C struct names.
- ebmltype
-
A pre-#defined constant to describe the element's type, set from
valtype
. - valname
-
Typename used when declaring a struct field referring to this element.
- define_ebml
-
Internal function that defines the EBML generic grammar.
Must not be called from outside the package.
- define_matroska
-
Internal function that defines the Matroska-specific EBML grammar.
Must not be called from outside the package.
AUTHOR
Diogo Franco <diogomfranco@gmail.com>, aka Kovensky.
SEE ALSO
Parse::Matroska::Reader, Parse::Matroska::Element.
LICENSE
The FreeBSD license, equivalent to the ISC license.