mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Add MediaElementAudioSourceNode interface
This commit is contained in:
committed by
Luke Wilde
parent
a588756105
commit
aa39aa50f7
47
Libraries/LibWeb/WebAudio/MediaElementAudioSourceNode.cpp
Normal file
47
Libraries/LibWeb/WebAudio/MediaElementAudioSourceNode.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/MediaElementAudioSourceNodePrototype.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/WebAudio/AudioContext.h>
|
||||
#include <LibWeb/WebAudio/MediaElementAudioSourceNode.h>
|
||||
|
||||
namespace Web::WebAudio {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(MediaElementAudioSourceNode);
|
||||
|
||||
MediaElementAudioSourceNode::MediaElementAudioSourceNode(JS::Realm& realm, GC::Ref<AudioContext> context, MediaElementAudioSourceOptions const& options)
|
||||
: AudioNode(realm, context)
|
||||
, m_media_element(*options.media_element)
|
||||
{
|
||||
}
|
||||
|
||||
MediaElementAudioSourceNode::~MediaElementAudioSourceNode() = default;
|
||||
|
||||
WebIDL::ExceptionOr<GC::Ref<MediaElementAudioSourceNode>> MediaElementAudioSourceNode::create(JS::Realm& realm, GC::Ref<AudioContext> context, MediaElementAudioSourceOptions const& options)
|
||||
{
|
||||
return construct_impl(realm, context, options);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<GC::Ref<MediaElementAudioSourceNode>> MediaElementAudioSourceNode::construct_impl(JS::Realm& realm, GC::Ref<AudioContext> context, MediaElementAudioSourceOptions const& options)
|
||||
{
|
||||
return realm.create<MediaElementAudioSourceNode>(realm, context, options);
|
||||
}
|
||||
|
||||
void MediaElementAudioSourceNode::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaElementAudioSourceNode);
|
||||
}
|
||||
|
||||
void MediaElementAudioSourceNode::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_media_element);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user