add "plugin" renderer for video_plugin papget

This commit is contained in:
Pascal Brisset
2010-04-19 13:22:50 +00:00
parent 55866befe6
commit fa34c9a5f2
3 changed files with 31 additions and 0 deletions
+2
View File
@@ -176,6 +176,8 @@ let create = fun canvas_group papget ->
match display with
"mplayer" ->
(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
let properties = locked papget in
+26
View File
@@ -344,6 +344,32 @@ class canvas_mplayer = fun ?(config=[]) canvas_group x y ->
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 =
[ (new canvas_text :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t);
+3
View File
@@ -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
(** [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 :
(string * (?config:Xml.xml list -> GnoCanvas.group -> float -> float -> t))
list lazy_t