VideoPlayer: Port VideoPlayer to LibMain

This commit is contained in:
Conor Byrne 2021-12-31 22:29:07 +00:00 committed by Brian Gianforcaro
parent 5cfbaad0a5
commit 2042a4d1e1
Notes: sideshowbarker 2024-07-17 21:52:08 +09:00
2 changed files with 6 additions and 5 deletions

View file

@ -9,4 +9,4 @@ set(SOURCES
) )
serenity_bin(VideoPlayer) serenity_bin(VideoPlayer)
target_link_libraries(VideoPlayer LibVideo LibAudio LibGUI) target_link_libraries(VideoPlayer LibVideo LibAudio LibGUI LibMain)

View file

@ -10,13 +10,14 @@
#include <LibGUI/ImageWidget.h> #include <LibGUI/ImageWidget.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibMain/Main.h>
#include <LibVideo/MatroskaReader.h> #include <LibVideo/MatroskaReader.h>
#include <LibVideo/VP9/Decoder.h> #include <LibVideo/VP9/Decoder.h>
int main(int argc, char** argv) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
auto app = GUI::Application::construct(argc, argv); auto app = TRY(GUI::Application::try_create(arguments));
auto window = GUI::Window::construct(); auto window = TRY(GUI::Window::try_create());
auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm"); auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm");
auto const& optional_track = document->track_for_track_type(Video::TrackEntry::TrackType::Video); auto const& optional_track = document->track_for_track_type(Video::TrackEntry::TrackType::Video);
@ -32,7 +33,7 @@ int main(int argc, char** argv)
auto& image_widget = main_widget.add<GUI::ImageWidget>(); auto& image_widget = main_widget.add<GUI::ImageWidget>();
image_widget.set_bitmap(image); image_widget.set_bitmap(image);
image_widget.set_fixed_size(video_track.pixel_height, video_track.pixel_width); image_widget.set_fixed_size(video_track.pixel_height, video_track.pixel_width);
main_widget.add_child(image_widget); TRY(main_widget.try_add_child(image_widget));
Video::VP9::Decoder vp9_decoder; Video::VP9::Decoder vp9_decoder;
for (auto const& cluster : document->clusters()) { for (auto const& cluster : document->clusters()) {