1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

LibVideo: Reorganize demuxer file hierarchy and rename Matroska files

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.
This commit is contained in:
Zaggy1024 2022-11-09 19:47:56 -06:00 committed by Andreas Kling
parent edec6bdc32
commit 9cf7e8c5aa
13 changed files with 56 additions and 58 deletions

View file

@ -1,15 +1,16 @@
/*
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibMain/Main.h>
#include <LibVideo/MatroskaReader.h>
#include <LibVideo/Containers/Matroska/Reader.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv);
auto document = Video::Matroska::Reader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"sv);
if (!document) {
return Error::from_string_literal("Failed to parse :(");
}
@ -30,10 +31,10 @@ ErrorOr<int> serenity_main(Main::Arguments)
outln("\tTrack has Language \"{}\"", track.language().characters());
outln("\tTrack has CodecID \"{}\"", track.codec_id().characters());
if (track.track_type() == Video::TrackEntry::TrackType::Video) {
if (track.track_type() == Video::Matroska::TrackEntry::TrackType::Video) {
auto const video_track = track.video_track().value();
outln("\t\tVideo is {} pixels wide by {} pixels tall", video_track.pixel_width, video_track.pixel_height);
} else if (track.track_type() == Video::TrackEntry::TrackType::Audio) {
} else if (track.track_type() == Video::Matroska::TrackEntry::TrackType::Audio) {
auto const audio_track = track.audio_track().value();
outln("\t\tAudio has {} channels with a bit depth of {}", audio_track.channels, audio_track.bit_depth);
}