Skip to content

Instantly share code, notes, and snippets.

@JavaDeveloper
Created October 1, 2012 15:27
Show Gist options
  • Save JavaDeveloper/3812503 to your computer and use it in GitHub Desktop.
Save JavaDeveloper/3812503 to your computer and use it in GitHub Desktop.
public class Decoder extends Thread {
private static final String TAG = Decoder.class.getSimpleName();
private AbstractTrackDecoder audioTrackDecoder;
private boolean running = true;
public Decoder(String path) {
audioTrackDecoder = new AudioTrackDecoder(path);
}
@Override
public void run() {
audioTrackDecoder.start();
long startTime = System.nanoTime();
while (running && audioTrackDecoder.hasOutputData) {
long t = (System.nanoTime() - startTime) / 1000;
audioTrackDecoder.systemTime(t);
}
audioTrackDecoder.cleanup();
}
public void terminate() {
running = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment