mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 15:40:53 +00:00
More documentation.
This commit is contained in:
@@ -26,48 +26,121 @@ import java.io.IOException;
|
||||
*/
|
||||
public class AUDIODATA extends DATA {
|
||||
|
||||
/**
|
||||
* Sound format - uncompressed, native endian
|
||||
*/
|
||||
public static final int SOUNDFORMAT_UNCOMPRESSED_NE = 0;
|
||||
|
||||
/**
|
||||
* Sound format - ADPCM
|
||||
*/
|
||||
public static final int SOUNDFORMAT_ADPCM = 1;
|
||||
|
||||
/**
|
||||
* Sound format - MP3
|
||||
*/
|
||||
public static final int SOUNDFORMAT_MP3 = 2;
|
||||
|
||||
/**
|
||||
* Sound format - uncompressed, little endian
|
||||
*/
|
||||
public static final int SOUNDFORMAT_UNCOMPRESSED_LE = 3;
|
||||
|
||||
/**
|
||||
* Sound format - Nellymoser 16 kHz mono
|
||||
*/
|
||||
public static final int SOUNDFORMAT_NELLYMOSER_16 = 4;
|
||||
|
||||
/**
|
||||
* Sound format - Nellymoser 8 kHz mono
|
||||
*/
|
||||
public static final int SOUNDFORMAT_NELLYMOSER_8 = 5;
|
||||
|
||||
/**
|
||||
* Sound format - Nellymoser
|
||||
*/
|
||||
public static final int SOUNDFORMAT_NELLYMOSER = 6;
|
||||
|
||||
public static final int SOUNDFORMAT_SPEEX = 11;
|
||||
/**
|
||||
* Sound format - Speex
|
||||
*/
|
||||
public static final int SOUNDFORMAT_SPEEX = 11;
|
||||
|
||||
/**
|
||||
* Sound rate - 5.5 kHz
|
||||
*/
|
||||
public static final int SOUNDRATE_5K5 = 0;
|
||||
|
||||
/**
|
||||
* Sound rate - 11 kHz
|
||||
*/
|
||||
public static final int SOUNDRATE_11K = 1;
|
||||
|
||||
/**
|
||||
* Sound rate - 22 kHz
|
||||
*/
|
||||
public static final int SOUNDRATE_22K = 2;
|
||||
|
||||
/**
|
||||
* Sound rate - 44 kHz
|
||||
*/
|
||||
public static final int SOUNDRATE_44K = 3;
|
||||
|
||||
/**
|
||||
* Sound size - 8 bit
|
||||
*/
|
||||
public static final int SOUNDSIZE_8BIT = 0;
|
||||
|
||||
/**
|
||||
* Sound size - 16 bit
|
||||
*/
|
||||
public static final int SOUNDSIZE_16BIT = 1;
|
||||
|
||||
/**
|
||||
* Sound type - mono
|
||||
*/
|
||||
public static final int SOUNDTYPE_MONO = 0;
|
||||
|
||||
/**
|
||||
* Sound type - stereo
|
||||
*/
|
||||
public static final int SOUNDTYPE_STEREO = 1;
|
||||
|
||||
/**
|
||||
* Sound format
|
||||
*/
|
||||
public int soundFormat;
|
||||
|
||||
/**
|
||||
* Sound rate
|
||||
*/
|
||||
public int soundRate;
|
||||
|
||||
/**
|
||||
* Sound size.
|
||||
* True = 16 bit, false = 8 bit
|
||||
*/
|
||||
public boolean soundSize;
|
||||
|
||||
/**
|
||||
* Sound type.
|
||||
* True = stereo, false = mono
|
||||
*/
|
||||
public boolean soundType;
|
||||
|
||||
/**
|
||||
* Sound data
|
||||
*/
|
||||
public byte[] soundData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param soundFormat Sound format
|
||||
* @param soundRate Sound rate
|
||||
* @param soundSize Sound size
|
||||
* @param soundType Sound type
|
||||
* @param soundData Sound data
|
||||
*/
|
||||
public AUDIODATA(int soundFormat, int soundRate, boolean soundSize, boolean soundType, byte[] soundData) {
|
||||
this.soundFormat = soundFormat;
|
||||
this.soundRate = soundRate;
|
||||
|
||||
@@ -23,5 +23,9 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public abstract class DATA {
|
||||
|
||||
/**
|
||||
* Gets the data as byte array.
|
||||
* @return Data as byte array
|
||||
*/
|
||||
public abstract byte[] getBytes();
|
||||
}
|
||||
|
||||
@@ -41,10 +41,20 @@ public class FLVInputStream {
|
||||
|
||||
private long pos = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param is Input stream
|
||||
*/
|
||||
public FLVInputStream(InputStream is) {
|
||||
this.is = new DataInputStream(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads header.
|
||||
* @param audioPresent Audio present
|
||||
* @param videoPresent Video present
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void readHeader(Reference<Boolean> audioPresent, Reference<Boolean> videoPresent) throws IOException {
|
||||
byte[] signature = new byte[3];
|
||||
is.readFully(signature);
|
||||
@@ -67,6 +77,11 @@ public class FLVInputStream {
|
||||
readUI32(); //should be 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads tags
|
||||
* @return List of tags
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public List<FLVTAG> readTags() throws IOException {
|
||||
List<FLVTAG> ret = new ArrayList<>();
|
||||
while (available() > 0) {
|
||||
@@ -148,21 +163,42 @@ public class FLVInputStream {
|
||||
bitPos = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads one byte from the stream
|
||||
* @return byte
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int read() throws IOException {
|
||||
alignByte();
|
||||
pos++;
|
||||
return is.read();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads UI8 (Unsigned 8bit integer) value from the stream
|
||||
* @return UI8 value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int readUI8() throws IOException {
|
||||
return read();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads one UI24 (Unsigned 24bit integer) value from the stream
|
||||
* @return UI24 value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int readUI24() throws IOException {
|
||||
int ret = (readEx() << 16) + (readEx() << 8) + (readEx());
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads bytes from the stream
|
||||
* @param len Number of bytes to read
|
||||
* @return Bytes
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public byte[] readBytes(int len) throws IOException {
|
||||
byte[] data = new byte[len];
|
||||
is.readFully(data);
|
||||
@@ -170,10 +206,20 @@ public class FLVInputStream {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of available bytes in the stream
|
||||
* @return Number of available bytes
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int available() throws IOException {
|
||||
return is.available();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads one tag from the stream
|
||||
* @return Tag
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public FLVTAG readTag() throws IOException {
|
||||
int tagType = readUI8();
|
||||
int dataLen = readUI24();
|
||||
@@ -201,12 +247,17 @@ public class FLVInputStream {
|
||||
* Reads one UI16 (Unsigned 16bit integer) value from the stream
|
||||
*
|
||||
* @return UI16 value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int readUI16() throws IOException {
|
||||
return (readEx() << 8) + readEx();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATA from the stream
|
||||
* @return SCRIPTDATA
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public SCRIPTDATA readSCRIPTDATA() throws IOException {
|
||||
SCRIPTDATAVALUE name = readSCRIPTDATAVALUE();
|
||||
SCRIPTDATAVALUE value = readSCRIPTDATAVALUE();
|
||||
@@ -218,7 +269,7 @@ public class FLVInputStream {
|
||||
* stream
|
||||
*
|
||||
* @return DOUBLE value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public double readDOUBLE() throws IOException {
|
||||
long el = readLong();
|
||||
@@ -238,6 +289,11 @@ public class FLVInputStream {
|
||||
+ ((readBuffer[7] & 0xff)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads AUDIODATA from the stream
|
||||
* @return AUDIODATA
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public AUDIODATA readAUDIODATA() throws IOException {
|
||||
int soundFormat = (int) readUB(4);
|
||||
int soundRate = (int) readUB(2);
|
||||
@@ -248,6 +304,11 @@ public class FLVInputStream {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATAOBJECT from the stream
|
||||
* @return SCRIPTDATAOBJECT
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public SCRIPTDATAOBJECT readSCRIPTDATAOBJECT() throws IOException {
|
||||
System.out.println("reading obj");
|
||||
String objectName = readSCRIPTDATASTRING();
|
||||
@@ -263,6 +324,11 @@ public class FLVInputStream {
|
||||
return new SCRIPTDATAOBJECT(objectName, objectData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads VIDEODATA from the stream
|
||||
* @return VIDEODATA
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public VIDEODATA readVIDEODATA() throws IOException {
|
||||
int frameType = (int) readUB(4);
|
||||
int codecId = (int) readUB(4);
|
||||
@@ -270,6 +336,11 @@ public class FLVInputStream {
|
||||
return new VIDEODATA(frameType, codecId, videoData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATAVALUE from the stream
|
||||
* @return SCRIPTDATAVALUE
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public SCRIPTDATAVALUE readSCRIPTDATAVALUE() throws IOException {
|
||||
int type = readUI8();
|
||||
switch (type) {
|
||||
@@ -329,11 +400,21 @@ public class FLVInputStream {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATALONGSTRING from the stream
|
||||
* @return SCRIPTDATALONGSTRING
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public String readSCRIPTDATALONGSTRING() throws IOException {
|
||||
int len = (int) readUI32(); //? should be unsinged
|
||||
return new String(readBytes(len), Utf8Helper.charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATADATE from the stream
|
||||
* @return SCRIPTDATADATE
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public SCRIPTDATADATE readSCRIPTDATADATE() throws IOException {
|
||||
double time = readDOUBLE();
|
||||
int localDateTimeOffset = readSI16();
|
||||
@@ -344,7 +425,7 @@ public class FLVInputStream {
|
||||
* Reads one SI16 (Signed 16bit integer) value from the stream
|
||||
*
|
||||
* @return SI16 value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public int readSI16() throws IOException {
|
||||
int uval = (readEx() << 8) + readEx();
|
||||
@@ -354,6 +435,11 @@ public class FLVInputStream {
|
||||
return uval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATAVARIABLE from the stream
|
||||
* @return SCRIPTDATAVARIABLE
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public SCRIPTDATAVARIABLE readSCRIPTDATAVARIABLE() throws IOException {
|
||||
String variableName = readSCRIPTDATASTRING();
|
||||
if (variableName.length() == 0) {
|
||||
@@ -367,6 +453,11 @@ public class FLVInputStream {
|
||||
return new SCRIPTDATAVARIABLE(variableName, variableValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads SCRIPTDATASTRING from the stream
|
||||
* @return SCRIPTDATASTRING
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public String readSCRIPTDATASTRING() throws IOException {
|
||||
int len = readUI16();
|
||||
return new String(readBytes(len), Utf8Helper.charset);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FLV output stream
|
||||
* FLV output stream.
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@@ -36,20 +36,22 @@ public class FLVOutputStream extends OutputStream {
|
||||
|
||||
private long pos = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param os Output stream
|
||||
*/
|
||||
public FLVOutputStream(OutputStream os) {
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current position in the stream
|
||||
* @return Current position in the stream
|
||||
*/
|
||||
public long getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes byte to the stream
|
||||
*
|
||||
* @param b byte to write
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
alignByte();
|
||||
@@ -83,7 +85,7 @@ public class FLVOutputStream extends OutputStream {
|
||||
* Writes UI8 (Unsigned 8bit integer) value to the stream
|
||||
*
|
||||
* @param val UI8 value to write
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeUI8(int val) throws IOException {
|
||||
write(val);
|
||||
@@ -93,7 +95,7 @@ public class FLVOutputStream extends OutputStream {
|
||||
* Writes UI24 (Unsigned 24bit integer) value to the stream
|
||||
*
|
||||
* @param value UI32 value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeUI24(long value) throws IOException {
|
||||
write((int) ((value >> 16) & 0xff));
|
||||
@@ -106,7 +108,7 @@ public class FLVOutputStream extends OutputStream {
|
||||
* Writes UI32 (Unsigned 32bit integer) value to the stream
|
||||
*
|
||||
* @param value UI32 value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeUI32(long value) throws IOException {
|
||||
write((int) ((value >> 24) & 0xff));
|
||||
@@ -119,7 +121,7 @@ public class FLVOutputStream extends OutputStream {
|
||||
* Writes UI16 (Unsigned 16bit integer) value to the stream
|
||||
*
|
||||
* @param value UI16 value
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeUI16(int value) throws IOException {
|
||||
write((int) ((value >> 8) & 0xff));
|
||||
@@ -131,7 +133,7 @@ public class FLVOutputStream extends OutputStream {
|
||||
*
|
||||
* @param nBits Number of bits which represent value
|
||||
* @param value Unsigned value to write
|
||||
* @throws IOException
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeUB(int nBits, long value) throws IOException {
|
||||
for (int bit = 0; bit < nBits; bit++) {
|
||||
@@ -146,6 +148,12 @@ public class FLVOutputStream extends OutputStream {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes header.
|
||||
* @param audio Audio present
|
||||
* @param video Video present
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeHeader(boolean audio, boolean video) throws IOException {
|
||||
write("FLV".getBytes());
|
||||
write(1); //version
|
||||
@@ -157,6 +165,11 @@ public class FLVOutputStream extends OutputStream {
|
||||
writeUI32(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes tag.
|
||||
* @param tag Tag to write
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeTag(FLVTAG tag) throws IOException {
|
||||
long posBefore = getPos();
|
||||
writeUI8(tag.tagType);
|
||||
@@ -171,12 +184,22 @@ public class FLVOutputStream extends OutputStream {
|
||||
writeUI32(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATASTRING value to the stream
|
||||
* @param s String value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATASTRING(String s) throws IOException {
|
||||
byte[] bytes = Utf8Helper.getBytes(s);
|
||||
writeUI16(bytes.length);
|
||||
write(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATALONGSTRING value to the stream
|
||||
* @param s String value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATALONGSTRING(String s) throws IOException {
|
||||
byte[] bytes = Utf8Helper.getBytes(s);
|
||||
writeUI32(bytes.length);
|
||||
@@ -196,20 +219,40 @@ public class FLVOutputStream extends OutputStream {
|
||||
write(writeBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes DOUBLE value to the stream.
|
||||
* @param value Double value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeDOUBLE(double value) throws IOException {
|
||||
writeLong(Double.doubleToLongBits(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATAOBJECT value to the stream.
|
||||
* @param o Object value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATAOBJECT(SCRIPTDATAOBJECT o) throws IOException {
|
||||
writeSCRIPTDATASTRING(o.objectName);
|
||||
writeSCRIPTDATAVALUE(o.objectData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATAVARIABLE value to the stream.
|
||||
* @param v Variable value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATAVARIABLE(SCRIPTDATAVARIABLE v) throws IOException {
|
||||
writeSCRIPTDATASTRING(v.variableName);
|
||||
writeSCRIPTDATAVALUE(v.variableData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATAVALUE value to the stream.
|
||||
* @param v Value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATAVALUE(SCRIPTDATAVALUE v) throws IOException {
|
||||
writeUI8(v.type);
|
||||
switch (v.type) {
|
||||
@@ -279,10 +322,20 @@ public class FLVOutputStream extends OutputStream {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SI16 (Signed 16bit integer) value to the stream
|
||||
* @param value SI16 value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSI16(int value) throws IOException {
|
||||
writeUI16(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes SCRIPTDATADATE value to the stream
|
||||
* @param d Value
|
||||
* @throws IOException On I/O error
|
||||
*/
|
||||
public void writeSCRIPTDATADATE(SCRIPTDATADATE d) throws IOException {
|
||||
writeDOUBLE(d.dateTime);
|
||||
writeSI16(d.localDateTimeOffset);
|
||||
|
||||
@@ -23,34 +23,74 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class FLVTAG {
|
||||
|
||||
/**
|
||||
* Tag type
|
||||
*/
|
||||
public int tagType;
|
||||
|
||||
/**
|
||||
* Timestamp in milliseconds
|
||||
*/
|
||||
public long timeStamp;
|
||||
|
||||
/**
|
||||
* Data
|
||||
*/
|
||||
public DATA data;
|
||||
|
||||
/**
|
||||
* Data type: video
|
||||
*/
|
||||
public static final int DATATYPE_VIDEO = 9;
|
||||
|
||||
/**
|
||||
* Data type: audio
|
||||
*/
|
||||
public static final int DATATYPE_AUDIO = 8;
|
||||
|
||||
/**
|
||||
* Data type: script data
|
||||
*/
|
||||
public static final int DATATYPE_SCRIPT_DATA = 18;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param timeStamp Timestamp in milliseconds
|
||||
* @param data Data
|
||||
*/
|
||||
public FLVTAG(long timeStamp, SCRIPTDATA data) {
|
||||
tagType = DATATYPE_SCRIPT_DATA;
|
||||
this.timeStamp = timeStamp;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param timeStamp Timestamp in milliseconds
|
||||
* @param data Data
|
||||
*/
|
||||
public FLVTAG(long timeStamp, UnparsedDATA data) {
|
||||
tagType = data.getDataType();
|
||||
this.timeStamp = timeStamp;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param timeStamp Timestamp in milliseconds
|
||||
* @param data Data
|
||||
*/
|
||||
public FLVTAG(long timeStamp, VIDEODATA data) {
|
||||
this.tagType = DATATYPE_VIDEO;
|
||||
this.timeStamp = timeStamp;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param timeStamp Timestamp in milliseconds
|
||||
* @param data Data
|
||||
*/
|
||||
public FLVTAG(long timeStamp, AUDIODATA data) {
|
||||
this.tagType = DATATYPE_AUDIO;
|
||||
this.timeStamp = timeStamp;
|
||||
|
||||
@@ -30,9 +30,20 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class SCRIPTDATA extends DATA {
|
||||
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
public SCRIPTDATAVALUE name;
|
||||
/**
|
||||
* Value
|
||||
*/
|
||||
public SCRIPTDATAVALUE value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param name Name
|
||||
* @param value Value
|
||||
*/
|
||||
public SCRIPTDATA(SCRIPTDATAVALUE name, SCRIPTDATAVALUE value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
@@ -50,6 +61,15 @@ public class SCRIPTDATA extends DATA {
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates simple onMetaData script data.
|
||||
* @param duration Duration
|
||||
* @param width Width
|
||||
* @param height Height
|
||||
* @param framerate Framerate
|
||||
* @param videocodecid Video codec id
|
||||
* @return Script data
|
||||
*/
|
||||
public static SCRIPTDATA simpleVideOnMetadata(double duration, double width, double height, double framerate, double videocodecid) {
|
||||
List<SCRIPTDATAVARIABLE> values = new ArrayList<>();
|
||||
values.add(new SCRIPTDATAVARIABLE("duration", new SCRIPTDATAVALUE(duration)));
|
||||
@@ -62,6 +82,21 @@ public class SCRIPTDATA extends DATA {
|
||||
return new SCRIPTDATA(onMetadataKey, valuesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates onMetaData script data.
|
||||
* @param duration Duration
|
||||
* @param width Width
|
||||
* @param height Height
|
||||
* @param videodatarate Video data rate
|
||||
* @param framerate Framerate
|
||||
* @param videocodecid Video codec id
|
||||
* @param audiosamplerate Audio sample rate
|
||||
* @param audiosamplesize Audio sample size
|
||||
* @param stereo Stereo
|
||||
* @param audiocodecid Audio codec id
|
||||
* @param filesize File size
|
||||
* @return Script data
|
||||
*/
|
||||
public static SCRIPTDATA onMetaData(double duration, double width, double height, double videodatarate, double framerate, double videocodecid, double audiosamplerate, double audiosamplesize, boolean stereo, double audiocodecid, double filesize) {
|
||||
List<SCRIPTDATAVARIABLE> values = new ArrayList<>();
|
||||
values.add(new SCRIPTDATAVARIABLE("duration", new SCRIPTDATAVALUE(duration)));
|
||||
|
||||
@@ -23,10 +23,22 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class SCRIPTDATADATE {
|
||||
|
||||
/**
|
||||
* Date time
|
||||
*/
|
||||
public double dateTime;
|
||||
|
||||
/**
|
||||
* Local date time offset
|
||||
*/
|
||||
public int localDateTimeOffset;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param dateTime Date time
|
||||
* @param localDateTimeOffset Local date time offset
|
||||
*/
|
||||
public SCRIPTDATADATE(double dateTime, int localDateTimeOffset) {
|
||||
this.dateTime = dateTime;
|
||||
this.localDateTimeOffset = localDateTimeOffset;
|
||||
|
||||
@@ -23,10 +23,21 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class SCRIPTDATAOBJECT {
|
||||
|
||||
/**
|
||||
* Object name
|
||||
*/
|
||||
public String objectName;
|
||||
|
||||
/**
|
||||
* Object data
|
||||
*/
|
||||
public SCRIPTDATAVALUE objectData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param objectName Object name
|
||||
* @param objectData Object data
|
||||
*/
|
||||
public SCRIPTDATAOBJECT(String objectName, SCRIPTDATAVALUE objectData) {
|
||||
this.objectName = objectName;
|
||||
this.objectData = objectData;
|
||||
|
||||
@@ -23,20 +23,39 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class SCRIPTDATAVALUE {
|
||||
|
||||
/**
|
||||
* Type
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* Value
|
||||
*/
|
||||
public Object value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param type Type
|
||||
* @param value Value
|
||||
*/
|
||||
public SCRIPTDATAVALUE(int type, Object value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param b Value
|
||||
*/
|
||||
public SCRIPTDATAVALUE(boolean b) {
|
||||
this.value = (Boolean) b;
|
||||
type = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param d Value
|
||||
*/
|
||||
public SCRIPTDATAVALUE(double d) {
|
||||
this.value = (Double) d;
|
||||
type = 0;
|
||||
|
||||
@@ -23,10 +23,21 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class SCRIPTDATAVARIABLE {
|
||||
|
||||
/**
|
||||
* Variable name
|
||||
*/
|
||||
public String variableName;
|
||||
|
||||
/**
|
||||
* Variable data
|
||||
*/
|
||||
public SCRIPTDATAVALUE variableData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param variableName Variable name
|
||||
* @param variableData Variable data
|
||||
*/
|
||||
public SCRIPTDATAVARIABLE(String variableName, SCRIPTDATAVALUE variableData) {
|
||||
this.variableName = variableName;
|
||||
this.variableData = variableData;
|
||||
|
||||
@@ -23,9 +23,20 @@ package com.jpexs.decompiler.flash.flv;
|
||||
*/
|
||||
public class UnparsedDATA extends DATA {
|
||||
|
||||
/**
|
||||
* Data type
|
||||
*/
|
||||
private int dataType;
|
||||
/**
|
||||
* Data
|
||||
*/
|
||||
private byte[] data;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param dataType Data type
|
||||
* @param data Data
|
||||
*/
|
||||
public UnparsedDATA(int dataType, byte[] data) {
|
||||
this.dataType = dataType;
|
||||
this.data = data;
|
||||
@@ -36,6 +47,10 @@ public class UnparsedDATA extends DATA {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data type.
|
||||
* @return Data type
|
||||
*/
|
||||
public int getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@@ -26,20 +26,56 @@ import java.io.IOException;
|
||||
*/
|
||||
public class VIDEODATA extends DATA {
|
||||
|
||||
/**
|
||||
* Frame type
|
||||
*/
|
||||
public int frameType;
|
||||
|
||||
/**
|
||||
* Codec ID
|
||||
*/
|
||||
public int codecId;
|
||||
|
||||
/**
|
||||
* Video data
|
||||
*/
|
||||
public byte[] videoData;
|
||||
|
||||
/**
|
||||
* Codec: JPEG
|
||||
*/
|
||||
public static final int CODEC_JPEG = 1;
|
||||
/**
|
||||
* Codec: Sorenson H.263
|
||||
*/
|
||||
public static final int CODEC_SORENSON_H263 = 2;
|
||||
/**
|
||||
* Codec: Screen video
|
||||
*/
|
||||
public static final int CODEC_SCREEN_VIDEO = 3;
|
||||
/**
|
||||
* Codec: VP6
|
||||
*/
|
||||
public static final int CODEC_VP6 = 4;
|
||||
/**
|
||||
* Codec: VP6 alpha
|
||||
*/
|
||||
public static final int CODEC_VP6_ALPHA = 5;
|
||||
/**
|
||||
* Codec: Screen video v2
|
||||
*/
|
||||
public static final int CODEC_SCREEN_VIDEO_V2 = 6;
|
||||
/**
|
||||
* Codec: AVC
|
||||
*/
|
||||
public static final int CODEC_AVC = 7;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param frameType Frame type
|
||||
* @param codecId Codec ID
|
||||
* @param videoData Video data
|
||||
*/
|
||||
public VIDEODATA(int frameType, int codecId, byte[] videoData) {
|
||||
this.frameType = frameType;
|
||||
this.codecId = codecId;
|
||||
|
||||
Reference in New Issue
Block a user