diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e66eab9e..a6ecb78b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. - [#2581] Save as SWC through context menu of SWF files (previously only in CLI) - Save as EXE through context menu of SWF files (previously only in toolbar) - Slovenian translation +- SVG export - video frames ### Fixed - [#2570] NullpointerException on SVG export of DefineEditText @@ -19,6 +20,7 @@ All notable changes to this project will be documented in this file. - PDF export - not rendering video stream frames - [#2585] AS1/2 direct editation - continue and break in for..in loop - [#2589] SVG export - subsprite animation, sprite offsets +- [#1893] Video - incorrect frame size ### Changed - [#2575] dumpSWF CLI command only allows single SWF dump (no imports, etc.) @@ -4073,6 +4075,7 @@ Major version of SWF to XML export changed to 2. [#2582]: https://www.free-decompiler.com/flash/issues/2582 [#2585]: https://www.free-decompiler.com/flash/issues/2585 [#2589]: https://www.free-decompiler.com/flash/issues/2589 +[#1893]: https://www.free-decompiler.com/flash/issues/1893 [#2556]: https://www.free-decompiler.com/flash/issues/2556 [#2536]: https://www.free-decompiler.com/flash/issues/2536 [#2537]: https://www.free-decompiler.com/flash/issues/2537 @@ -4485,7 +4488,6 @@ Major version of SWF to XML export changed to 2. [#1564]: https://www.free-decompiler.com/flash/issues/1564 [#1676]: https://www.free-decompiler.com/flash/issues/1676 [#1697]: https://www.free-decompiler.com/flash/issues/1697 -[#1893]: https://www.free-decompiler.com/flash/issues/1893 [#1181]: https://www.free-decompiler.com/flash/issues/1181 [#1900]: https://www.free-decompiler.com/flash/issues/1900 [#1897]: https://www.free-decompiler.com/flash/issues/1897 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index 309012cd8..0efd5e997 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -56,6 +56,7 @@ import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -66,6 +67,8 @@ import java.util.Set; import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; +import javax.imageio.ImageIO; +import org.w3c.dom.Element; /** * DefineVideoStream tag - defines video stream. @@ -403,16 +406,15 @@ public class DefineVideoStreamTag extends DrawableTag implements BoundedTag, Tim if (renderingPaused) { return; } - //System.out.println("drawed"); Graphics2D graphics = (Graphics2D) image.getGraphics(); - AffineTransform at = transformation.toTransform(); + AffineTransform at = AffineTransform.getScaleInstance(width / (double) activeFrame.getWidth(), height / (double) activeFrame.getHeight()); + at.preConcatenate(transformation.toTransform()); at.preConcatenate(AffineTransform.getScaleInstance(1 / SWF.unitDivisor, 1 / SWF.unitDivisor)); graphics.setTransform(at); - //Point p = transformation.inverse().transform(0, 0); graphics.drawImage(activeFrame, 0, 0, - (int) Math.round(width * SWF.unitDivisor), - (int) Math.round(height * SWF.unitDivisor), - 0, 0, width, height, + (int) Math.round(activeFrame.getWidth() * SWF.unitDivisor), + (int) Math.round(activeFrame.getHeight() * SWF.unitDivisor), + 0, 0, activeFrame.getWidth(), activeFrame.getHeight(), null); } } @@ -421,6 +423,73 @@ public class DefineVideoStreamTag extends DrawableTag implements BoundedTag, Tim @Override public void toSVG(int frame, int time, SVGExporter exporter, int ratio, ColorTransform colorTransform, int level, Matrix transformation, Matrix strokeTransformation) throws IOException { + if (renderingPaused || !SimpleMediaPlayer.isAvailable()) { + return; + } + if (ratio == -1) { + ratio = 0; + } + + Set keyFrames = getFrames().keySet(); + + int f = 0; + for (int i = 0; i <= ratio; i++) { + if (keyFrames.contains(i)) { + f = i; + } + } + + synchronized (DefineVideoStreamTag.class) { + if (!(activeFrame != null && lastFrame == f)) { + initPlayer(); + + if (mediaPlayer == null) { + return; + } + + float oneFr = 0; //1f / (getNumFrames() + 2); + + synchronized (getFrameLock) { + activeFrame = null; + } + mediaPlayer.setPosition(((float) f) / (getNumFrames() + 2) - (f == 0 ? 0 : oneFr / 10f)); + + try { + synchronized (getFrameLock) { + if (activeFrame == null) { + //System.out.println("waiting..."); + getFrameLock.wait(); + Thread.sleep(10); //magic, but should work + mediaPlayer.pause(); + //System.out.println("awakened"); + } + } + } catch (InterruptedException ex) { + //Logger.getLogger(DefineVideoStreamTag.class.getName()).log(Level.SEVERE, null, ex); + } + } + lastFrame = f; + synchronized (getFrameLock) { + if (activeFrame != null) { + if (renderingPaused) { + return; + } + Element image = exporter.createElement("image"); + image.setAttribute("width", "" + (activeFrame.getWidth())); + image.setAttribute("height", "" + (activeFrame.getHeight())); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(activeFrame, "PNG", baos); + image.setAttribute("href", "data:image/png;base64," + Helper.byteArrayToBase64String(baos.toByteArray()));; + + Matrix mat = Matrix.getScaleInstance(width / (double) activeFrame.getWidth(), height / (double) activeFrame.getHeight()); + mat.preConcatenate(transformation); + mat.preConcatenate(Matrix.getScaleInstance(1 / SWF.unitDivisor, 1 / SWF.unitDivisor)); + + image.setAttribute("transform", mat.getSvgTransformationString(1, 1)); + exporter.addToGroup(image); + } + } + } } @Override diff --git a/libsrc/ffdec_lib/testdata/video/src/frames_wide.flv b/libsrc/ffdec_lib/testdata/video/src/frames_wide.flv new file mode 100644 index 000000000..fc5a37fdc Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/frames_wide.flv differ diff --git a/libsrc/ffdec_lib/testdata/video/src/frames_wide.mp4 b/libsrc/ffdec_lib/testdata/video/src/frames_wide.mp4 new file mode 100644 index 000000000..37d1d927d Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/frames_wide.mp4 differ diff --git a/libsrc/ffdec_lib/testdata/video/src/frames_wide.swf b/libsrc/ffdec_lib/testdata/video/src/frames_wide.swf new file mode 100644 index 000000000..69911f533 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/frames_wide.swf differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square1.png b/libsrc/ffdec_lib/testdata/video/src/square1.png new file mode 100644 index 000000000..0aace7cd4 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/square1.png differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square1.svg b/libsrc/ffdec_lib/testdata/video/src/square1.svg new file mode 100644 index 000000000..62e32f671 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/src/square1.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/video/src/square2.png b/libsrc/ffdec_lib/testdata/video/src/square2.png new file mode 100644 index 000000000..f54d2d382 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/square2.png differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square2.svg b/libsrc/ffdec_lib/testdata/video/src/square2.svg new file mode 100644 index 000000000..e6dc07233 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/src/square2.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/video/src/square3.png b/libsrc/ffdec_lib/testdata/video/src/square3.png new file mode 100644 index 000000000..3ddb61b93 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/square3.png differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square3.svg b/libsrc/ffdec_lib/testdata/video/src/square3.svg new file mode 100644 index 000000000..b81b37dc1 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/src/square3.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/video/src/square4.png b/libsrc/ffdec_lib/testdata/video/src/square4.png new file mode 100644 index 000000000..b0f94ed2a Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/square4.png differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square4.svg b/libsrc/ffdec_lib/testdata/video/src/square4.svg new file mode 100644 index 000000000..b97863a3b --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/src/square4.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/video/src/square5.png b/libsrc/ffdec_lib/testdata/video/src/square5.png new file mode 100644 index 000000000..4c22fd6dd Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/src/square5.png differ diff --git a/libsrc/ffdec_lib/testdata/video/src/square5.svg b/libsrc/ffdec_lib/testdata/video/src/square5.svg new file mode 100644 index 000000000..1e573cc9c --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/src/square5.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/video/video.html b/libsrc/ffdec_lib/testdata/video/video.html new file mode 100644 index 000000000..2688d74a1 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video.html @@ -0,0 +1,49 @@ + + + + video + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Adobe Flash player + + + + + +
+ + diff --git a/libsrc/ffdec_lib/testdata/video/video.swd b/libsrc/ffdec_lib/testdata/video/video.swd new file mode 100644 index 000000000..b554d868e Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/video.swd differ diff --git a/libsrc/ffdec_lib/testdata/video/video.swf b/libsrc/ffdec_lib/testdata/video/video.swf new file mode 100644 index 000000000..cee6a7ca4 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/video.swf differ diff --git a/libsrc/ffdec_lib/testdata/video/video/DOMDocument.xml b/libsrc/ffdec_lib/testdata/video/video/DOMDocument.xml new file mode 100644 index 000000000..30fab1c83 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video/DOMDocument.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/video/video/LIBRARY/Symbol 1.xml b/libsrc/ffdec_lib/testdata/video/video/LIBRARY/Symbol 1.xml new file mode 100644 index 000000000..c5d835068 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video/LIBRARY/Symbol 1.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/video/video/META-INF/metadata.xml b/libsrc/ffdec_lib/testdata/video/video/META-INF/metadata.xml new file mode 100644 index 000000000..7ae1e7652 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video/META-INF/metadata.xml @@ -0,0 +1,80 @@ + + + + + Adobe Flash Professional CS6 - build 481 + 2025-12-21T04:55:26-08:00 + 2025-12-21T08:30:44-08:00 + 2025-12-21T08:30:44-08:00 + + + xmp.iid:6F0BE33F84DEF0118EA5B774F167B34F + xmp.did:2A6A54006DDEF011B5CFAC3523234A55 + xmp.did:276A54006DDEF011B5CFAC3523234A55 + + + + created + xmp.iid:276A54006DDEF011B5CFAC3523234A55 + 2025-12-21T04:55:26-08:00 + Adobe Flash Professional CS6 - build 481 + + + saved + xmp.iid:2A6A54006DDEF011B5CFAC3523234A55 + 2025-12-21T05:18:45-08:00 + Adobe Flash Professional CS6 - build 481 + / + + + created + xmp.iid:6C0BE33F84DEF0118EA5B774F167B34F + 2025-12-21T04:55:26-08:00 + Adobe Flash Professional CS6 - build 481 + + + created + xmp.iid:6F0BE33F84DEF0118EA5B774F167B34F + 2025-12-21T04:55:26-08:00 + Adobe Flash Professional CS6 - build 481 + + + + + xmp.iid:276A54006DDEF011B5CFAC3523234A55 + xmp.did:276A54006DDEF011B5CFAC3523234A55 + xmp.did:276A54006DDEF011B5CFAC3523234A55 + + + + application/vnd.adobe.fla + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/video/video/MobileSettings.xml b/libsrc/ffdec_lib/testdata/video/video/MobileSettings.xml new file mode 100644 index 000000000..e69de29bb diff --git a/libsrc/ffdec_lib/testdata/video/video/PublishSettings.xml b/libsrc/ffdec_lib/testdata/video/video/PublishSettings.xml new file mode 100644 index 000000000..c4ed3614c --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video/PublishSettings.xml @@ -0,0 +1,206 @@ + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + video.swf + video.exe + video.app + video.html + video.gif + video.jpg + video.png + video.mov + video.smil + video.swc + + + 0 + 12,0,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1; + 1 + 1 + video.xfl_content.html + video.xfl_alternate.html + 0 + + 550 + 400 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + 4 + 0 + 0 + 1 + 0 + C:\Users\MyUser\AppData\Local\Adobe\Flash CS6\en_US\Configuration\HTML\Default.html + 1 + + + + + 0 + 0 + 0 + 80 + 0 + 0 + 7 + 0 + 7 + 0 + 15 + FlashPlayer11.2 + 2 + 1 + + . + CONFIG::FLASH_AUTHORING="true"; + 0 + + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + 2 + 4 + 4096 + AS3 + 1 + 1 + 0 + 15 + 1 + 0 + 4102 + rsl + wrap + $(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf + + + $(AppConfig)/ActionScript 3.0/libs + merge + + + $(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc + rsl + http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz + http://fpdownload.adobe.com/pub/swz/crossdomain.xml + textLayout_2.0.0.232.swz + + + + + $(AppConfig)/ActionScript 3.0/libs/11.0/textLayout.swc + + http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz + http://fpdownload.adobe.com/pub/swz/crossdomain.xml + textLayout_2.0.0.232.swz + + + + + 550 + 400 + 0 + 4718592 + 0 + 80 + 1 + + + 1 + 0 + 1 + 0 + 0 + 100000 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + 550 + 400 + 0 + 1 + 1 + + 1 + 0 + 1 + 0 + 0 + + 128 + + + 255 + + + + 550 + 400 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + + + + 24-bit with Alpha + 255 + + + + 550 + 400 + 1 + 0 + + + 00000000 + 0 + 0 + 0 + 0 + 1 + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/video/video/bin/M 1 1766334598.dat b/libsrc/ffdec_lib/testdata/video/video/bin/M 1 1766334598.dat new file mode 100644 index 000000000..3b42a8f75 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/video/bin/M 1 1766334598.dat differ diff --git a/libsrc/ffdec_lib/testdata/video/video/bin/SymDepend.cache b/libsrc/ffdec_lib/testdata/video/video/bin/SymDepend.cache new file mode 100644 index 000000000..93387b248 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/video/video/bin/SymDepend.cache differ diff --git a/libsrc/ffdec_lib/testdata/video/video/video.xfl b/libsrc/ffdec_lib/testdata/video/video/video.xfl new file mode 100644 index 000000000..860a820ec --- /dev/null +++ b/libsrc/ffdec_lib/testdata/video/video/video.xfl @@ -0,0 +1 @@ +PROXY-CS5 \ No newline at end of file