You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following line needs to be added to all existing handlers to fix compilation for binary cases.
HandleBinary(id ElementID, r io.Reader, info ElementInfo) error {
data, _ := ioutil.ReadAll(r)
// use data as before. should be safe to ignore errors (the parser will handle these)
}
To make it more convenient, consider adding a convenience function:
HandleBinary(id ElementID, r io.Reader, info ElementInfo) error {
data := mkvparse.ReadBytes(r)
// use data as before
}
Because reading strings require more code, a convenience function for strings is useful:
HandleString(id ElementID, r io.Reader, info ElementInfo) error {
str := mkvparse.ReadString(r)
// use str as before
}
The Read* functions probably need a parameter to limit the size of the read (with -1 to mean 'Unlimited')
Another alternative is to add an UnsafeHandler interface, and adapt it to the new handler interface:
remko
changed the title
Proposal: Change handler interface for lazy loading of unknown-sized elements
Change handler interface for lazy loading of unknown-sized elements
Jan 24, 2022
Change the following methods on the Handler interface:
to
This allows handlers to only read part of the data (in case it is too much for them to process).
Alternatively, change the signature to
where
BytesType
isString
orBinary
.The following line needs to be added to all existing handlers to fix compilation for binary cases.
To make it more convenient, consider adding a convenience function:
Because reading strings require more code, a convenience function for strings is useful:
The
Read*
functions probably need a parameter to limit the size of the read (with -1 to mean 'Unlimited')Another alternative is to add an
UnsafeHandler
interface, and adapt it to the new handler interface:The text was updated successfully, but these errors were encountered: