mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 02:20:44 +00:00
Added: Importing sound stream block ranges
Added: Commandline replacing sound stream block ranges
This commit is contained in:
@@ -3001,7 +3001,7 @@ public class CommandLineArgumentParser {
|
||||
try (StdInAwareFileInputStream is = new StdInAwareFileInputStream(inFile)) {
|
||||
SWF swf = new SWF(is, Configuration.parallelSpeedUp.get(), charset);
|
||||
while (true) {
|
||||
String objectToReplace = args.pop();
|
||||
String objectToReplace = args.pop();
|
||||
|
||||
if (objectToReplace.matches("\\d+")) {
|
||||
// replace character tag
|
||||
@@ -3104,10 +3104,29 @@ public class CommandLineArgumentParser {
|
||||
}).importText(textTag, new String(data, Utf8Helper.charset));
|
||||
} else if (characterTag instanceof SoundTag) {
|
||||
SoundTag st = (SoundTag) characterTag;
|
||||
Integer startFrame = null;
|
||||
if (!args.isEmpty()) {
|
||||
if (args.peek().toLowerCase(Locale.ENGLISH).equals("-startframe")) {
|
||||
args.pop();
|
||||
if (args.isEmpty()) {
|
||||
System.err.println("Frame number must be specified");
|
||||
badArguments("replace");
|
||||
}
|
||||
try {
|
||||
startFrame = Integer.parseInt(args.pop());
|
||||
} catch (NumberFormatException nfe) {
|
||||
System.err.println("Frame number should be integer");
|
||||
badArguments("replace");
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean ok = false;
|
||||
SoundImporter soundImporter = new SoundImporter();
|
||||
try {
|
||||
ok = soundImporter.importSound(st, new ByteArrayInputStream(data), soundFormat);
|
||||
ok = soundImporter.importSound(st, new ByteArrayInputStream(data), soundFormat, startFrame);
|
||||
} catch (SoundParametersMismatchException spm) {
|
||||
System.err.println("Import FAILED. " + spm.getMessage());
|
||||
System.exit(3);
|
||||
} catch (UnsupportedSamplingRateException usre) {
|
||||
List<String> supportedRatesStr = new ArrayList<>();
|
||||
for (int i : usre.getSupportedRates()) {
|
||||
|
||||
@@ -98,18 +98,21 @@ alias /?
|
||||
Convert FlashPaper SWF file <infile> to PDF <outfile>.
|
||||
Use -zoom parameter to specify image quality.
|
||||
|
||||
-replace <infile> <outfile> (<characterId1>|<scriptName1>) <importDataFile1> \
|
||||
[nofill] ([<format1>][<methodBodyIndex1>]) \
|
||||
[(<characterId2>|<scriptName2>) <importDataFile2> \
|
||||
[nofill] ([<format2>][<methodBodyIndex2>])]...
|
||||
-replace <infile> <outfile> \
|
||||
(<characterId1>|<scriptName1>) <importDataFile1> \
|
||||
[nofill] [-startFrame <startFrame>] ([<format1>][<methodBodyIndex1>]) \
|
||||
[(<characterId2>|<scriptName2>) <importDataFile2> \
|
||||
[nofill] [-startFrame <startFrame>] ([<format2>][<methodBodyIndex2>])]...
|
||||
Replace data.
|
||||
Replaces the data of the specified BinaryData, Image, Shape, Text,
|
||||
Sound tag or Script.
|
||||
nofill parameter can be specified only for shape replace.
|
||||
<startFrame> parameter sets sound range start frame (for sound streams)
|
||||
<format> parameter can be specified for Image and Shape tags.
|
||||
valid formats: lossless, lossless2, jpeg2, jpeg3, jpeg4.
|
||||
<methodBodyIndexN> parameter should be specified if and only if the imported entity is an AS3 P-Code.
|
||||
Use -1 as characterId to replace main timeline SoundStreamHead.
|
||||
|
||||
-replace <infile> <outfile> <argsfile>
|
||||
Replace data using argsfile.
|
||||
Same as -replace command, but the rest of arguments is read as lines from
|
||||
|
||||
@@ -5175,7 +5175,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
boolean ok = false;
|
||||
try {
|
||||
ok = soundImporter.importSound(st, new FileInputStream(selfile), soundFormat);
|
||||
ok = soundImporter.importSound(st, new FileInputStream(selfile), soundFormat, null);
|
||||
((SWF) ((TreeItem) st).getOpenable()).clearSoundCache();
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
|
||||
Reference in New Issue
Block a user