fix length calculation, remove unnecessary code.
This commit is contained in:
parent
43fef6e92f
commit
dee96ab87d
1 changed files with 14 additions and 12 deletions
|
|
@ -113,7 +113,7 @@ public class FlvMetadata {
|
|||
|
||||
writeFlvValueArray(out, "filepositions", value.size());
|
||||
for (Keyframe f : value) {
|
||||
offset.set(f.getFileOffset(0));
|
||||
offset.set(f.getFileOffset());
|
||||
offset.write(out);
|
||||
}
|
||||
writeFlvValueArray(out, "times", value.size());
|
||||
|
|
@ -211,7 +211,16 @@ public class FlvMetadata {
|
|||
attrs.add(new KeyframesAttr("keyframes", keyframes));
|
||||
}
|
||||
|
||||
private int length = 0;
|
||||
|
||||
private int length() {
|
||||
int i = 0;
|
||||
for (Attr a : attrs) {
|
||||
if (a.isPresent()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public void addVideoFrame(int filePos, int timestamp, boolean isKeyframe) {
|
||||
|
||||
|
|
@ -246,7 +255,7 @@ public class FlvMetadata {
|
|||
|
||||
// ScriptDataObject
|
||||
out.write(2);
|
||||
writeFlvEcmaArray(out, "onMetaData", length);
|
||||
writeFlvEcmaArray(out, "onMetaData", length());
|
||||
for (Attr a : attrs) {
|
||||
if (a.isPresent()) {
|
||||
a.write(out);
|
||||
|
|
@ -353,18 +362,11 @@ public class FlvMetadata {
|
|||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public int getFileOffset(int delta) {
|
||||
return fileOffset + delta;
|
||||
}
|
||||
public void setFileOffset(int fileOffset) {
|
||||
this.fileOffset = fileOffset;
|
||||
public int getFileOffset() {
|
||||
return fileOffset;
|
||||
}
|
||||
public int getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
public void setTimestamp(int timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue