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());
|
writeFlvValueArray(out, "filepositions", value.size());
|
||||||
for (Keyframe f : value) {
|
for (Keyframe f : value) {
|
||||||
offset.set(f.getFileOffset(0));
|
offset.set(f.getFileOffset());
|
||||||
offset.write(out);
|
offset.write(out);
|
||||||
}
|
}
|
||||||
writeFlvValueArray(out, "times", value.size());
|
writeFlvValueArray(out, "times", value.size());
|
||||||
|
|
@ -211,7 +211,16 @@ public class FlvMetadata {
|
||||||
attrs.add(new KeyframesAttr("keyframes", keyframes));
|
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) {
|
public void addVideoFrame(int filePos, int timestamp, boolean isKeyframe) {
|
||||||
|
|
||||||
|
|
@ -246,7 +255,7 @@ public class FlvMetadata {
|
||||||
|
|
||||||
// ScriptDataObject
|
// ScriptDataObject
|
||||||
out.write(2);
|
out.write(2);
|
||||||
writeFlvEcmaArray(out, "onMetaData", length);
|
writeFlvEcmaArray(out, "onMetaData", length());
|
||||||
for (Attr a : attrs) {
|
for (Attr a : attrs) {
|
||||||
if (a.isPresent()) {
|
if (a.isPresent()) {
|
||||||
a.write(out);
|
a.write(out);
|
||||||
|
|
@ -353,18 +362,11 @@ public class FlvMetadata {
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFileOffset(int delta) {
|
public int getFileOffset() {
|
||||||
return fileOffset + delta;
|
return fileOffset;
|
||||||
}
|
|
||||||
public void setFileOffset(int fileOffset) {
|
|
||||||
this.fileOffset = fileOffset;
|
|
||||||
}
|
}
|
||||||
public int getTimestamp() {
|
public int getTimestamp() {
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
public void setTimestamp(int timestamp) {
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue