1 /*
2 * Copyright (c) 2010, 2015, 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
2650 if (listener != null) {
2651 listener.spectrumDataUpdate(evt.getTimestamp(),
2652 evt.getDuration(),
2653 magnitudes = evt.getSource().getMagnitudes(magnitudes),
2654 phases = evt.getSource().getPhases(phases));
2655 }
2656 });
2657 }
2658 }
2659
2660 private final Object renderLock = new Object();
2661 private VideoDataBuffer currentRenderFrame;
2662 private VideoDataBuffer nextRenderFrame;
2663
2664 // NGMediaView will call this to get the frame to render
2665 /**
2666 * WARNING: You must call releaseFrame() on the returned frame when you are
2667 * finished with it or a massive memory leak will occur.
2668 *
2669 * @return the current frame to be used for rendering, or null if not in a render cycle
2670 * @treatAsPrivate implementation detail
2671 * @deprecated This is an internal API that is not intended for use and will be removed in the next version
2672 */
2673 @Deprecated
2674 public VideoDataBuffer impl_getLatestFrame() {
2675 synchronized (renderLock) {
2676 if (null != currentRenderFrame) {
2677 currentRenderFrame.holdFrame();
2678 }
2679 return currentRenderFrame;
2680 }
2681 }
2682
2683 private class RendererListener implements
2684 com.sun.media.jfxmedia.events.VideoRendererListener,
2685 TKPulseListener
2686 {
2687 boolean updateMediaViews;
2688
2689 @Override
2690 public void videoFrameUpdated(NewFrameEvent nfe) {
2691 VideoDataBuffer vdb = nfe.getFrameData();
2692 if (null != vdb) {
2693
2694 Duration frameTS = new Duration(vdb.getTimestamp() * 1000);
|
1 /*
2 * Copyright (c) 2010, 2016, 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
2650 if (listener != null) {
2651 listener.spectrumDataUpdate(evt.getTimestamp(),
2652 evt.getDuration(),
2653 magnitudes = evt.getSource().getMagnitudes(magnitudes),
2654 phases = evt.getSource().getPhases(phases));
2655 }
2656 });
2657 }
2658 }
2659
2660 private final Object renderLock = new Object();
2661 private VideoDataBuffer currentRenderFrame;
2662 private VideoDataBuffer nextRenderFrame;
2663
2664 // NGMediaView will call this to get the frame to render
2665 /**
2666 * WARNING: You must call releaseFrame() on the returned frame when you are
2667 * finished with it or a massive memory leak will occur.
2668 *
2669 * @return the current frame to be used for rendering, or null if not in a render cycle
2670 */
2671 VideoDataBuffer getLatestFrame() {
2672 synchronized (renderLock) {
2673 if (null != currentRenderFrame) {
2674 currentRenderFrame.holdFrame();
2675 }
2676 return currentRenderFrame;
2677 }
2678 }
2679
2680 private class RendererListener implements
2681 com.sun.media.jfxmedia.events.VideoRendererListener,
2682 TKPulseListener
2683 {
2684 boolean updateMediaViews;
2685
2686 @Override
2687 public void videoFrameUpdated(NewFrameEvent nfe) {
2688 VideoDataBuffer vdb = nfe.getFrameData();
2689 if (null != vdb) {
2690
2691 Duration frameTS = new Duration(vdb.getTimestamp() * 1000);
|