diff --git a/CHANGELOG.md b/CHANGELOG.md index cee4dea4c..400a574da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ### Added - GFX - support for TGA external images - GFX - DefineExternalGradient tag has gradientId in its name -- GFX - DefineExternalSound is character tag +- GFX - DefineExternalSound and DefineExternalStreamSound playback ### Fixed - GFX - DefineExternalImage2 display and correct handling if standalone diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java index 303cd6e0d..62971c9ce 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java @@ -30,6 +30,8 @@ import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.tags.base.SoundTag; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalSound; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.types.sound.SoundExportFormat; import com.jpexs.decompiler.flash.types.sound.SoundFormat; import com.jpexs.helpers.ByteArrayRange; @@ -141,7 +143,7 @@ public class SoundExporter { fos.write(data.getRangeData()); } } else if ((nativeFormat == SoundExportFormat.FLV && mode.hasFlv()) || mode == SoundExportMode.FLV) { - if (st instanceof DefineSoundTag) { + if ((st instanceof DefineSoundTag)||(st instanceof DefineExternalSound)||(st instanceof DefineExternalStreamSound)){ FLVOutputStream flv = new FLVOutputStream(fos); flv.writeHeader(true, false); List datas = st.getRawSoundData(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index c3b454bbf..3927a2bac 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.tags.base.RemoveTag; import com.jpexs.decompiler.flash.tags.base.RenderContext; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.timeline.Timeline; import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.types.BasicType; @@ -369,7 +370,7 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { @Override public void getNeededCharacters(Set needed) { for (Tag t : getTags()) { - if ((t instanceof CharacterIdTag) && !(t instanceof SoundStreamHeadTypeTag)) { + if ((t instanceof CharacterIdTag) && !(t instanceof SoundStreamHeadTypeTag) && !(t instanceof DefineExternalStreamSound)) { needed.add(((CharacterIdTag) t).getCharacterId()); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java index fe286db31..8b0096cf6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHead2Tag.java @@ -171,11 +171,6 @@ public class SoundStreamHead2Tag extends SoundStreamHeadTypeTag { return streamSoundSampleCount; } - @Override - public void setVirtualCharacterId(int ch) { - virtualCharacterId = ch; - } - @Override public int getSoundFormatId() { return streamSoundCompression; @@ -206,7 +201,7 @@ public class SoundStreamHead2Tag extends SoundStreamHeadTypeTag { @Override public boolean importSupported() { - return false; + return true; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java index 41979f74b..6b58f78a5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/SoundStreamHeadTag.java @@ -176,11 +176,6 @@ public class SoundStreamHeadTag extends SoundStreamHeadTypeTag { virtualCharacterId = characterId; } - @Override - public void setVirtualCharacterId(int ch) { - virtualCharacterId = ch; - } - @Override public long getSoundSampleCount() { return streamSoundSampleCount; @@ -216,7 +211,7 @@ public class SoundStreamHeadTag extends SoundStreamHeadTypeTag { @Override public boolean importSupported() { - return false; + return true; } @Override 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 a760835c3..ad709b51a 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 @@ -16,35 +16,11 @@ */ package com.jpexs.decompiler.flash.tags.base; -import com.jpexs.decompiler.flash.ReadOnlyTagList; import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.SWFInputStream; -import com.jpexs.decompiler.flash.SWFOutputStream; -import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag; -import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag; import com.jpexs.decompiler.flash.tags.Tag; -import com.jpexs.decompiler.flash.timeline.Timelined; -import com.jpexs.decompiler.flash.types.sound.MP3FRAME; -import com.jpexs.decompiler.flash.types.sound.MP3SOUNDDATA; -import com.jpexs.decompiler.flash.types.sound.SoundFormat; import com.jpexs.helpers.ByteArrayRange; -import com.jpexs.helpers.Helper; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.UnsupportedAudioFileException; /** * @@ -61,8 +37,6 @@ public abstract class SoundStreamHeadTypeTag extends Tag implements CharacterIdT public abstract long getSoundSampleCount(); - public abstract void setVirtualCharacterId(int ch); - public abstract List getBlocks(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java index c185d6fed..de8588a35 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalSound.java @@ -19,16 +19,31 @@ package com.jpexs.decompiler.flash.tags.gfx; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; -import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; +import com.jpexs.decompiler.flash.tags.base.SoundTag; +import com.jpexs.decompiler.flash.types.sound.SoundExportFormat; +import com.jpexs.decompiler.flash.types.sound.SoundFormat; import com.jpexs.helpers.ByteArrayRange; +import com.jpexs.helpers.Helper; +import java.io.BufferedInputStream; +import java.io.FileInputStream; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.UnsupportedAudioFileException; /** * * @author JPEXS */ -public class DefineExternalSound extends CharacterTag { +public class DefineExternalSound extends CharacterTag implements SoundTag { public static final int ID = 1006; @@ -84,7 +99,7 @@ public class DefineExternalSound extends CharacterTag { super(sis.getSwf(), ID, NAME, data); readData(sis, data, 0, false, false, false); } - + public DefineExternalSound(SWF swf) { super(swf, ID, NAME, null); exportName = ""; @@ -114,4 +129,107 @@ public class DefineExternalSound extends CharacterTag { public void setCharacterId(int characterId) { this.characterId = characterId; } + + @Override + public SoundExportFormat getExportFormat() { + return SoundExportFormat.WAV; //? + } + + @Override + public boolean importSupported() { + return false; + } + + @Override + public int getSoundRate() { + switch ((int) sampleRate) { + case 5512: + return 0; + case 11025: + return 1; + case 22050: + return 2; + case 44100: + return 3; + } + return -1; //? + } + + @Override + public boolean getSoundType() { + return channels == 2; + } + + @Override + public List getRawSoundData() { + List ret = new ArrayList<>(); + Path soundPath = getSwf().getFile() == null ? null : Paths.get(getSwf().getFile()).getParent().resolve(Paths.get(fileName)); + if (soundPath == null || !soundPath.toFile().exists()) { + ret.add(new ByteArrayRange(new byte[]{})); + return ret; + } + try (FileInputStream fis = new FileInputStream(soundPath.toFile()); AudioInputStream audioIs = AudioSystem.getAudioInputStream(new BufferedInputStream(fis))) { + ret.add(new ByteArrayRange(Helper.readStream(audioIs))); + return ret; + } catch (IOException | UnsupportedAudioFileException iex) { + ret.add(new ByteArrayRange(new byte[]{})); + return ret; + } + + } + + @Override + public int getSoundFormatId() { + return SoundFormat.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN; + } + + @Override + public long getTotalSoundSampleCount() { + return sampleCount; + } + + @Override + public boolean getSoundSize() { + return bits == 16; + } + + @Override + public SoundFormat getSoundFormat() { + final int[] rateMap = {5512, 11025, 22050, 44100}; + return new SoundFormat(getSoundFormatId(), rateMap[getSoundRate()], getSoundType()); + } + + @Override + public void setSoundSize(boolean soundSize) { + if (soundSize) { + bits = 16; + } else { + bits = 8; + } + } + + @Override + public void setSoundType(boolean soundType) { + if (soundType) { + channels = 2; + } else { + channels = 1; + } + } + + @Override + public void setSoundSampleCount(long soundSampleCount) { + this.sampleCount = soundSampleCount; + } + + @Override + public void setSoundCompression(int soundCompression) { + //unsupported + } + + @Override + public void setSoundRate(int soundRate) { + final int[] rateMap = {5512, 11025, 22050, 44100}; + this.sampleRate = rateMap[soundRate]; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java index b7203ffff..6ed38eba5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/gfx/DefineExternalStreamSound.java @@ -20,14 +20,29 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.Tag; +import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; +import com.jpexs.decompiler.flash.tags.base.SoundTag; +import com.jpexs.decompiler.flash.types.annotations.Internal; +import com.jpexs.decompiler.flash.types.sound.SoundExportFormat; +import com.jpexs.decompiler.flash.types.sound.SoundFormat; import com.jpexs.helpers.ByteArrayRange; +import com.jpexs.helpers.Helper; +import java.io.BufferedInputStream; +import java.io.FileInputStream; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.UnsupportedAudioFileException; /** * * @author JPEXS */ -public class DefineExternalStreamSound extends Tag { +public class DefineExternalStreamSound extends Tag implements CharacterIdTag, SoundTag { public static final int ID = 1007; @@ -52,6 +67,9 @@ public class DefineExternalStreamSound extends Tag { public String fileName; public static final int SOUND_FORMAT_WAV = 0; + + @Internal + private int virtualCharacterId = 0; /** * Gets data bytes @@ -103,4 +121,127 @@ public class DefineExternalStreamSound extends Tag { lastFrame = sis.readUI32("lastFrame"); fileName = sis.readNetString("fileName"); } + + @Override + public SoundExportFormat getExportFormat() { + return SoundExportFormat.WAV; //? + } + + @Override + public boolean importSupported() { + return false; + } + + @Override + public int getSoundRate() { + switch ((int) sampleRate) { + case 5512: + return 0; + case 11025: + return 1; + case 22050: + return 2; + case 44100: + return 3; + } + return -1; //? + } + + @Override + public boolean getSoundType() { + return channels == 2; + } + + @Override + public List getRawSoundData() { + List ret = new ArrayList<>(); + Path soundPath = getSwf().getFile() == null ? null : Paths.get(getSwf().getFile()).getParent().resolve(Paths.get(fileName)); + if (soundPath == null || !soundPath.toFile().exists()) { + ret.add(new ByteArrayRange(new byte[]{})); + return ret; + } + try (FileInputStream fis = new FileInputStream(soundPath.toFile()); AudioInputStream audioIs = AudioSystem.getAudioInputStream(new BufferedInputStream(fis))) { + ret.add(new ByteArrayRange(Helper.readStream(audioIs))); + return ret; + } catch (IOException | UnsupportedAudioFileException iex) { + ret.add(new ByteArrayRange(new byte[]{})); + return ret; + } + + } + + @Override + public int getSoundFormatId() { + return SoundFormat.FORMAT_UNCOMPRESSED_LITTLE_ENDIAN; + } + + @Override + public long getTotalSoundSampleCount() { + return sampleCount; + } + + @Override + public boolean getSoundSize() { + return bits == 16; + } + + @Override + public SoundFormat getSoundFormat() { + final int[] rateMap = {5512, 11025, 22050, 44100}; + return new SoundFormat(getSoundFormatId(), rateMap[getSoundRate()], getSoundType()); + } + + @Override + public void setSoundSize(boolean soundSize) { + if (soundSize) { + bits = 16; + } else { + bits = 8; + } + } + + @Override + public void setSoundType(boolean soundType) { + if (soundType) { + channels = 2; + } else { + channels = 1; + } + } + + @Override + public void setSoundSampleCount(long soundSampleCount) { + this.sampleCount = soundSampleCount; + } + + @Override + public void setSoundCompression(int soundCompression) { + //unsupported + } + + @Override + public void setSoundRate(int soundRate) { + final int[] rateMap = {5512, 11025, 22050, 44100}; + this.sampleRate = rateMap[soundRate]; + } + + @Override + public int getCharacterId() { + return this.virtualCharacterId; + } + + @Override + public void setCharacterId(int characterId) { + this.virtualCharacterId = characterId; + } + + @Override + public String getCharacterExportFileName() { + return "" + getCharacterId(); + } + + @Override + public String toString() { + return getName() + (virtualCharacterId > 0 ? " (" + virtualCharacterId + ")" : ""); + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index c74df06ee..65872d236 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -52,6 +52,7 @@ import com.jpexs.decompiler.flash.tags.base.RenderContext; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.tags.base.TextTag; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.types.BlendMode; import com.jpexs.decompiler.flash.types.CLIPACTIONS; import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA; @@ -565,11 +566,16 @@ public class Timeline { for (Tag t : tags) { if (t instanceof SoundStreamHeadTypeTag) { SoundStreamHeadTypeTag head = (SoundStreamHeadTypeTag) t; - head.setVirtualCharacterId(containerId); + head.setCharacterId(containerId); blocks = new ArrayList<>(); soundStramBlocks.put(containerId, blocks); continue; } + if (t instanceof DefineExternalStreamSound) { + DefineExternalStreamSound externalStream = (DefineExternalStreamSound) t; + externalStream.setCharacterId(containerId); + continue; + } if (t instanceof DefineSpriteTag) { DefineSpriteTag sprite = (DefineSpriteTag) t; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 148e64fd6..03a87dc40 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1118,7 +1118,7 @@ public class XFLConverter { private static HashMap getCharacters(ReadOnlyTagList tags) { HashMap ret = new HashMap<>(); - int maxId = 0; + /*int maxId = 0; for (Tag t : tags) { if (t instanceof CharacterTag) { CharacterTag ct = (CharacterTag) t; @@ -1126,12 +1126,12 @@ public class XFLConverter { maxId = ct.getCharacterId(); } } - } + }*/ for (Tag t : tags) { - if (t instanceof SoundStreamHeadTypeTag) { + /*if (t instanceof SoundStreamHeadTypeTag) { SoundStreamHeadTypeTag ssh = (SoundStreamHeadTypeTag) t; - ssh.setVirtualCharacterId(++maxId); - } + ssh.setCharacterId(++maxId); + }*/ if (t instanceof CharacterTag) { CharacterTag ct = (CharacterTag) t; ret.put(ct.getCharacterId(), ct); diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 1bb0a5098..2512b3981 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -2246,7 +2246,6 @@ public final class ImagePanel extends JPanel implements MediaDisplay { } updatingScrollBars = true; double zoomDouble = ImagePanel.this.zoom.fit ? getZoomToFit() : ImagePanel.this.zoom.value; - RECT timRect = timelined.getRect(); updateScrollBarMinMax(); //horizontalScrollBar.setVisible(horizontalScrollBar.getVisibleAmount() < horizontalScrollBar.getMaximum() - horizontalScrollBar.getMinimum()); //verticalScrollBar.setVisible(verticalScrollBar.getVisibleAmount() < verticalScrollBar.getMaximum() - verticalScrollBar.getMinimum()); @@ -2266,7 +2265,6 @@ public final class ImagePanel extends JPanel implements MediaDisplay { return; } updatingScrollBars = true; - RECT timRect = timelined.getRect(); double zoomDouble = ImagePanel.this.zoom.fit ? getZoomToFit() : ImagePanel.this.zoom.value; updateScrollBarMinMax(); //horizontalScrollBar.setVisible(horizontalScrollBar.getVisibleAmount() < horizontalScrollBar.getMaximum() - horizontalScrollBar.getMinimum()); @@ -2407,6 +2405,11 @@ public final class ImagePanel extends JPanel implements MediaDisplay { private void updateScrollBarMinMax() { + if (timelined == null) { + horizontalScrollBar.setVisible(false); + verticalScrollBar.setVisible(false); + return; + } RECT timRect = timelined.getRect(); /* diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 9d756d6bd..0d6c5880e 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -182,6 +182,7 @@ import com.jpexs.decompiler.flash.tags.base.TextImportErrorHandler; import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.base.UnsupportedSamplingRateException; import com.jpexs.decompiler.flash.tags.gfx.DefineExternalImage2; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.tags.gfx.DefineSubImage; import com.jpexs.decompiler.flash.tags.text.TextParseException; import com.jpexs.decompiler.flash.timeline.DepthState; @@ -4941,7 +4942,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se previewPanel.showImagePanel(timelinedContainer, swf, frame, true, Configuration.autoPlayPreviews.get(), !Configuration.animateSubsprites.get(), false, !Configuration.playFrameSounds.get(), true, false); } else if ((treeItem instanceof SoundTag)) { //&& isInternalFlashViewerSelected() && (Arrays.asList("mp3", "wav").contains(((SoundTag) tagObj).getExportFormat())))) { previewPanel.showImagePanel(new SerializableImage(View.loadImage("sound32"))); - previewPanel.setImageReplaceButtonVisible(false, false, false, !((Tag) treeItem).isReadOnly() && (treeItem instanceof SoundTag), false, false); + previewPanel.setImageReplaceButtonVisible(false, false, false, !((Tag) treeItem).isReadOnly() && ((SoundTag)treeItem).importSupported(), false, false); try { SoundTagPlayer soundThread = new SoundTagPlayer(null, (SoundTag) treeItem, Configuration.loopMedia.get() ? Integer.MAX_VALUE : 1, true); if (!Configuration.autoPlaySounds.get()) { @@ -5681,7 +5682,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se List tags = tim.getTags().toArrayList(); Map> nestedTags = new HashMap<>(); for (Tag t : tags) { - if ((t instanceof CharacterIdTag) && !(t instanceof CharacterTag) && !(t instanceof SoundStreamHeadTypeTag)) { + if ((t instanceof CharacterIdTag) && !(t instanceof CharacterTag) && !(t instanceof SoundStreamHeadTypeTag) && !(t instanceof DefineExternalStreamSound)) { int characterId = ((CharacterIdTag) t).getCharacterId(); if (!nestedTags.containsKey(characterId)) { nestedTags.put(characterId, new ArrayList<>()); @@ -5689,7 +5690,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se nestedTags.get(characterId).add((CharacterIdTag) t); } - if (!(t instanceof CharacterTag) && !(t instanceof SoundStreamHeadTypeTag)) { + if (!(t instanceof CharacterTag) && !(t instanceof SoundStreamHeadTypeTag) && !(t instanceof DefineExternalStreamSound)) { int characterId = -1; if (t instanceof CharacterIdTag) { characterId = ((CharacterIdTag) t).getCharacterId(); diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java index 7c94166d3..48d900998 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/AbstractTagTree.java @@ -82,6 +82,8 @@ import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.base.SymbolClassTypeTag; import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalSound; +import com.jpexs.decompiler.flash.tags.gfx.DefineExternalStreamSound; import com.jpexs.decompiler.flash.timeline.AS2Package; import com.jpexs.decompiler.flash.timeline.AS3Package; import com.jpexs.decompiler.flash.timeline.Frame; @@ -280,7 +282,11 @@ public abstract class AbstractTagTree extends JTree { return TreeNodeType.MOVIE; } - if ((t instanceof DefineSoundTag) || (t instanceof SoundStreamHeadTag) || (t instanceof SoundStreamHead2Tag)) { + if ((t instanceof DefineSoundTag) || + (t instanceof SoundStreamHeadTag) || + (t instanceof SoundStreamHead2Tag) || + (t instanceof DefineExternalSound) || + (t instanceof DefineExternalStreamSound)) { return TreeNodeType.SOUND; }