From 2b8a3352dacd4762085aa36c48b5314d09e85449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 24 Nov 2025 21:30:22 +0100 Subject: [PATCH] Fixed: #2570 ClassCastException on exporting sound head (export all command) --- CHANGELOG.md | 3 ++- .../com/jpexs/decompiler/flash/exporters/SoundExporter.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f203e52a..95742dba9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Fixed -- [#2570] Nullpointer on SVG export of DefineEditText +- [#2570] NullpointerException on SVG export of DefineEditText +- [#2570] ClassCastException on exporting sound head (export all command) ## [24.1.1] - 2025-11-17 ### Added 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 3b6716ad9..9ec34f538 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 @@ -176,22 +176,24 @@ public class SoundExporter { flv.writeTag(new FLVTAG(0, new AUDIODATA(st.getSoundFormatId(), st.getSoundRate(), st.getSoundSize(), st.getSoundType(), data.getRangeData()))); } } else if ((st instanceof SoundStreamFrameRange) || (st instanceof SoundStreamHeadTypeTag)) { + float frameRate; List blocks; if (st instanceof SoundStreamHeadTypeTag) { + frameRate = ((SoundStreamHeadTypeTag) st).getSwf().frameRate; blocks = new ArrayList<>(); SoundStreamHeadTypeTag head = (SoundStreamHeadTypeTag) st; for (SoundStreamFrameRange range : head.getRanges()) { blocks.addAll(range.blocks); } } else { + frameRate = ((SoundStreamFrameRange) st).getSwf().frameRate; blocks = ((SoundStreamFrameRange) st).blocks; } - SoundStreamFrameRange sh = (SoundStreamFrameRange) st; FLVOutputStream flv = new FLVOutputStream(fos); flv.writeHeader(true, false); - int ms = (int) (1000.0 / sh.getSwf().frameRate); + int ms = (int) (1000.0 / frameRate); for (int b = 0; b < blocks.size(); b++) { byte[] data = blocks.get(b).streamSoundData.getRangeData(); if (st.getSoundFormatId() == 2) { //MP3