11/*
2+ * Copyright (C) 2019 Neil C Smith
23 * Copyright (C) 2009 Levente Farkas <[email protected] > 34 * Copyright (C) 2009 Tamas Korodi <[email protected] > 45 * Copyright (C) 2008 Wayne Meissner
2425
2526import static org .freedesktop .gstreamer .lowlevel .GstVideoOverlayAPI .GSTVIDEOOVERLAY_API ;
2627
28+ import com .sun .jna .Pointer ;
2729import org .freedesktop .gstreamer .BusSyncReply ;
2830import org .freedesktop .gstreamer .Element ;
2931import org .freedesktop .gstreamer .Message ;
3032
31- import com .sun .jna .Native ;
32- import com .sun .jna .NativeLong ;
33- import com .sun .jna .Platform ;
3433
3534/**
36- * Interface for elements providing tuner operations
35+ * Interface for setting/getting a window system resource on elements
36+ * supporting it to configure a window into which to render a video.
3737 */
3838public class VideoOverlay extends GstInterface {
3939 /**
@@ -48,21 +48,21 @@ public static VideoOverlay wrap(Element element) {
4848
4949 /**
5050 * Convenience function to check if the given message is a "prepare-window-handle".
51- * This usefull for setup native window handles with {@link BusSyncReply}.
51+ * This useful for setup native window handles with {@link BusSyncReply}.
5252 *
5353 * @param message
5454 * @return
5555 */
56- public static boolean isVideoOverlayPrepareWindowHandleMessage (Message message ) {
56+ public static boolean isPrepareWindowHandleMessage (Message message ) {
5757 return GSTVIDEOOVERLAY_API .gst_is_video_overlay_prepare_window_handle_message (message );
5858 }
5959
6060 /**
61- * Creates a new <tt>XOverlay </tt> instance
61+ * Creates a new <tt>VideoOverlay </tt> instance
6262 *
63- * @param element the element that implements the tuner interface
63+ * @param element the element that implements the overlay interface
6464 */
65- protected VideoOverlay (Element element ) {
65+ private VideoOverlay (Element element ) {
6666 super (element , GSTVIDEOOVERLAY_API .gst_video_overlay_get_type ());
6767 }
6868
@@ -72,25 +72,7 @@ protected VideoOverlay(Element element) {
7272 * @param handle A native handle to use to display video.
7373 */
7474 public void setWindowHandle (long handle ) {
75- GSTVIDEOOVERLAY_API .gst_video_overlay_set_window_handle (this , new NativeLong (handle ));
76- }
77- /**
78- * Sets the native window for the {@link Element} to use to display video.
79- *
80- * @param window A native window to use to display video, or <tt>null</tt> to
81- * stop using the previously set window.
82- */
83- public void setWindowHandle (java .awt .Component window ) {
84- if (window == null ) {
85- setWindowHandle (0 );
86- return ;
87- }
88- if (window .isLightweight ())
89- throw new IllegalArgumentException ("Component must be a native window" );
90- if (Platform .isWindows ())
91- GSTVIDEOOVERLAY_API .gst_video_overlay_set_window_handle (this , Native .getComponentPointer (window ));
92- else
93- setWindowHandle (Native .getComponentID (window ));
75+ GSTVIDEOOVERLAY_API .gst_video_overlay_set_window_handle (this , new Pointer (handle ));
9476 }
9577
9678 /**
@@ -116,7 +98,7 @@ public void handleEvent(boolean handle_events) {
11698 * Configure a subregion as a video target within the window set by
11799 * {@link #setWindowHandle(long)}. If this is not used or not supported
118100 * the video will fill the area of the window set as the overlay to 100%.
119- * By specifying the rectangle, the video can be overlayed to a specific
101+ * By specifying the rectangle, the video can be overlaid to a specific
120102 * region of that window only. After setting the new rectangle one should
121103 * call {@link #expose()} to force a redraw. To unset the region pass -1
122104 * for the width and height parameters.
@@ -132,28 +114,5 @@ public void handleEvent(boolean handle_events) {
132114 public boolean setRenderRectangle (int x , int y , int width , int height ) {
133115 return GSTVIDEOOVERLAY_API .gst_video_overlay_set_render_rectangle (this , x , y , width , height );
134116 }
135-
136- /**
137- * Configure a subregion as a video target within the window set by
138- * {@link #setWindowHandle(long)}. If this is not used or not supported
139- * the video will fill the area of the window set as the overlay to 100%.
140- * By specifying the rectangle, the video can be overlayed to a specific
141- * region of that window only. After setting the new rectangle one should
142- * call {@link #expose()} to force a redraw. To unset the region pass -1
143- * for the width and height parameters.
144- *
145- * This method is needed for non fullscreen video overlay in UI toolkits
146- * that do not support subwindows.
147- *
148- * @param overlay
149- * @param x
150- * @param y
151- * @param width
152- * @param height
153- */
154- @ Deprecated
155- public boolean setRenderRectangle (VideoOverlay overlay , int x , int y , int width , int height ) {
156- return GSTVIDEOOVERLAY_API .gst_video_overlay_set_render_rectangle (this , x , y , width , height );
157- }
158117
159118}
0 commit comments