|
1 | 1 | /* |
| 2 | + * Copyright (c) 2016 Christophe Lafolet |
2 | 3 | * Copyright (c) 2009 Levente Farkas |
3 | 4 | * Copyright (C) 2007 Wayne Meissner |
4 | 5 | * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]> |
|
21 | 22 |
|
22 | 23 | package org.freedesktop.gstreamer; |
23 | 24 |
|
24 | | -import java.util.List; |
| 25 | +import static org.freedesktop.gstreamer.lowlevel.GstBinAPI.GSTBIN_API; |
| 26 | +import static org.freedesktop.gstreamer.lowlevel.GstParseAPI.GSTPARSE_API; |
25 | 27 |
|
26 | | -import com.sun.jna.Pointer; |
| 28 | +import java.util.List; |
27 | 29 |
|
28 | 30 | import org.freedesktop.gstreamer.lowlevel.GstAPI.GErrorStruct; |
29 | 31 | import org.freedesktop.gstreamer.lowlevel.GstAPI.GstCallback; |
30 | 32 | import org.freedesktop.gstreamer.lowlevel.GstTypes; |
31 | 33 |
|
32 | | -import static org.freedesktop.gstreamer.lowlevel.GstBinAPI.GSTBIN_API; |
33 | | -import static org.freedesktop.gstreamer.lowlevel.GstParseAPI.GSTPARSE_API; |
| 34 | +import com.sun.jna.Pointer; |
34 | 35 |
|
35 | 36 | /** |
36 | 37 | * Base class and element that can contain other elements. |
@@ -294,6 +295,7 @@ public void callback(Bin bin, Element elem) { |
294 | 295 | } |
295 | 296 | }); |
296 | 297 | } |
| 298 | + |
297 | 299 | /** |
298 | 300 | * Disconnect the listener for the <code>element-added</code> signal |
299 | 301 | * |
@@ -340,6 +342,87 @@ public void disconnect(ELEMENT_REMOVED listener) { |
340 | 342 | disconnect(ELEMENT_REMOVED.class, listener); |
341 | 343 | } |
342 | 344 |
|
| 345 | + /** |
| 346 | + * Signal emitted when an {@link Element} is added to sub-bin of this {@link Bin} |
| 347 | + * |
| 348 | + * @see #connect(DEEP_ELEMENT_ADDED) |
| 349 | + * @see #disconnect(DEEP_ELEMENT_ADDED) |
| 350 | + */ |
| 351 | + public static interface DEEP_ELEMENT_ADDED { |
| 352 | + /** |
| 353 | + * Called when an {@link Element} is added to a {@link Bin} |
| 354 | + * |
| 355 | + * Since GStreamer 1.10 |
| 356 | + * |
| 357 | + * @param bin the Bin |
| 358 | + * @param sub_bin the Bin the element was added to. |
| 359 | + * @param element the {@link Element} that was added. |
| 360 | + */ |
| 361 | + public void elementAdded(Bin bin, Bin sub_bin, Element element); |
| 362 | + } |
| 363 | + /** |
| 364 | + * Add a listener for the <code>deep-element-added</code> signal on this Bin |
| 365 | + * |
| 366 | + * @param listener The listener to be called when an {@link Element} is added. |
| 367 | + */ |
| 368 | + public void connect(final DEEP_ELEMENT_ADDED listener) { |
| 369 | + connect(DEEP_ELEMENT_ADDED.class, listener, new GstCallback() { |
| 370 | + @SuppressWarnings("unused") |
| 371 | + public void callback(Bin bin, Bin sub_bin, Element elem) { |
| 372 | + listener.elementAdded(bin, sub_bin, elem); |
| 373 | + } |
| 374 | + }); |
| 375 | + } |
| 376 | + |
| 377 | + /** |
| 378 | + * Disconnect the listener for the <code>deep-element-added</code> signal |
| 379 | + * |
| 380 | + * @param listener The listener that was registered to receive the signal. |
| 381 | + */ |
| 382 | + public void disconnect(DEEP_ELEMENT_ADDED listener) { |
| 383 | + disconnect(DEEP_ELEMENT_ADDED.class, listener); |
| 384 | + } |
| 385 | + |
| 386 | + /** |
| 387 | + * Signal emitted when an {@link Element} is removed from sub-bin of this {@link Bin} |
| 388 | + * |
| 389 | + * @see #connect(ELEMENT_REMOVED) |
| 390 | + * @see #disconnect(ELEMENT_REMOVED) |
| 391 | + */ |
| 392 | + public static interface DEEP_ELEMENT_REMOVED { |
| 393 | + /** |
| 394 | + * Called when an {@link Element} is removed from a {@link Bin} |
| 395 | + * |
| 396 | + * Since GStreamer 1.10 |
| 397 | + * |
| 398 | + * @param bin the Bin |
| 399 | + * @param sub_bin the Bin the element was removed from. |
| 400 | + * @param element the {@link Element} that was removed. |
| 401 | + */ |
| 402 | + public void elementRemoved(Bin bin, Bin sub_bin, Element element); |
| 403 | + } |
| 404 | + /** |
| 405 | + * Add a listener for the <code>deep-element-removed</code> signal on this Bin |
| 406 | + * |
| 407 | + * @param listener The listener to be called when an {@link Element} is removed. |
| 408 | + */ |
| 409 | + public void connect(final DEEP_ELEMENT_REMOVED listener) { |
| 410 | + connect(DEEP_ELEMENT_REMOVED.class, listener, new GstCallback() { |
| 411 | + @SuppressWarnings("unused") |
| 412 | + public void callback(Bin bin, Bin sub_bin, Element elem) { |
| 413 | + listener.elementRemoved(bin, sub_bin, elem); |
| 414 | + } |
| 415 | + }); |
| 416 | + } |
| 417 | + /** |
| 418 | + * Disconnect the listener for the <code>deep-element-removed</code> signal |
| 419 | + * |
| 420 | + * @param listener The listener that was registered to receive the signal. |
| 421 | + */ |
| 422 | + public void disconnect(DEEP_ELEMENT_REMOVED listener) { |
| 423 | + disconnect(DEEP_ELEMENT_REMOVED.class, listener); |
| 424 | + } |
| 425 | + |
343 | 426 | /** |
344 | 427 | * Signal emitted when an {@link Element} has latency |
345 | 428 | * |
|
0 commit comments