misc changes

* read "SeekPreRoll" from the source track (if available)
* use the longest track duration as segment duration, instead of the video track duration
* do not hardcode the "Cue" reserved space behavior
* do not hardcode the "EBML Void" element, unreported issue. The size was not properly calculated
* rewrite the key-frame picking
* remove writeInt(), writeFloat() and writeShort() methods, use inline code
* set "SeekPreRoll" and "CodecDelays" values on output tracks (if available)
* rewrite the "Cluster" maker
* rewrite the code of how "Cluster" sizes are written

Fix encode() method (the reason of this commit/pull-request):
* Use the unsigned shift operator instead of dividing the value, due precession lost
This commit is contained in:
kapodamy 2020-03-12 00:50:14 -03:00 committed by GitHub
parent f7822a448e
commit ca8f8e0ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 190 additions and 147 deletions

View File

@ -37,6 +37,7 @@ public class WebMReader {
private final static int ID_DefaultDuration = 0x3E383;
private final static int ID_FlagLacing = 0x1C;
private final static int ID_CodecDelay = 0x16AA;
private final static int ID_SeekPreRoll = 0x16BB;
private final static int ID_Cluster = 0x0F43B675;
private final static int ID_Timecode = 0x67;
@ -332,6 +333,10 @@ public class WebMReader {
break;
case ID_CodecDelay:
entry.codecDelay = readNumber(elem);
break;
case ID_SeekPreRoll:
entry.seekPreRoll = readNumber(elem);
break;
default:
break;
}
@ -414,8 +419,9 @@ public class WebMReader {
public byte[] codecPrivate;
public byte[] bMetadata;
public TrackKind kind;
public long defaultDuration;
public long codecDelay;
public long defaultDuration = -1;
public long codecDelay = -1;
public long seekPreRoll = -1;
}
public class Segment {

File diff suppressed because it is too large Load Diff