imgs = d.produce();
- ColorCyclingMemoryImageSource mis = imgs.getFirst();
+ ColorCyclingMemoryImageSource mis = imgs.get(0);
out.data = AmigaBitmapImageFactory.toBufferedImage(
AmigaBitmapImageFactory.toBitmapImage(mis));
success = true;
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMMovieResources.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMMovieResources.java
index 2ddb483..0be64a0 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMMovieResources.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMMovieResources.java
@@ -169,7 +169,7 @@ public boolean isPlayWrapupFrames() {
* double buffering.
*/
public int getInterleave() {
- return frames.size() > 0 && frames.getLast().getInterleave() == 1 ? 1 : 2;
+ return frames.size() > 0 && frames.get(frames.size() - 1).getInterleave() == 1 ? 1 : 2;
}
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMOutputStream.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMOutputStream.java
index ab69a92..7bd50f6 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMOutputStream.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/ANIMOutputStream.java
@@ -7,7 +7,7 @@
import org.monte.media.amigabitmap.AmigaBitmapImage;
import org.monte.media.amigabitmap.AmigaDisplayInfo;
import org.monte.media.iff.IFFOutputStream;
-import org.monte.media.io.SeekableByteArrayOutputStream;
+import org.monte.media.io.ByteArrayImageOutputStream;
import javax.imageio.stream.FileImageOutputStream;
import javax.imageio.stream.ImageOutputStream;
@@ -211,7 +211,7 @@ private void ensureOpen() throws IOException {
}
/**
- * Sets the state of the QuickTimeWriter to started.
+ * Sets the state of the MP4Writer to started.
*
* If the state is changed by this method, the prolog is written.
*/
@@ -523,7 +523,7 @@ private void writeDLTA(IFFOutputStream out, AmigaBitmapImage img, AmigaBitmapIma
byte[] data = img.getBitmap();
byte[] prevData = prev.getBitmap();
- SeekableByteArrayOutputStream buf = new SeekableByteArrayOutputStream();
+ ByteArrayImageOutputStream buf = new ByteArrayImageOutputStream();
// Buffers for a theoretical maximum of 16 planes.
byte[][] planes = new byte[16][0];
@@ -592,7 +592,7 @@ private void writeDLTA(IFFOutputStream out, AmigaBitmapImage img, AmigaBitmapIma
* @param step
* @throws IOException
*/
- private void writeByteVertical(SeekableByteArrayOutputStream out, byte[] data, byte[] prev, int offset, int length, int step) throws IOException {
+ private void writeByteVertical(ImageOutputStream out, byte[] data, byte[] prev, int offset, int length, int step) throws IOException {
int opCount = 0;
// Reserve space for opCount in the stream
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/AmigaVideoFormatKeys.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/AmigaVideoFormatKeys.java
index 3748ed8..d5adbbd 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/AmigaVideoFormatKeys.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/anim/AmigaVideoFormatKeys.java
@@ -131,8 +131,8 @@ private interface InfGetter {
private static void reduceListRational(Rational value, InfGetter g, ArrayList infs) {
ArrayList bestInfs = new ArrayList<>();
- bestInfs.add(infs.getFirst());
- float bestCost = g.get(infs.getFirst()).subtract(value).floatValue();
+ bestInfs.add(infs.get(0));
+ float bestCost = g.get(infs.get(0)).subtract(value).floatValue();
bestCost *= bestCost;
for (Iterator i = infs.iterator(); i.hasNext(); ) {
AmigaDisplayInfo inf = i.next();
@@ -156,8 +156,8 @@ private static void reduceListRational(Rational value, InfGetter g, Ar
private static void reduceListInteger(int value, InfGetter g, ArrayList infs) {
ArrayList bestInfs = new ArrayList<>();
- bestInfs.add(infs.getFirst());
- float bestCost = g.get(infs.getFirst()) - value;
+ bestInfs.add(infs.get(0));
+ float bestCost = g.get(infs.get(0)) - value;
bestCost *= bestCost;
for (Iterator i = infs.iterator(); i.hasNext(); ) {
AmigaDisplayInfo inf = i.next();
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000InputStream.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000InputStream.java
index e7bfe01..8ad1fd1 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000InputStream.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000InputStream.java
@@ -4,7 +4,7 @@
*/
package org.monte.media.iff;
-import org.monte.media.io.ByteArray;
+import org.monte.media.util.ByteArrays;
import java.io.EOFException;
import java.io.FilterInputStream;
@@ -57,7 +57,7 @@ public int readUBYTE()
public short readWORD()
throws IOException {
readFully(byteBuffer, 0, 2);
- return ByteArray.getShortBE(byteBuffer, 0);
+ return ByteArrays.getShortBE(byteBuffer, 0);
}
/**
@@ -76,7 +76,7 @@ public int readUWORD()
public int readLONG()
throws IOException {
readFully(byteBuffer, 0, 4);
- return ByteArray.getIntBE(byteBuffer, 0);
+ return ByteArrays.getIntBE(byteBuffer, 0);
}
/**
@@ -86,7 +86,7 @@ public int readLONG()
public long readINT64()
throws IOException {
readFully(byteBuffer, 0, 8);
- return ByteArray.getLongBE(byteBuffer, 0);
+ return ByteArrays.getLongBE(byteBuffer, 0);
}
/**
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000OutputStream.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000OutputStream.java
index 428968a..01e3861 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000OutputStream.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/iff/MC68000OutputStream.java
@@ -4,7 +4,7 @@
*/
package org.monte.media.iff;
-import org.monte.media.io.ByteArray;
+import org.monte.media.util.ByteArrays;
import java.io.FilterOutputStream;
import java.io.IOException;
@@ -33,25 +33,25 @@ public MC68000OutputStream(OutputStream out) {
}
public void writeLONG(int v) throws IOException {
- ByteArray.setIntBE(byteBuffer, 0, v);
+ ByteArrays.setIntBE(byteBuffer, 0, v);
out.write(byteBuffer, 0, 4);
incCount(4);
}
public void writeULONG(long v) throws IOException {
- ByteArray.setIntBE(byteBuffer, 0, (int) v);
+ ByteArrays.setIntBE(byteBuffer, 0, (int) v);
out.write(byteBuffer, 0, 4);
incCount(4);
}
public void writeWORD(int v) throws IOException {
- ByteArray.setShortBE(byteBuffer, 0, (short) v);
+ ByteArrays.setShortBE(byteBuffer, 0, (short) v);
out.write(byteBuffer, 0, 2);
incCount(2);
}
public void writeUWORD(int v) throws IOException {
- ByteArray.setShortBE(byteBuffer, 0, (short) v);
+ ByteArrays.setShortBE(byteBuffer, 0, (short) v);
out.write(byteBuffer, 0, 2);
incCount(2);
}
@@ -178,7 +178,6 @@ public void writeType(String s) throws IOException {
* If the counter overflows, it will be wrapped to Integer.MAX_VALUE.
*
* @return the value of the written
field.
- * @see java.io.DataOutputStream#written
*/
public final long size() {
return written;
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/pbm/PBMPlayer.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/pbm/PBMPlayer.java
index a51e954..3eb1620 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/pbm/PBMPlayer.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/pbm/PBMPlayer.java
@@ -111,7 +111,7 @@ protected void doRealizing() {
if (track.size() == 0) {
setTargetState(CLOSED);
} else {
- memoryImage = track.getFirst();
+ memoryImage = track.get(0);
memoryImage.setAnimated(true);
if (memoryImage.isColorCyclingAvailable()) {
propertyChangeSupport.firePropertyChange("colorCyclingAvailable", false, true);
diff --git a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/seq/SEQMovieTrack.java b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/seq/SEQMovieTrack.java
index 96513f7..1e126c1 100755
--- a/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/seq/SEQMovieTrack.java
+++ b/org.monte.media.amigaatari/src/main/java/org.monte.media.amigaatari/org/monte/media/seq/SEQMovieTrack.java
@@ -170,7 +170,7 @@ public boolean isPlayWrapupFrames() {
* double buffering.
*/
public int getInterleave() {
- return frames.size() > 0 && frames.getLast().getInterleave() == 1 ? 1 : 2;
+ return frames.size() > 0 && frames.get(frames.size() - 1).getInterleave() == 1 ? 1 : 2;
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.CodecSpi b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.CodecSpi
index 9bd7e52..49ef2e0 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.CodecSpi
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.CodecSpi
@@ -1,2 +1,2 @@
-org.monte.media.jcodec.codec.PictureCodecSpi
-org.monte.media.jcodec.codec.H264CodecSpi
+org.monte.media.jcodec.codec.JCodecPictureCodecSpi
+org.monte.media.jcodec.codec.JCodecH264CodecSpi
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.MovieWriterSpi b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.MovieWriterSpi
index 92cc22d..57fe9bd 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.MovieWriterSpi
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/META-INF/services/org.monte.media.av.MovieWriterSpi
@@ -1 +1 @@
-org.monte.media.jcodec.mp4.MP4WriterSpi
\ No newline at end of file
+org.monte.media.jcodec.mp4.JCodecMP4WriterSpi
\ No newline at end of file
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/module-info.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/module-info.java
index 80bada1..9c87f24 100755
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/module-info.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/module-info.java
@@ -2,7 +2,9 @@
* Copyright © 2017 Werner Randelshofer, Switzerland. MIT License.
*/
-import org.monte.media.jcodec.mp4.MP4WriterSpi;
+import org.monte.media.jcodec.codec.JCodecH264CodecSpi;
+import org.monte.media.jcodec.codec.JCodecPictureCodecSpi;
+import org.monte.media.jcodec.mp4.JCodecMP4WriterSpi;
/**
* Provides a movie writer that uses the JCodec library.
@@ -16,6 +18,6 @@
requires org.monte.media;
- provides org.monte.media.av.MovieWriterSpi with MP4WriterSpi;
- provides org.monte.media.av.CodecSpi with org.monte.media.jcodec.codec.PictureCodecSpi, org.monte.media.jcodec.codec.H264CodecSpi;
+ provides org.monte.media.av.MovieWriterSpi with JCodecMP4WriterSpi;
+ provides org.monte.media.av.CodecSpi with JCodecPictureCodecSpi, JCodecH264CodecSpi;
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264Codec.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264Codec.java
similarity index 74%
rename from org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264Codec.java
rename to org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264Codec.java
index ca0a7ca..48354f6 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264Codec.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264Codec.java
@@ -1,5 +1,5 @@
/*
- * @(#)H264Codec.java
+ * @(#)JCodecH264Codec.java
* Copyright © 2024 Werner Randelshofer, Switzerland. MIT License.
*/
@@ -8,6 +8,8 @@
import org.jcodec.api.transcode.PixelStore;
import org.jcodec.api.transcode.VideoFrameWithPacket;
import org.jcodec.codecs.h264.H264Encoder;
+import org.jcodec.codecs.h264.H264Utils;
+import org.jcodec.codecs.h264.io.model.SeqParameterSet;
import org.jcodec.common.VideoEncoder;
import org.jcodec.common.io.NIOUtils;
import org.jcodec.common.model.ColorSpace;
@@ -18,9 +20,17 @@
import org.monte.media.av.FormatKeys;
import org.monte.media.av.codec.video.AbstractVideoCodec;
import org.monte.media.jcodec.impl.AWTUtil;
+import org.monte.media.qtff.AvcDecoderConfigurationRecord;
+import org.monte.media.util.ArrayUtil;
+import org.monte.media.util.ByteArray;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import static org.monte.media.av.BufferFlag.DISCARD;
import static org.monte.media.av.BufferFlag.KEYFRAME;
@@ -38,16 +48,16 @@
import static org.monte.media.av.codec.video.VideoFormatKeys.HeightKey;
import static org.monte.media.av.codec.video.VideoFormatKeys.MotionSearchRangeKey;
import static org.monte.media.av.codec.video.VideoFormatKeys.WidthKey;
-import static org.monte.media.jcodec.codec.PictureCodec.ENCODING_PICTURE;
+import static org.monte.media.jcodec.codec.JCodecPictureCodec.ENCODING_PICTURE;
/**
* Codec for {@link Picture} to {@code H264} byte array.
*/
-public class H264Codec extends AbstractVideoCodec {
+public class JCodecH264Codec extends AbstractVideoCodec {
private VideoEncoder videoEncoder = null;
private ByteBuffer byteBuffer;
- public H264Codec() {
+ public JCodecH264Codec() {
super(new Format[]{
new Format(MediaTypeKey, FormatKeys.MediaType.VIDEO,
EncodingKey, ENCODING_BUFFERED_IMAGE,
@@ -136,13 +146,29 @@ public int encode(Buffer in, Buffer out) {
byteBuffer = ByteBuffer.allocate(bufferSize);
}
byteBuffer.clear();
- VideoEncoder.EncodedFrame encodeFrame = enc.encodeFrame(picture, byteBuffer);
- outputVideoPacket = Packet.createPacketWithData(videoFrame.getPacket(), NIOUtils.clone(encodeFrame.getData()));
- outputVideoPacket.setFrameType(encodeFrame.isKeyFrame() ? Packet.FrameType.KEY : Packet.FrameType.INTER);
+ VideoEncoder.EncodedFrame encodedFrame = enc.encodeFrame(picture, byteBuffer);
+ outputVideoPacket = Packet.createPacketWithData(videoFrame.getPacket(), NIOUtils.clone(encodedFrame.getData()));
+ outputVideoPacket.setFrameType(encodedFrame.isKeyFrame() ? Packet.FrameType.KEY : Packet.FrameType.INTER);
+
+ // compute header
+ out.header = null;
+ if (encodedFrame.isKeyFrame()) {
+ List spsList = new ArrayList<>();
+ List ppsList = new ArrayList<>();
+ H264Utils.wipePSinplace(outputVideoPacket.data, spsList, ppsList);
+ if (!spsList.isEmpty()) {
+ SeqParameterSet p = H264Utils.readSPS(spsList.get(0));
+ Function byteBufferFunction = b -> new ByteArray(ArrayUtil.copyOf(b.array(), b.arrayOffset(), b.remaining()));
+ out.header = new AvcDecoderConfigurationRecord(p.profileIdc, 0, p.levelIdc, 4,
+ spsList.stream().map(byteBufferFunction).collect(Collectors.toCollection(LinkedHashSet::new)),
+ ppsList.stream().map(byteBufferFunction).collect(Collectors.toCollection(LinkedHashSet::new)));
+ }
+ }
- out.setFlag(KEYFRAME, encodeFrame.isKeyFrame());
+ out.setFlag(KEYFRAME, encodedFrame.isKeyFrame());
ByteBuffer packetBuf = outputVideoPacket.data;
- if (out.data instanceof byte[] byteArray && byteArray.length >= packetBuf.remaining()) {
+ if (out.data instanceof byte[] && ((byte[]) out.data).length >= packetBuf.remaining()) {
+ byte[] byteArray = (byte[]) out.data;
System.arraycopy(packetBuf.array(), packetBuf.position(), byteArray, 0, packetBuf.remaining());
out.offset = 0;
out.length = packetBuf.remaining();
@@ -166,16 +192,12 @@ private VideoEncoder getEncoder(Format outputFormat) {
}
private Picture getPicture(Buffer buf) {
- switch (buf.data) {
- case BufferedImage img -> {
-
- return AWTUtil.fromBufferedImage(img, ColorSpace.YUV420J);
- }
- case Picture picture -> {
- return picture;
- }
- case null, default -> {
- }
+ if (buf.data instanceof BufferedImage) {
+ BufferedImage img = (BufferedImage) buf.data;
+ return AWTUtil.fromBufferedImage(img, ColorSpace.YUV420J);
+ } else if (buf.data instanceof Picture) {
+ Picture picture = (Picture) buf.data;
+ return picture;
}
return null;
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264CodecSpi.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264CodecSpi.java
similarity index 66%
rename from org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264CodecSpi.java
rename to org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264CodecSpi.java
index 9fe15af..fbe09e7 100755
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/H264CodecSpi.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecH264CodecSpi.java
@@ -12,11 +12,11 @@
*
* @author Werner Randelshofer
*/
-public class H264CodecSpi implements CodecSpi {
+public class JCodecH264CodecSpi implements CodecSpi {
@Override
- public H264Codec create() {
- return new H264Codec();
+ public JCodecH264Codec create() {
+ return new JCodecH264Codec();
}
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodec.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodec.java
similarity index 88%
rename from org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodec.java
rename to org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodec.java
index e0e91f4..e3d1255 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodec.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodec.java
@@ -1,5 +1,5 @@
/*
- * @(#)PictureCodec.java
+ * @(#)JCodecPictureCodec.java
* Copyright © 2024 Werner Randelshofer, Switzerland. MIT License.
*/
@@ -24,10 +24,10 @@
/**
* Codec for {@link BufferedImage} to/from {@link Picture}.
*/
-public class PictureCodec extends AbstractCodec {
+public class JCodecPictureCodec extends AbstractCodec {
public static final String ENCODING_PICTURE = "picture";
- public PictureCodec() {
+ public JCodecPictureCodec() {
super(new Format[]{
new Format(MediaTypeKey, FormatKeys.MediaType.VIDEO,
EncodingKey, ENCODING_BUFFERED_IMAGE,
@@ -48,7 +48,8 @@ public int process(Buffer in, Buffer out) {
if (in.isFlag(BufferFlag.DISCARD)) {
return CODEC_OK;
}
- if (in.data instanceof BufferedImage img) {
+ if (in.data instanceof BufferedImage) {
+ BufferedImage img = (BufferedImage) in.data;
out.data = AWTUtil.fromBufferedImage(img, ColorSpace.YUV420J);
return CODEC_OK;
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodecSpi.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodecSpi.java
similarity index 65%
rename from org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodecSpi.java
rename to org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodecSpi.java
index 2d34ee7..cc5ca9f 100755
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/PictureCodecSpi.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/codec/JCodecPictureCodecSpi.java
@@ -12,11 +12,11 @@
*
* @author Werner Randelshofer
*/
-public class PictureCodecSpi implements CodecSpi {
+public class JCodecPictureCodecSpi implements CodecSpi {
@Override
- public PictureCodec create() {
- return new PictureCodec();
+ public JCodecPictureCodec create() {
+ return new JCodecPictureCodec();
}
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/impl/SequenceEncoderEx.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/impl/SequenceEncoderEx.java
index 14e959e..7596163 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/impl/SequenceEncoderEx.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/impl/SequenceEncoderEx.java
@@ -92,7 +92,8 @@ public void setFps(Rational fps) {
}
public void setMotionSearchRange(int newValue) {
- if (sink.getVideoEncoder() instanceof H264Encoder e) {
+ if (sink.getVideoEncoder() instanceof H264Encoder) {
+ H264Encoder e = (H264Encoder) sink.getVideoEncoder();
e.setMotionSearchRange(newValue);
}
}
diff --git a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/MP4Writer.java b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/JCodecMP4Writer.java
similarity index 97%
rename from org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/MP4Writer.java
rename to org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/JCodecMP4Writer.java
index 52e725d..cb6f996 100644
--- a/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/MP4Writer.java
+++ b/org.monte.media.jcodec/src/main/java/org.monte.media.jcodec/org/monte/media/jcodec/mp4/JCodecMP4Writer.java
@@ -1,5 +1,5 @@
/*
- * @(#)MP4Writer.java
+ * @(#)JCodecMP4Writer.java
* Copyright © 2024 Werner Randelshofer, Switzerland. MIT License.
*/
@@ -44,7 +44,6 @@
import static org.jcodec.common.Codec.H264;
import static org.monte.media.av.BufferFlag.DISCARD;
-import static org.monte.media.av.BufferFlag.KEYFRAME;
import static org.monte.media.av.FormatKeys.EncodingKey;
import static org.monte.media.av.FormatKeys.FrameRateKey;
import static org.monte.media.av.FormatKeys.KeyFrameIntervalKey;
@@ -64,9 +63,9 @@
import static org.monte.media.av.codec.video.VideoFormatKeys.MotionSearchRangeKey;
import static org.monte.media.av.codec.video.VideoFormatKeys.QualityKey;
import static org.monte.media.av.codec.video.VideoFormatKeys.WidthKey;
-import static org.monte.media.jcodec.codec.PictureCodec.ENCODING_PICTURE;
+import static org.monte.media.jcodec.codec.JCodecPictureCodec.ENCODING_PICTURE;
-public class MP4Writer implements MovieWriter {
+public class JCodecMP4Writer implements MovieWriter {
public final static Format MP4 = new Format(MediaTypeKey, FormatKeys.MediaType.FILE, MimeTypeKey, MIME_MP4);
private final List