mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-29 02:38:07 +08:00
add "plugin" renderer for video_plugin papget
This commit is contained in:
@@ -176,6 +176,8 @@ let create = fun canvas_group papget ->
|
|||||||
match display with
|
match display with
|
||||||
"mplayer" ->
|
"mplayer" ->
|
||||||
(new Papget_renderer.canvas_mplayer canvas_group ~config x y :> Papget_renderer.t)
|
(new Papget_renderer.canvas_mplayer canvas_group ~config x y :> Papget_renderer.t)
|
||||||
|
| "plugin" ->
|
||||||
|
(new Papget_renderer.canvas_plugin canvas_group ~config x y :> Papget_renderer.t)
|
||||||
| _ -> failwith (sprintf "Unexpected papget display: %s" display) in
|
| _ -> failwith (sprintf "Unexpected papget display: %s" display) in
|
||||||
|
|
||||||
let properties = locked papget in
|
let properties = locked papget in
|
||||||
|
|||||||
@@ -344,6 +344,32 @@ class canvas_mplayer = fun ?(config=[]) canvas_group x y ->
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
(****************************************************************************)
|
||||||
|
class canvas_plugin = fun ?(config=[]) canvas_group x y ->
|
||||||
|
let command = PC.get_prop "command" config "missing_plugin_command" in
|
||||||
|
let width = float_of_string (PC.get_prop "width" config "320.")
|
||||||
|
and height = float_of_string (PC.get_prop "height" config "240.") in
|
||||||
|
let socket = GWindow.socket () in
|
||||||
|
let group = GnoCanvas.group ~x ~y canvas_group in
|
||||||
|
let _item = GnoCanvas.widget ~width ~height ~widget:socket group in
|
||||||
|
|
||||||
|
object
|
||||||
|
method tag = "Plugin"
|
||||||
|
method item = (group :> movable_item)
|
||||||
|
method edit = fun (pack:GObj.widget -> unit) -> ()
|
||||||
|
method update = fun (value:string) -> ()
|
||||||
|
method config = fun () ->
|
||||||
|
[ PC.property "command" command;
|
||||||
|
PC.float_property "width" width;
|
||||||
|
PC.float_property "height" height ]
|
||||||
|
initializer
|
||||||
|
group#lower_to_bottom ();
|
||||||
|
let com = sprintf "exec %s0x%lx" command socket#xwindow in
|
||||||
|
let dev_null = Unix.descr_of_out_channel (open_out "/dev/null") in
|
||||||
|
ignore (Unix.create_process "/bin/sh" [|"/bin/sh"; "-c"; com|] dev_null dev_null dev_null)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let renderers =
|
let renderers =
|
||||||
[ (new canvas_text :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t);
|
[ (new canvas_text :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t);
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ class canvas_button : ?config:Xml.xml list -> #GnoCanvas.group -> float -> float
|
|||||||
class canvas_mplayer : ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t
|
class canvas_mplayer : ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t
|
||||||
(** [canvas_mplayer config group x y] *)
|
(** [canvas_mplayer config group x y] *)
|
||||||
|
|
||||||
|
class canvas_plugin : ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t
|
||||||
|
(** [canvas_plugin config group x y] *)
|
||||||
|
|
||||||
val lazy_tagged_renderers :
|
val lazy_tagged_renderers :
|
||||||
(string * (?config:Xml.xml list -> GnoCanvas.group -> float -> float -> t))
|
(string * (?config:Xml.xml list -> GnoCanvas.group -> float -> float -> t))
|
||||||
list lazy_t
|
list lazy_t
|
||||||
|
|||||||
Reference in New Issue
Block a user