mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add media (WindowGLContext) module in canvas_trait
This module adds a structure (WindowGLContext) which holds the OpenGL parameters that are going to be used by servo-media player to render video frames using OpenGL. In order to fill this structure, three new methods were added to WindowMethods trait. In this patch only the Glutin-based implementation provides a simple boilerplate. The WindowGLContext is created in the entry point of libservo, when the application window is created, and later passed to the constellation, the pipeline and to the window element in dom, thus htmlmediaelement has a mean to obtain these parameters via its window.
This commit is contained in:
parent
e9f46f9d72
commit
9f4f9dc750
16 changed files with 133 additions and 26 deletions
|
@ -68,6 +68,7 @@ use crate::webdriver_handlers::jsval_to_webdriver;
|
|||
use app_units::Au;
|
||||
use base64;
|
||||
use bluetooth_traits::BluetoothRequest;
|
||||
use canvas_traits::media::WindowGLContext;
|
||||
use canvas_traits::webgl::WebGLChan;
|
||||
use crossbeam_channel::{unbounded, Sender, TryRecvError};
|
||||
use cssparser::{Parser, ParserInput, SourceLocation};
|
||||
|
@ -318,6 +319,10 @@ pub struct Window {
|
|||
/// Replace unpaired surrogates in DOM strings with U+FFFD.
|
||||
/// See <https://github.com/servo/servo/issues/6564>
|
||||
replace_surrogates: bool,
|
||||
|
||||
/// Window's GL context from application
|
||||
#[ignore_malloc_size_of = "defined in script_thread"]
|
||||
player_context: WindowGLContext,
|
||||
}
|
||||
|
||||
impl Window {
|
||||
|
@ -481,6 +486,10 @@ impl Window {
|
|||
pub fn unminify_js(&self) -> bool {
|
||||
self.unminify_js
|
||||
}
|
||||
|
||||
pub fn get_player_context(&self) -> WindowGLContext {
|
||||
self.player_context.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#atob
|
||||
|
@ -2074,6 +2083,7 @@ impl Window {
|
|||
is_headless: bool,
|
||||
replace_surrogates: bool,
|
||||
user_agent: Cow<'static, str>,
|
||||
player_context: WindowGLContext,
|
||||
) -> DomRoot<Self> {
|
||||
let layout_rpc: Box<dyn LayoutRPC + Send> = {
|
||||
let (rpc_send, rpc_recv) = unbounded();
|
||||
|
@ -2154,6 +2164,7 @@ impl Window {
|
|||
unminify_js,
|
||||
userscripts_path,
|
||||
replace_surrogates,
|
||||
player_context,
|
||||
});
|
||||
|
||||
unsafe { WindowBinding::Wrap(runtime.cx(), win) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue