srinivasmohan / android-daisy-epub-reader

Automatically exported from code.google.com/p/android-daisy-epub-reader
0 stars 0 forks source link

Flaws in current algorithm for navigating the contents of a SMIL file in the new design #60

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run ProcessExternalSmilFile with 
files-used-for-testing\testfiles\singleEntry.smil

What is the expected output? 
  I'd expect a single audio segment to be 'played'.

What do you see instead?
  The audio is not processed.

I need to reconsider the algorithm on how to process the contents of any given 
smil file. This test file was deceptively simple, yet sufficient to expose the 
problem.

Here is the current algorithm (from ProcessExternalSmilFile.java in r472). 

    for (Part part : section.getParts()) {
      for (int j = 0; j < part.getSnippets().size(); j++) {

        String text = part.getSnippets().get(j).getText();
        String id = part.getSnippets().get(j).getId();

        if (part.getAudioElements().size() > 0) {
          Audio audio = part.getAudioElements().get(0);
          double duration = audio.getClipEnd() - audio.getClipBegin();
          System.out.printf(" [%s]: %s < Show text for %f seconds => %s\n", 
              id, 
              audio.getAudioFilename(), 
              duration, 
              text);
          controller.playFileSegment(audio);
        } else {
          System.out.printf(" [%s]: => %s", id, text);
    }
  }
}

Original issue reported on code.google.com by julianharty on 12 May 2012 at 2:39