I developed a little patch that improves the performance of parsing iso images. Without the patch, a new process for mplayer is launched in "DVDISOTitle" for each track found in "DVDISOFile". As both classes use exactly the command line, I just enhanced DVDISOTitle to be able to receive the result previously read in DVDISOFile.
This improves performance noticeably, at least with tv series dvds.
While the patch is fully runnable, I won't consider it production ready as it adds very tight coupling between both classes. One change in the mplayer command-line in any of those classes might immediately break the other one.
And the performance improvement works only, if no iso thumbnails are to be generated.
Edit: Oh, there is a difference between both command lines.. I have overseen the ""dvd://"+title" at the end of the command line in DVDISOTitle. So this patch is bad. It breaks existing functionality (such as displaying the correct length of the title).
- Code: Select all
Index: net/pms/dlna/DVDISOFile.java
===================================================================
--- net/pms/dlna/DVDISOFile.java (revision 569)
+++ net/pms/dlna/DVDISOFile.java (working copy)
@@ -70,7 +70,7 @@
// The "maybe wrong" title is taken into account only if his length is smaller than 1 hour.
// Common sense is a single video track on a DVD is usually greater than 1h
if (titles[i] > 10 && (titles[i] != oldduration || oldduration < 3600)) {
- DVDISOTitle dvd = new DVDISOTitle(f, i);
+ DVDISOTitle dvd = new DVDISOTitle(f, i, lines);
addChild(dvd);
oldduration = titles[i];
}
Index: net/pms/dlna/DVDISOTitle.java
===================================================================
--- net/pms/dlna/DVDISOTitle.java (revision 569)
+++ net/pms/dlna/DVDISOTitle.java (working copy)
@@ -56,19 +56,25 @@
cmd [10] = "jpeg:outdir=" + frameName;
}
params.log = true;
- final ProcessWrapperImpl pw = new ProcessWrapperImpl(cmd, params, true, false);
- Runnable r = new Runnable() {
- public void run() {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {}
- pw.stopProcess();
- }
- };
- Thread failsafe = new Thread(r);
- failsafe.start();
- pw.run();
- List<String> lines = pw.getOtherResults();
+ List<String> lines = null;
+ if (resolvedIsoFile != null && !PMS.getConfiguration().isDvdIsoThumbnails()){
+ lines = resolvedIsoFile;
+ }
+ else {
+ final ProcessWrapperImpl pw = new ProcessWrapperImpl(cmd, params, true, false);
+ Runnable r = new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {}
+ pw.stopProcess();
+ }
+ };
+ Thread failsafe = new Thread(r);
+ failsafe.start();
+ pw.run();
+ lines = pw.getOtherResults();
+ }
String duration = null;
int nbsectors = 0;
@@ -185,14 +191,20 @@
private File f;
private int title;
private long length;
+ private List<String> resolvedIsoFile;
public long getLength() {
return length;
}
public DVDISOTitle(File f, int title) {
+ this(f, title, null);
+ }
+
+ public DVDISOTitle(File f, int title, List<String> resolvedIsoFile) {
this.f = f;
this.title = title;
+ this.resolvedIsoFile = resolvedIsoFile;
lastmodified = f.lastModified();
}
