11/*
22 * Copyright (c) 2019 Neil C Smith
33 * Copyright (c) 2007 Wayne Meissner
4- *
5- * This file is part of gstreamer-java.
64 *
75 * This code is free software: you can redistribute it and/or modify it under
86 * the terms of the GNU Lesser General Public License version 3 only, as
5250import org .freedesktop .gstreamer .Sample ;
5351
5452/**
55- *
53+ * A Swing component for displaying video from a GStreamer pipeline.
5654 */
5755public class GstVideoComponent extends javax .swing .JComponent {
5856
5957 private final Lock bufferLock = new ReentrantLock ();
6058 private final AppSink videosink ;
6159 private final boolean useVolatile ;
62-
60+
6361 private BufferedImage currentImage = null ;
6462 private RenderComponent renderComponent = new RenderComponent ();
6563 private boolean keepAspect = true ;
@@ -69,14 +67,15 @@ public class GstVideoComponent extends javax.swing.JComponent {
6967 private volatile boolean updatePending = false ;
7068
7169 /**
72- * Creates a new instance of GstVideoComponent
70+ * Create a GstVideoComponent. A new AppSink element will be created that
71+ * can be accessed using {@link #getElement()} and added to a pipeline.
7372 */
7473 public GstVideoComponent () {
7574 this (new AppSink ("GstVideoComponent" ));
7675 }
7776
7877 /**
79- * Creates a new instance of GstVideoComponent
78+ * Create a GstVideoComponent wrapping the provided AppSink element.
8079 */
8180 public GstVideoComponent (AppSink appsink ) {
8281 this .videosink = appsink ;
@@ -182,10 +181,21 @@ public void actionPerformed(ActionEvent arg0) {
182181 }
183182 };
184183
184+ /**
185+ * Get the wrapped AppSink element.
186+ *
187+ * @return sink element
188+ */
185189 public Element getElement () {
186190 return videosink ;
187191 }
188192
193+ /**
194+ * Set whether to respect the aspect ratio of the video when scaling.
195+ * Defaults to true.
196+ *
197+ * @param keepAspect respect aspect ratio
198+ */
189199 public void setKeepAspect (boolean keepAspect ) {
190200 this .keepAspect = keepAspect ;
191201 }
0 commit comments