summaryrefslogtreecommitdiff
path: root/Userland/Utilities/matroska.cpp
AgeCommit message (Collapse)Author
2023-02-10AK+Everywhere: Do not implicitly copy variables in TRY macrosTimothy Flynn
For example, consider cases where we want to propagate errors only in specific instances: auto result = read_data(); // something like ErrorOr<ByteBuffer> if (result.is_error() && result.error().code() != EINTR) continue; auto bytes = TRY(result); The TRY invocation will currently copy the byte buffer when the expression (in this case, just a local variable) is stored into _temporary_result. This patch binds the expression to a reference to prevent such copies. In less trival invocations (such as TRY(some_function()), this will incur only temporary lifetime extensions, i.e. no functional change.
2023-01-15Everywhere: Fully qualify IsLvalueReference in TRY() macrosAndrew Kaster
If USING_AK_GLOBALLY is not defined, the name IsLvalueReference might not be available in the global namespace. Follow the pattern established in LibTest to fully qualify AK types in macros to avoid this problem.
2023-01-13AK+Everywhere: Disallow returning a reference from a fallible expressionTimothy Flynn
This will silently make a copy. Rather than masking this behavior, let's explicitly disallow it.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-11-25LibVideo: Implement Matroska Cues for faster keyframe lookupZaggy1024
This implements the fastest seeking mode available for tracks with cues using an array of cue points for each track. It approximates the index based on the seeking timestamp and then finds the earliest cue point before the timestamp. The approximation assumes that cues will be on a regular interval, which I don't believe is always the case, but it should at least be faster than iterating the whole set of cue points each time. Cues are stored per track, but most videos will only have cue points for the video track(s) that are present. For now, this assumes that it should only seek based on the cue points for the selected track. To seek audio in a video file, we should copy the seeked iterator over to the audio track's iterator after seeking is complete. The iterator will then skip to the next audio block.
2022-11-25Utilities/matroska: Add arguments to print specific detailsZaggy1024
This adds two options: - An option to print a specific track number only, and omit all others. - An option to print each block for each track that is printed.
2022-11-25LibVideo: Calculate Block timestamps for Matroska according to specZaggy1024
Tracks have a timestamp scale value that should be present which scales each block's timestamp offset to allow video to be synced with audio. They should also contain a CodecDelay element and may also contain a TrackOffset that offsets the block timestamps.
2022-11-25LibVideo: Make Matroska Block and Cluster timestamps absoluteZaggy1024
2022-11-25LibVideo: Read Matroska lazily so that large files can start quicklyZaggy1024
The Demuxer class was changed to return errors for more functions so that all of the underlying reading can be done lazily. Other than that, the demuxer interface is unchanged, and only the underlying reader was modified. The MatroskaDocument class is no more, and MatroskaReader's getter functions replace it. Every MatroskaReader getter beyond the Segment element's position is parsed lazily from the file as needed. This means that all getter functions can return DecoderErrors which must be handled by callers.
2022-11-25LibVideo: Propagate decoder errors in the Matroska ReaderZaggy1024
Matroska::Reader functions now return DecoderErrorOr instead of values being declared Optional. Useful errors can be handled by the users of the parser, similarly to the VP9 decoder. A lot of the error checking in the reader is a lot cleaner thanks to this change, since all reads can be range checked in Streamer::read_octet() now. Most functions for the Streamer class are now also out-of-line in Reader.cpp now instead of residing in the header.
2022-11-25LibVideo: Reorganize demuxer file hierarchy and rename Matroska filesZaggy1024
As new demuxers are added, this will get quite full of files, so it'll be good to have a separate folder for these. To avoid too many chained namespaces, the Containers subdirectory is not also a namespace, but the Matroska folder is for the sake of separating the multiple classes for parsed information entering the Video namespace.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-03-22matroska: Port to LibMainBrian Gianforcaro
2021-06-30LibVideo: Migrate to east-const style & apply other minor fixesFalseHonesty
This patch brings all of LibVideo up to the east-const style in the project. Additionally, it applies a few fixes from the reviews in #8170 that referred to older LibVideo code.
2021-06-06Userland: Fix matroska utility displaying invalid track dataFalseHonesty
2021-06-06Userland: Add matroska program to test parsing Matroska container filesFalseHonesty