Fixed: #2551 Showing too wide video tags in Flash player producing ValueTooLarge exception. Also truncated video length.

This commit is contained in:
Jindra Petřík
2025-11-09 15:31:40 +01:00
parent f8869b9ca9
commit 68075ea9c5
2 changed files with 15 additions and 8 deletions
+3
View File
@@ -19,6 +19,8 @@ All notable changes to this project will be documented in this file.
- [#2547] SVG import - improper linearGradient with userSpaceOnUse gradient units
- [#2545] FLA export - normalize font em square
- [#2552] Open with FFDec explorer menu shrinking sidebar
- [#2551] Showing too wide video tags in Flash player producing ValueTooLarge
exception. Also truncated video length.
## [24.1.0] - 2025-09-28
### Added
@@ -4035,6 +4037,7 @@ Major version of SWF to XML export changed to 2.
[#2547]: https://www.free-decompiler.com/flash/issues/2547
[#2545]: https://www.free-decompiler.com/flash/issues/2545
[#2552]: https://www.free-decompiler.com/flash/issues/2552
[#2551]: https://www.free-decompiler.com/flash/issues/2551
[#2477]: https://www.free-decompiler.com/flash/issues/2477
[#2478]: https://www.free-decompiler.com/flash/issues/2478
[#2485]: https://www.free-decompiler.com/flash/issues/2485
@@ -105,11 +105,14 @@ public class PreviewExporter {
public static final int MORPH_SHAPE_ANIMATION_LENGTH = 2;
public static final int MORPH_SHAPE_ANIMATION_FRAME_RATE = 30;
private static final double WIDTH_DIVISOR = 1000;
private void updateProgressBar(int xmin, int ymin, SWF swf, SWFOutputStream sos2, int width, int height, int progressBarHeight, int currentFrame, int totalFrames) throws IOException {
Matrix m = new Matrix();
m.translate(xmin, ymin + height - progressBarHeight * 20);
m.scale(width * currentFrame / totalFrames, progressBarHeight * 20);
m.scale(width / WIDTH_DIVISOR * currentFrame / totalFrames, progressBarHeight * 20);
new PlaceObject2Tag(swf, true, 2, -1, m.toMATRIX(), null, -1, null, -1, null).writeTag(sos2);
}
@@ -117,10 +120,10 @@ public class PreviewExporter {
int progressBarShapeId = swf.getNextCharacterId();
int overVideoButtonId = progressBarShapeId + 1;
int progressBarButtonId = overVideoButtonId + 1;
Color progressBarColor = Color.red;
DefineShapeTag dsh = new DefineShapeTag(swf);
dsh.shapeBounds = new RECT(0, 20, 0, 20 * progressBarHeight);
dsh.shapeBounds = new RECT(0, (int) Math.round(WIDTH_DIVISOR * 20), 0, 20 * progressBarHeight);
dsh.shapeId = progressBarShapeId;
dsh.shapes.fillStyles.fillStyles = new FILLSTYLE[1];
dsh.shapes.fillStyles.fillStyles[0] = new FILLSTYLE();
@@ -140,14 +143,14 @@ public class PreviewExporter {
ser.deltaY = 1;
dsh.shapes.shapeRecords.add(ser);
ser = new StraightEdgeRecord();
ser.deltaX = 1;
ser.deltaX = (int) Math.round(WIDTH_DIVISOR * 1);
dsh.shapes.shapeRecords.add(ser);
ser = new StraightEdgeRecord();
ser.vertLineFlag = true;
ser.deltaY = -1;
dsh.shapes.shapeRecords.add(ser);
ser = new StraightEdgeRecord();
ser.deltaX = -1;
ser.deltaX = (int) Math.round(-1 * WIDTH_DIVISOR);
dsh.shapes.shapeRecords.add(ser);
dsh.shapes.shapeRecords.add(new EndShapeRecord());
@@ -226,13 +229,13 @@ public class PreviewExporter {
new PlaceObject2Tag(swf, false, 2, progressBarShapeId, m.toMATRIX(), null, -1, null, -1, null).writeTag(sos2);
m = new Matrix();
m.scale(width, height - progressBarHeight * 20);
m.scale(width / WIDTH_DIVISOR, height - progressBarHeight * 20);
new PlaceObject2Tag(swf, false, 3, overVideoButtonId, m.toMATRIX(), null, -1, null, -1, null).writeTag(sos2);
m = new Matrix();
m.translate(xmin, ymin + height - progressBarHeight * 20);
m.scale(width, progressBarHeight * 20);
m.scale(width / WIDTH_DIVISOR, progressBarHeight * 20);
new PlaceObject2Tag(swf, false, 4, progressBarButtonId, m.toMATRIX(), null, -1, null, -1, null).writeTag(sos2);
@@ -612,6 +615,7 @@ public class PreviewExporter {
doa.writeTag(sos2);
new ShowFrameTag(swf).writeTag(sos2);
} else if (treeItem instanceof DefineVideoStreamTag) {
DefineVideoStreamTag dv = (DefineVideoStreamTag) treeItem;
List<VideoFrameTag> frs = new ArrayList<>(videoFrames.values());
Collections.sort(frs, new Comparator<VideoFrameTag>() {
@Override
@@ -627,7 +631,7 @@ public class PreviewExporter {
int ratio = 0;
for (VideoFrameTag f : frs) {
if (!first) {
ratio++;
ratio = f.frameNum;
new PlaceObject2Tag(swf, true, 1, -1, null, null, ratio, null, -1, null).writeTag(sos2);
if (showControls) {
updateProgressBar(rxmin, rymin, swf, sos2, width, height, progressBarHeight, ratio, videoFrames.size());