调研通 v3.0.3版本的 MD5 值为:fe075d21227d488bdb9f6aa09d3b3f35
以下内容为反编译后的 a.java 源代码,内容仅作参考
package c.e.a.o.n.w;
import c.e.a.o.d;
import com.xiaomi.mipush.sdk.Constants;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class a {
public static final String f617b = "http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt";
public static final String f618c = "http://www.w3.org/ns/ttml";
static byte[] f616a = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n <xsl:output method=\"text\"/>\n <xsl:key name=\"kElemByNSURI\"\n match=\"*[namespace::*[not(. = ../../namespace::*)]]\"\n use=\"namespace::*[not(. = ../../namespace::*)]\"/>\n <xsl:template match=\"/\">\n <xsl:for-each select=\n \"//namespace::*[not(. = ../../namespace::*)]\n [count(..|key('kElemByNSURI',.)[1])=1]\">\n <xsl:value-of select=\"concat(.,'
')\"/>\n </xsl:for-each>\n </xsl:template>\n</xsl:stylesheet>".getBytes();
public static final NamespaceContext f619d = new b(null);
private static class b implements NamespaceContext {
private b() {
}
@Override
public String getNamespaceURI(String str) {
if (str.equals("ttml")) {
return a.f618c;
}
if (str.equals("smpte")) {
return a.f617b;
}
return null;
}
@Override
public String getPrefix(String str) {
if (str.equals(a.f618c)) {
return "ttml";
}
if (str.equals(a.f617b)) {
return "smpte";
}
return null;
}
@Override
public Iterator getPrefixes(String str) {
return Arrays.asList("ttml", "smpte").iterator();
}
b(b bVar) {
this();
}
}
private static long a(InputStream inputStream, File file) throws IOException {
byte[] bArr = new byte[16384];
file.getParentFile().mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(file);
long j = 0;
while (true) {
try {
int read = inputStream.read(bArr);
if (-1 == read) {
return j;
}
fileOutputStream.write(bArr, 0, read);
j += read;
} finally {
fileOutputStream.close();
}
}
}
public static void b(Document document, File file) throws IOException {
try {
NodeList nodeList = (NodeList) XPathFactory.newInstance().newXPath().compile("//*/@backgroundImage").evaluate(document, XPathConstants.NODESET);
for (int i = 0; i < nodeList.getLength(); i++) {
URI create = URI.create(nodeList.item(i).getNodeValue());
if (!create.isAbsolute()) {
a(new URI(document.getDocumentURI()).resolve(create).toURL().openStream(), new File(file.toURI().resolve(create).toURL().getFile()));
}
}
a(new URI(document.getDocumentURI()).toURL().openStream(), file);
} catch (URISyntaxException e2) {
throw new IOException(e2);
} catch (XPathExpressionException e3) {
throw new IOException(e3);
}
}
public static String[] c(Document document) {
try {
Transformer newTransformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new ByteArrayInputStream(f616a)));
StringWriter stringWriter = new StringWriter();
newTransformer.transform(new DOMSource(document), new StreamResult(stringWriter));
ArrayList arrayList = new ArrayList(new LinkedHashSet(Arrays.asList(stringWriter.getBuffer().toString().split("\n"))));
return (String[]) arrayList.toArray(new String[arrayList.size()]);
} catch (TransformerConfigurationException e2) {
throw new RuntimeException(e2);
} catch (TransformerException e3) {
throw new RuntimeException(e3);
}
}
public static long d(Node node) {
long j = 0;
Node node2 = node;
while (true) {
node2 = node2.getParentNode();
if (node2 == null) {
break;
}
if (node2.getAttributes() != null && node2.getAttributes().getNamedItem("begin") != null) {
j += h(node2.getAttributes().getNamedItem("begin").getNodeValue());
}
}
return (node.getAttributes() == null || node.getAttributes().getNamedItem("end") == null) ? j : j + h(node.getAttributes().getNamedItem("end").getNodeValue());
}
public static long e(Node node) {
long j = 0;
Node node2 = node;
while (true) {
node2 = node2.getParentNode();
if (node2 == null) {
break;
}
if (node2.getAttributes() != null && node2.getAttributes().getNamedItem("begin") != null) {
j += h(node2.getAttributes().getNamedItem("begin").getNodeValue());
}
}
return (node.getAttributes() == null || node.getAttributes().getNamedItem("begin") == null) ? j : j + h(node.getAttributes().getNamedItem("begin").getNodeValue());
}
public static void f(String[] strArr) throws URISyntaxException, ParserConfigurationException, IOException, SAXException, XPathExpressionException, TransformerException {
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
newInstance.setNamespaceAware(true);
c cVar = new c("a.xml", c.e.a.o.n.w.b.e(newInstance.newDocumentBuilder().parse("C:\\dev\\mp4parser\\a.xml"), 60));
d dVar = new d();
dVar.a(cVar);
new c.e.a.o.k.b().a(dVar).m(new FileOutputStream("output.mp4").getChannel());
}
public static void g(Document document, OutputStream outputStream, int i) throws IOException {
try {
Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
newTransformer.setOutputProperty("encoding", "UTF-8");
if (i > 0) {
newTransformer.setOutputProperty("indent", "yes");
newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(i));
}
try {
newTransformer.transform(new DOMSource(document), new StreamResult(outputStream));
} catch (TransformerException e2) {
throw new IOException(e2);
}
} catch (TransformerConfigurationException e3) {
throw new RuntimeException(e3);
}
}
public static long h(String str) {
long parseDouble;
Matcher matcher = Pattern.compile("(-?)([0-9][0-9]):([0-9][0-9]):([0-9][0-9])([\\.:][0-9][0-9]?[0-9]?)?").matcher(str);
if (matcher.matches()) {
String group2 = matcher.group(1);
String group3 = matcher.group(2);
String group4 = matcher.group(3);
String group5 = matcher.group(4);
String group6 = matcher.group(5);
if (group6 == null) {
group6 = ".000";
}
String replace = group6.replace(Constants.COLON_SEPARATOR, ".");
long parseLong = (Long.parseLong(group3) * 60 * 60 * 1000) + (Long.parseLong(group4) * 60 * 1000) + (Long.parseLong(group5) * 1000);
if (replace.contains(Constants.COLON_SEPARATOR)) {
parseDouble = (long) (parseLong + (Double.parseDouble("0" + replace.replace(Constants.COLON_SEPARATOR, ".")) * 40.0d * 1000.0d));
} else {
parseDouble = (long) (parseLong + (Double.parseDouble("0" + replace) * 1000.0d));
}
return parseDouble * (Constants.ACCEPT_TIME_SEPARATOR_SERVER.equals(group2) ? -1 : 1);
}
throw new RuntimeException("Cannot match '" + str + "' to time expression");
}
public static String i(long j) {
return j(j, -1);
}
public static String j(long j, int i) {
String str = j >= 0 ? "" : Constants.ACCEPT_TIME_SEPARATOR_SERVER;
long abs = Math.abs(j);
long j2 = ((abs / 1000) / 60) / 60;
long j3 = abs - (((j2 * 1000) * 60) * 60);
long j4 = (j3 / 1000) / 60;
long j5 = j3 - ((j4 * 1000) * 60);
long j6 = j5 / 1000;
return i >= 0 ? String.format("%s%02d:%02d:%02d:%d", str, Long.valueOf(j2), Long.valueOf(j4), Long.valueOf(j6), Integer.valueOf(i)) : String.format("%s%02d:%02d:%02d.%03d", str, Long.valueOf(j2), Long.valueOf(j4), Long.valueOf(j6), Long.valueOf(j5 - (1000 * j6)));
}
}