Open Qamar4P opened 7 years ago
MovieBox movieBox = isoFile.getMovieBox();
UserDataBox userDataBox = movieBox.getBoxes(UserDataBox.class).get(0);
stringBuilder.append(userDataBox.getType()+"\n");
stringBuilder.append(userDataBox.getBoxes(HMMTBox.class).get(0));
Using following my class. returns null. @sannies can you please guide me regarding this.
import org.mp4parser.Box;
import org.mp4parser.BoxParser;
import org.mp4parser.support.AbstractFullBox;
import org.mp4parser.tools.IsoTypeReader;
import org.mp4parser.tools.IsoTypeWriter;
import org.mp4parser.tools.Utf8;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
/**
* Created by Qamar4P on 4/28/2017.
*/
public class HMMTBox extends AbstractFullBox {
public static final String TYPE = "HMMT";
private long count;
private long[] milliseconds;
public long getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public long[] getMilliseconds() {
return milliseconds;
}
public void setMilliseconds(long[] milliseconds) {
this.milliseconds = milliseconds;
}
public HMMTBox() {
super(TYPE);
}
protected long getContentSize() {
return 8 + (milliseconds != null ? milliseconds.length*8 : 0);
}
protected void getContent(ByteBuffer byteBuffer) {
writeVersionAndFlags(byteBuffer);
IsoTypeWriter.writeUInt32(byteBuffer, count);
if(milliseconds != null && milliseconds.length > 0){
for (long millisecond : milliseconds) {
byteBuffer.put(longToByteArray(millisecond));
}
}
byteBuffer.put((byte) 0);
}
public byte[] longToByteArray(long value) {
return new byte[] {
(byte) (value >> 56),
(byte) (value >> 48),
(byte) (value >> 40),
(byte) (value >> 32),
(byte) (value >> 24),
(byte) (value >> 16),
(byte) (value >> 8),
(byte) value
};
}
@Override
public void _parseDetails(ByteBuffer content) {
parseVersionAndFlags(content);
count = IsoTypeReader.readUInt32(content);
if(count > 0){
milliseconds = new long[(int) count];
for (int i = 0; i < milliseconds.length; i++) {
milliseconds[i] = IsoTypeReader.readUInt32(content);
}
}
}
public String toString() {
return "Count[count=" + getCount() + ";milliseconds=" + getMilliseconds() + "]";
}
What I understand library doesn't returns UnknownBox's from UserDataBox.
While com.googlecode.mp4parser does in https://github.com/sannies/isoviewer but issue still not resolved. we need
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
ReadableByteChannel chanel = Channels.newChannel(in);
IsoFile isoFile = new IsoFile(chanel);
Go Pro tag
@sannies can you please guide me in this stack-overflow question link