From f33a530732c6358fefb40a192a71de2b5df7d011 Mon Sep 17 00:00:00 2001 From: Emanuel Rabina Date: Tue, 13 Feb 2024 22:14:16 +1300 Subject: [PATCH] Remove the old media types --- .../cli/mediaplayer/MediaPlayer.groovy | 17 -- .../cli/mediaplayer/PlaybackScript.groovy | 4 +- .../redhorizon/engine/media/Animation.groovy | 214 ------------------ .../redhorizon/engine/media/Image.groovy | 125 ---------- .../redhorizon/engine/media/ImageStrip.groovy | 57 ----- .../redhorizon/engine/media/SoundTrack.groovy | 192 ---------------- .../redhorizon/engine/media/Video.groovy | 140 ------------ .../engine/scenegraph/nodes/Animation.groovy | 1 - .../nodes}/Playable.groovy | 2 +- .../engine/scenegraph/nodes/Sound.groovy | 1 - .../nodes}/StartEvent.groovy | 4 +- .../nodes}/StopEvent.groovy | 4 +- .../engine/scenegraph/nodes/Video.groovy | 1 - .../redhorizon/explorer/Explorer.groovy | 25 +- .../medialoaders/AnimationLoader.groovy | 98 -------- .../explorer/medialoaders/ImageLoader.groovy | 50 ---- .../explorer/medialoaders/ImagesLoader.groovy | 89 -------- .../explorer/medialoaders/MediaLoader.groovy | 57 ----- .../explorer/medialoaders/SoundLoader.groovy | 87 ------- .../explorer/medialoaders/VideoLoader.groovy | 95 -------- 20 files changed, 14 insertions(+), 1249 deletions(-) delete mode 100644 redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Animation.groovy delete mode 100644 redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Image.groovy delete mode 100644 redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/ImageStrip.groovy delete mode 100644 redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/SoundTrack.groovy delete mode 100644 redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Video.groovy rename redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/{media => scenegraph/nodes}/Playable.groovy (96%) rename redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/{media => scenegraph/nodes}/StartEvent.groovy (92%) rename redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/{media => scenegraph/nodes}/StopEvent.groovy (92%) delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/AnimationLoader.groovy delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/ImageLoader.groovy delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/ImagesLoader.groovy delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/MediaLoader.groovy delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/SoundLoader.groovy delete mode 100644 redhorizon-explorer/source/nz/net/ultraq/redhorizon/explorer/medialoaders/VideoLoader.groovy diff --git a/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/MediaPlayer.groovy b/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/MediaPlayer.groovy index 3d3455e8..43095526 100644 --- a/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/MediaPlayer.groovy +++ b/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/MediaPlayer.groovy @@ -89,23 +89,6 @@ class MediaPlayer extends Application { scene << mediaNode -// mediaLoader = switch (mediaFile) { -// case VideoFile -> new VideoLoader(mediaFile, scene, graphicsSystem, gameClock, inputEventStream) -// case AnimationFile -> new AnimationLoader(mediaFile, scene, graphicsSystem, gameClock, inputEventStream) -// case SoundFile -> new SoundLoader(mediaFile, scene, gameClock, inputEventStream) -// case ImageFile -> new ImageLoader(mediaFile, scene) -// case ImagesFile -> new ImagesLoader(mediaFile, palette, scene, graphicsSystem, inputEventStream) -// default -> throw new UnsupportedOperationException("No media player for the associated file class of ${mediaFile}") -// } -// -// var media = mediaLoader.load() -// if (media instanceof Playable) { -// media.on(StopEvent) { event -> -// stop() -// } -// media.play() -// } - // Universal quit on exit inputEventStream.on(KeyEvent) { event -> if (event.action == GLFW_PRESS && event.key == GLFW_KEY_ESCAPE) { diff --git a/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/PlaybackScript.groovy b/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/PlaybackScript.groovy index 050e50fd..a1c3946f 100644 --- a/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/PlaybackScript.groovy +++ b/redhorizon-cli/source/nz/net/ultraq/redhorizon/cli/mediaplayer/PlaybackScript.groovy @@ -18,10 +18,10 @@ package nz.net.ultraq.redhorizon.cli.mediaplayer import nz.net.ultraq.redhorizon.engine.Application import nz.net.ultraq.redhorizon.engine.input.KeyControl -import nz.net.ultraq.redhorizon.engine.media.Playable -import nz.net.ultraq.redhorizon.engine.media.StopEvent import nz.net.ultraq.redhorizon.engine.scenegraph.Scene +import nz.net.ultraq.redhorizon.engine.scenegraph.nodes.Playable import nz.net.ultraq.redhorizon.engine.scenegraph.nodes.PlaybackReadyEvent +import nz.net.ultraq.redhorizon.engine.scenegraph.nodes.StopEvent import nz.net.ultraq.redhorizon.engine.scenegraph.scripting.Script import org.slf4j.Logger diff --git a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Animation.groovy b/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Animation.groovy deleted file mode 100644 index 5f3ae9f5..00000000 --- a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Animation.groovy +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package nz.net.ultraq.redhorizon.engine.media - -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsElement -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsRenderer -import nz.net.ultraq.redhorizon.engine.graphics.Material -import nz.net.ultraq.redhorizon.engine.graphics.Mesh -import nz.net.ultraq.redhorizon.engine.graphics.Shader -import nz.net.ultraq.redhorizon.engine.graphics.Texture -import nz.net.ultraq.redhorizon.engine.graphics.opengl.SpriteShader -import nz.net.ultraq.redhorizon.engine.scenegraph.Node -import nz.net.ultraq.redhorizon.engine.time.Temporal -import nz.net.ultraq.redhorizon.filetypes.AnimationFile -import nz.net.ultraq.redhorizon.filetypes.ColourFormat -import nz.net.ultraq.redhorizon.filetypes.Streaming -import nz.net.ultraq.redhorizon.filetypes.StreamingDecoder -import nz.net.ultraq.redhorizon.filetypes.StreamingFrameEvent - -import org.joml.primitives.Rectanglef -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -import groovy.transform.PackageScope -import java.nio.ByteBuffer -import java.util.concurrent.ArrayBlockingQueue -import java.util.concurrent.BlockingQueue -import java.util.concurrent.CountDownLatch -import java.util.concurrent.Executors - -/** - * An animation that plays a series of images at a certain speed. - * - * @author Emanuel Rabina - */ -@SuppressWarnings('GrFinalVariableAccess') -class Animation extends Node implements GraphicsElement, Playable, Temporal { - - private static final Logger logger = LoggerFactory.getLogger(Animation) - - // Animation file attributes - final int width - final int height - final ColourFormat format - final int numFrames - final float frameRate - - private final StreamingDecoder animationDataWorker - private final BlockingQueue frames - private final int bufferSize - private final CountDownLatch bufferReady = new CountDownLatch(1) - private int framesQueued - private long animationTimeStart - - // Rendering information - private int lastFrame - private Material material - private Mesh mesh - private Shader shader - private List textures - - /** - * Constructor, create an animation out of animation file data. - * - * @param animationFile - * Animation source. - */ - Animation(AnimationFile animationFile) { - - this(animationFile.width, animationFile.height, animationFile.format, animationFile.numFrames, animationFile.frameRate, - animationFile.frameRate as int, - animationFile instanceof Streaming ? animationFile.streamingDecoder : null) - - Executors.newVirtualThreadPerTaskExecutor().execute(animationDataWorker) - } - - /** - * Constructor, use all of the given data for building an animation. - * - * @param width - * @param height - * @param format - * @param numFrames - * @param frameRate - * @param bufferSize - * @param animationDataWorker - */ - @PackageScope - Animation(int width, int height, ColourFormat format, int numFrames, float frameRate, - int bufferSize = 10, StreamingDecoder animationDataWorker) { - - if (!animationDataWorker) { - throw new UnsupportedOperationException('Streaming configuration used, but source doesn\'t support streaming') - } - - this.width = width - this.height = height - this.format = format - this.numFrames = numFrames - this.frameRate = frameRate - - this.bounds.set(0, 0, width, height) - - frames = new ArrayBlockingQueue<>(bufferSize) - this.bufferSize = bufferSize - this.animationDataWorker = animationDataWorker - this.animationDataWorker.on(StreamingFrameEvent) { event -> - frames << event.frame.flipVertical(width, height, format) - if (bufferReady.count && !frames.remainingCapacity()) { - bufferReady.countDown() - } - } - } - - @Override - void delete(GraphicsRenderer renderer) { - - animationDataWorker.cancel(true) - frames.drain() - renderer.deleteMesh(mesh) - textures.each { texture -> - if (texture) { - renderer.deleteTexture(texture) - } - } - } - - @Override - void init(GraphicsRenderer renderer) { - - lastFrame = -1 - mesh = renderer.createSpriteMesh( - surface: new Rectanglef(0, 0, width, height) - ) - shader = renderer.getShader(SpriteShader.NAME) - textures = [] - material = renderer.createMaterial( - transform: transform - ) - framesQueued = 0 - } - - @Override - void play() { - - // Wait until the frame buffer is filled before starting play - bufferReady.await() - animationTimeStart = currentTimeMs - Playable.super.play() - } - - @Override - void render(GraphicsRenderer renderer) { - - if (playing) { - var currentFrame = Math.floor((currentTimeMs - animationTimeStart) / 1000 * frameRate) as int - - // Try to load up to bufferSize frames ahead, maxing at 5 so we don't spent too much time in here - if (frames.size()) { - def framesAhead = Math.min(currentFrame + bufferSize, numFrames) - if (!textures[framesAhead]) { - def numFramesToRead = framesAhead - framesQueued - if (numFramesToRead) { - frames.drain(Math.max(numFramesToRead, 5)).each { frame -> - textures << renderer.createTexture(width, height, format, frame) - framesQueued++ - } - } - } - } - - // Draw the current frame if available - if (currentFrame < numFrames) { - def texture = textures[currentFrame] - if (texture) { - material.texture = texture - renderer.draw(mesh, shader, material) - } - else { - logger.debug('Frame {} not available, skipping', currentFrame) - } - } - - // Animation over - else { - stop() - } - - // Delete used frames as the animation progresses to free up memory - if (lastFrame != -1 && lastFrame != currentFrame) { - for (def i = lastFrame; i < currentFrame; i++) { - renderer.deleteTexture(textures[i]) - textures[i] = null - } - framesQueued -= (currentFrame - lastFrame) - } - lastFrame = currentFrame - } - } -} diff --git a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Image.groovy b/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Image.groovy deleted file mode 100644 index d240df77..00000000 --- a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Image.groovy +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2007, Emanuel Rabina (http://www.ultraq.net.nz/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package nz.net.ultraq.redhorizon.engine.media - -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsElement -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsRenderer -import nz.net.ultraq.redhorizon.engine.graphics.Material -import nz.net.ultraq.redhorizon.engine.graphics.Mesh -import nz.net.ultraq.redhorizon.engine.graphics.Shader -import nz.net.ultraq.redhorizon.engine.graphics.opengl.SpriteShader -import nz.net.ultraq.redhorizon.engine.resources.Resource -import nz.net.ultraq.redhorizon.engine.scenegraph.Node -import nz.net.ultraq.redhorizon.filetypes.ColourFormat -import nz.net.ultraq.redhorizon.filetypes.ImageFile -import nz.net.ultraq.redhorizon.filetypes.ImagesFile -import nz.net.ultraq.redhorizon.filetypes.Palette - -import org.joml.primitives.Rectanglef - -import java.nio.ByteBuffer - -/** - * A basic image / texture / 2D sprite. - * - * @author Emanuel Rabina - */ -class Image extends Node implements Resource, GraphicsElement { - - final int width - final int height - final ColourFormat format - private ByteBuffer imageData - - private Mesh mesh - private Shader shader - private Material material - - /** - * Constructor, creates an image out of the given image file data. - * - * @param imageFile - * Image source. - * @param palette - * If the image data requires a palette, then this is used to complete it. - */ - Image(ImageFile imageFile, Palette palette = null) { - - this(imageFile.width, imageFile.height, imageFile.format, imageFile.imageData, palette) - } - - /** - * Constructor, creates an image out of a specific frame in a multi-image - * file. - * - * @param imagesFile - * Image source. - * @param frame - * The specific frame in the source to use - * @param palette - * If the image data requires a palette, then this is used to complete it. - */ - Image(ImagesFile imagesFile, int frame, Palette palette = null) { - - this(imagesFile.width, imagesFile.height, imagesFile.format, imagesFile.imagesData[frame], palette) - } - - /** - * Constructor, creates an image from the given data. - * - * @param width - * @param height - * @param format - * @param imageData - * @param palette - */ - Image(int width, int height, ColourFormat format, ByteBuffer imageData, Palette palette = null) { - - this.width = width - this.height = height - this.format = palette?.format ?: format - this.imageData = (palette ? imageData.applyPalette(palette) : imageData).flipVertical(width, height, this.format) - - this.bounds.set(0, 0, width, height) - } - - @Override - void delete(GraphicsRenderer renderer) { - - renderer.deleteMaterial(material) - } - - @Override - void init(GraphicsRenderer renderer) { - - mesh = renderer.createSpriteMesh( - surface: new Rectanglef(0, 0, width, height) - ) - shader = renderer.getShader(SpriteShader.NAME) - material = renderer.createMaterial( - texture: renderer.createTexture(width, height, format, imageData), - transform: transform - ) - imageData = null - } - - @Override - void render(GraphicsRenderer renderer) { - - renderer.draw(mesh, shader, material) - } -} diff --git a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/ImageStrip.groovy b/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/ImageStrip.groovy deleted file mode 100644 index 0b5389f7..00000000 --- a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/ImageStrip.groovy +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2021, Emanuel Rabina (http://www.ultraq.net.nz/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package nz.net.ultraq.redhorizon.engine.media - -import nz.net.ultraq.redhorizon.engine.scenegraph.Node -import nz.net.ultraq.redhorizon.engine.scenegraph.SceneVisitor -import nz.net.ultraq.redhorizon.filetypes.ImagesFile -import nz.net.ultraq.redhorizon.filetypes.Palette - -/** - * A series of images laid out in a long horizontal strip. - * - * @author Emanuel Rabina - */ -class ImageStrip extends Node { - - final List images = [] - - /** - * Constructor, build a strip of images from a file containing multiple - * images. - * - * @param imagesFile - * @param palette - */ - ImageStrip(ImagesFile imagesFile, Palette palette) { - - this.bounds.set(0, 0, imagesFile.width * imagesFile.numImages, imagesFile.height) - translate(0, -imagesFile.height / 2 as float) - - imagesFile.numImages.times { i -> - images << new Image(imagesFile, i, palette) - .translate(imagesFile.width * i, -imagesFile.height / 2) - } - } - - @Override - void accept(SceneVisitor visitor) { - - visitor.visit(this) - images*.accept(visitor) - } -} diff --git a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/SoundTrack.groovy b/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/SoundTrack.groovy deleted file mode 100644 index dadb6cc9..00000000 --- a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/SoundTrack.groovy +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 2007, Emanuel Rabina (http://www.ultraq.net.nz/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package nz.net.ultraq.redhorizon.engine.media - -import nz.net.ultraq.redhorizon.engine.audio.AudioElement -import nz.net.ultraq.redhorizon.engine.audio.AudioRenderer -import nz.net.ultraq.redhorizon.engine.scenegraph.Node -import nz.net.ultraq.redhorizon.engine.time.Temporal -import nz.net.ultraq.redhorizon.filetypes.SoundFile -import nz.net.ultraq.redhorizon.filetypes.Streaming -import nz.net.ultraq.redhorizon.filetypes.StreamingDecoder -import nz.net.ultraq.redhorizon.filetypes.StreamingSampleEvent - -import org.slf4j.Logger -import org.slf4j.LoggerFactory - -import groovy.transform.PackageScope -import java.nio.ByteBuffer -import java.util.concurrent.ArrayBlockingQueue -import java.util.concurrent.BlockingQueue -import java.util.concurrent.CountDownLatch -import java.util.concurrent.Executors - -/** - * A long piece of audio that is streamed from its source. - * - * @author Emanuel Rabina - */ -@SuppressWarnings('GrFinalVariableAccess') -class SoundTrack extends Node implements AudioElement, Playable, Temporal { - - private static final Logger logger = LoggerFactory.getLogger(SoundTrack) - - // Sound information - final int bits - final int channels - final int frequency - - private final StreamingDecoder soundDataWorker - private final BlockingQueue samples - private final int bufferSize - private final CountDownLatch bufferReady = new CountDownLatch(1) - - // Renderer information - private int sourceId - private List bufferIds - private boolean paused - - /** - * Constructor, use the data in {@code soundFile} for playing the sound track. - * - * @param soundFile - */ - SoundTrack(SoundFile soundFile) { - - this(soundFile.bits, soundFile.channels, soundFile.frequency, - soundFile instanceof Streaming ? soundFile.streamingDecoder : null) - - Executors.newVirtualThreadPerTaskExecutor().execute(soundDataWorker) - } - - /** - * Constructor, use all of the given data for building a sound track. - * - * @param bits - * @param channels - * @param frequency - * @param bufferSize - * @param soundDataWorker - */ - @PackageScope - SoundTrack(int bits, int channels, int frequency, int bufferSize = 10, StreamingDecoder soundDataWorker) { - - if (!soundDataWorker) { - throw new UnsupportedOperationException('Streaming configuration used, but source doesn\'t support streaming') - } - - this.bits = bits - this.channels = channels - this.frequency = frequency - - samples = new ArrayBlockingQueue<>(bufferSize) - this.bufferSize = bufferSize - this.soundDataWorker = soundDataWorker - this.soundDataWorker.on(StreamingSampleEvent) { event -> - samples << event.sample - if (bufferReady.count && !samples.remainingCapacity()) { - bufferReady.countDown() - } - } - } - - @Override - void delete(AudioRenderer renderer) { - - soundDataWorker.cancel(true) - samples.drain() - renderer.deleteSource(sourceId) - renderer.deleteBuffers(bufferIds as int[]) - } - - @Override - void init(AudioRenderer renderer) { - - sourceId = renderer.createSource() - bufferIds = [] - } - - @Override - void play() { - - // Wait until the sample buffer is filled before starting play - bufferReady.await() - Playable.super.play() - } - - @Override - void render(AudioRenderer renderer) { - - if (playing) { - - // Buffers to read and queue, maxing at 5 so we don't spend too much time in here - if (samples.size()) { - logger.trace('Samples available: {}', samples.size()) - def newBufferIds = samples.drain(5).collect { buffer -> - def newBufferId = renderer.createBuffer(bits, channels, frequency, buffer) - bufferIds << newBufferId - return newBufferId - } - renderer.queueBuffers(sourceId, newBufferIds as int[]) - logger.trace('Increasing buffersQueued by {}', newBufferIds.size()) - } - - // Pause/play with game time - if (paused) { - if (!renderer.sourcePaused(sourceId)) { - renderer.pauseSource(sourceId) - } - } - else { - // Buffers exhausted - if (renderer.sourceStopped(sourceId)) { - stop() - } - // Start playing the source - else if (!renderer.sourcePlaying(sourceId)) { - renderer.playSource(sourceId) - } - } - } - else { - // Sound stopped, but source still playing - if (renderer.sourcePlaying(sourceId)) { - renderer.stopSource(sourceId) - } - } - - // Delete played buffers as the track progresses to free up memory - def buffersProcessed = renderer.buffersProcessed(sourceId) - logger.trace('Buffers processed: {}', buffersProcessed) - if (buffersProcessed) { - def processedBufferIds = [] - buffersProcessed.times { - processedBufferIds << bufferIds.removeAt(0) - } - renderer.unqueueBuffers(sourceId, processedBufferIds as int[]) - renderer.deleteBuffers(processedBufferIds as int[]) - logger.trace('Decreasing buffersQueued by {}', buffersProcessed) - } - } - - @Override - void tick(long updatedTimeMs) { - - paused = currentTimeMs == updatedTimeMs - currentTimeMs = updatedTimeMs - } -} diff --git a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Video.groovy b/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Video.groovy deleted file mode 100644 index 276b910d..00000000 --- a/redhorizon-engine/source/nz/net/ultraq/redhorizon/engine/media/Video.groovy +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2019, Emanuel Rabina (http://www.ultraq.net.nz/) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package nz.net.ultraq.redhorizon.engine.media - -import nz.net.ultraq.redhorizon.engine.audio.AudioElement -import nz.net.ultraq.redhorizon.engine.audio.AudioRenderer -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsElement -import nz.net.ultraq.redhorizon.engine.graphics.GraphicsRenderer -import nz.net.ultraq.redhorizon.engine.scenegraph.Node -import nz.net.ultraq.redhorizon.engine.scenegraph.SceneVisitor -import nz.net.ultraq.redhorizon.filetypes.Streaming -import nz.net.ultraq.redhorizon.filetypes.VideoFile - -import java.util.concurrent.Executors - -/** - * The combination of an animation and sound track, a video is a stream from a - * video file, rendering out to both the audio and graphics engines during - * playback. - * - * @author Emanuel Rabina - */ -class Video extends Node