1 /*
2 * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1391 if (bufferListeners != null) {
1392 bufferListeners.clear();
1393 }
1394
1395 if (audioSpectrumListeners != null) {
1396 audioSpectrumListeners.clear();
1397 }
1398
1399 if (videoRenderControl != null) {
1400 videoRenderControl = null;
1401 }
1402
1403 if (onDispose != null) {
1404 onDispose.run();
1405 }
1406
1407 isDisposed = true;
1408 }
1409 } finally {
1410 disposeLock.unlock();
1411 }
1412 }
1413
1414 //**************************************************************************
1415 //***** Non-JNI methods called by the native layer. These methods are called
1416 //***** from the native layer via the invocation API. Their purpose is to
1417 //***** dispatch certain events to the Java layer. Each of these methods
1418 //***** posts an event on the <code>EventQueueThread</code> which in turn
1419 //***** forwards the event to any registered listeners.
1420 //**************************************************************************
1421 protected void sendWarning(int warningCode, String warningMessage) {
1422 if (eventLoop != null) {
1423 String message = String.format(MediaUtils.NATIVE_MEDIA_WARNING_FORMAT,
1424 warningCode);
1425 if (warningMessage != null) {
1426 message += ": " + warningMessage;
1427 }
1428 eventLoop.postEvent(new WarningEvent(this, message));
1429 }
1430 }
|
1 /*
2 * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1391 if (bufferListeners != null) {
1392 bufferListeners.clear();
1393 }
1394
1395 if (audioSpectrumListeners != null) {
1396 audioSpectrumListeners.clear();
1397 }
1398
1399 if (videoRenderControl != null) {
1400 videoRenderControl = null;
1401 }
1402
1403 if (onDispose != null) {
1404 onDispose.run();
1405 }
1406
1407 isDisposed = true;
1408 }
1409 } finally {
1410 disposeLock.unlock();
1411 }
1412 }
1413
1414 @Override
1415 public boolean isErrorEventCached() {
1416 synchronized (cachedErrorEvents) {
1417 if (cachedErrorEvents.isEmpty()) {
1418 return false;
1419 } else {
1420 return true;
1421 }
1422 }
1423 }
1424
1425 //**************************************************************************
1426 //***** Non-JNI methods called by the native layer. These methods are called
1427 //***** from the native layer via the invocation API. Their purpose is to
1428 //***** dispatch certain events to the Java layer. Each of these methods
1429 //***** posts an event on the <code>EventQueueThread</code> which in turn
1430 //***** forwards the event to any registered listeners.
1431 //**************************************************************************
1432 protected void sendWarning(int warningCode, String warningMessage) {
1433 if (eventLoop != null) {
1434 String message = String.format(MediaUtils.NATIVE_MEDIA_WARNING_FORMAT,
1435 warningCode);
1436 if (warningMessage != null) {
1437 message += ": " + warningMessage;
1438 }
1439 eventLoop.postEvent(new WarningEvent(this, message));
1440 }
1441 }
|