From 308ac701abcc679ff9cf210cf3f748587b12ea06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 26 Dec 2022 23:41:30 +0100 Subject: [PATCH] Enlarge timeline for soundstream when necessary --- .../flash/tags/base/SoundStreamHeadTypeTag.java | 13 +++++++++++++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 1 + 2 files changed, 14 insertions(+) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java index c9cb90782..513b0aaa0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/SoundStreamHeadTypeTag.java @@ -292,6 +292,19 @@ public abstract class SoundStreamHeadTypeTag extends Tag implements CharacterIdT } } } + + int framesBefore = timelined.getFrameCount(); + //enlarge timeline when necessary + while (!blocks.isEmpty()) { + SoundStreamBlockTag block = blocks.remove(0); + block.setTimelined(timelined); + timelined.addTag(block); + ShowFrameTag sft = new ShowFrameTag(swf); + sft.setTimelined(timelined); + timelined.addTag(sft); + framesBefore++; + } + timelined.setFrameCount(framesBefore); setSoundCompression(newSoundFormat); setSoundSampleCount((int) newSoundSampleCount); setSoundSize(newSoundSize); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 04eaebadc..4292a9243 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -4091,6 +4091,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (!ok) { ViewMessages.showMessageDialog(this, translate("error.sound.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); } else { + refreshTree(((Tag)st).getSwf()); reload(true); } }