www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,53 @@
package org.jcodec.codecs.y4m;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
import org.jcodec.common.AudioCodecMeta;
import org.jcodec.common.Codec;
import org.jcodec.common.Muxer;
import org.jcodec.common.MuxerTrack;
import org.jcodec.common.VideoCodecMeta;
import org.jcodec.common.model.Packet;
import org.jcodec.common.model.Size;
public class Y4MMuxer implements Muxer, MuxerTrack {
private WritableByteChannel ch;
private boolean headerWritten;
private VideoCodecMeta meta;
public static final byte[] frameTag = "FRAME\n".getBytes();
public Y4MMuxer(WritableByteChannel ch) {
this.ch = ch;
}
protected void writeHeader() throws IOException {
Size size = this.meta.getSize();
byte[] bytes = String.format("YUV4MPEG2 W%d H%d F25:1 Ip A0:0 C420jpeg XYSCSS=420JPEG\n", size.getWidth(), size.getHeight())
.getBytes();
this.ch.write(ByteBuffer.wrap(bytes));
}
public void addFrame(Packet outPacket) throws IOException {
if (!this.headerWritten) {
writeHeader();
this.headerWritten = true;
}
this.ch.write(ByteBuffer.wrap(frameTag));
this.ch.write(outPacket.data.duplicate());
}
public MuxerTrack addVideoTrack(Codec codec, VideoCodecMeta meta) {
this.meta = meta;
return this;
}
public MuxerTrack addAudioTrack(Codec codec, AudioCodecMeta meta) {
throw new RuntimeException("Y4M doesn't support audio");
}
public void finish() throws IOException {}
}