@Test public void test() throws Exception { URL pdmlUrl = RtpExtracterTest.class.getResource("sipcall.pdml"); Assert.assertNotNull(pdmlUrl); File[] waveFiles = new File[2]; for (int i=0; i<waveFiles.length; ++i) waveFiles[i] = File.createTempFile(OpusToWaveConverterTest.class.getSimpleName(), ".wav"); try { new OpusToWaveConverter().convert(pdmlUrl, waveFiles, SampleRate.Rate_8Khz, Channels.Mono); new OpusToWaveConverter().convert(pdmlUrl, waveFiles, null, null); } finally { for (int i=0; i<waveFiles.length; ++i) waveFiles[i].delete(); } }
public void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels) throws Exception { if (!waveFileDir.isDirectory()) throw new IllegalArgumentException(); Pdml pdml = new PdmlReader().unmarshall(pdmlUrl); RtpStream[] streams = new RtpExtracter().parse(pdml); for (int i=0; i<streams.length; ++i) { File waveFile = new File(waveFileDir, "rtp-opus-" + (i+1) + ".wav"); decodeOneStream(waveFile, sampleRate, channels, streams[i]); } }
OpusToWaveConverter { public void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels) throws Exception { if (!waveFileDir.isDirectory()) throw new IllegalArgumentException(); Pdml pdml = new PdmlReader().unmarshall(pdmlUrl); RtpStream[] streams = new RtpExtracter().parse(pdml); for (int i=0; i<streams.length; ++i) { File waveFile = new File(waveFileDir, "rtp-opus-" + (i+1) + ".wav"); decodeOneStream(waveFile, sampleRate, channels, streams[i]); } } }
OpusToWaveConverter { public void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels) throws Exception { if (!waveFileDir.isDirectory()) throw new IllegalArgumentException(); Pdml pdml = new PdmlReader().unmarshall(pdmlUrl); RtpStream[] streams = new RtpExtracter().parse(pdml); for (int i=0; i<streams.length; ++i) { File waveFile = new File(waveFileDir, "rtp-opus-" + (i+1) + ".wav"); decodeOneStream(waveFile, sampleRate, channels, streams[i]); } }  }
OpusToWaveConverter { public void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels) throws Exception { if (!waveFileDir.isDirectory()) throw new IllegalArgumentException(); Pdml pdml = new PdmlReader().unmarshall(pdmlUrl); RtpStream[] streams = new RtpExtracter().parse(pdml); for (int i=0; i<streams.length; ++i) { File waveFile = new File(waveFileDir, "rtp-opus-" + (i+1) + ".wav"); decodeOneStream(waveFile, sampleRate, channels, streams[i]); } }  void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels); void convert(URL pdmlUrl, File waveFiles[], SampleRate sampleRate, Channels channels); void convert(OpusDecoder decoder, RtpStream stream, DataOutput outStream); }
OpusToWaveConverter { public void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels) throws Exception { if (!waveFileDir.isDirectory()) throw new IllegalArgumentException(); Pdml pdml = new PdmlReader().unmarshall(pdmlUrl); RtpStream[] streams = new RtpExtracter().parse(pdml); for (int i=0; i<streams.length; ++i) { File waveFile = new File(waveFileDir, "rtp-opus-" + (i+1) + ".wav"); decodeOneStream(waveFile, sampleRate, channels, streams[i]); } }  void convert(URL pdmlUrl, File waveFileDir, SampleRate sampleRate, Channels channels); void convert(URL pdmlUrl, File waveFiles[], SampleRate sampleRate, Channels channels); void convert(OpusDecoder decoder, RtpStream stream, DataOutput outStream);  }