Warning: session_start(): open(/var/lib/php/sessions/sess_2sn1em040agbrrcbep27thf3gs, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// derived from org.gagravarr.opus.OpusFile
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
lib 1400511 // VorbisJava (to unpack ogg file)
lib 1400502 // Concentus 1.0 (to decode OPUS audio in ogg file)
import org.gagravarr.ogg.*;
import org.gagravarr.ogg.audio.*;
import org.gagravarr.opus.*;
sclass OpusFromStream implements OggAudioStream, OggAudioHeaders, Closeable {
OggPacketReader r;
int sid = -1;
OpusInfo info;
OpusTags tags;
*(InputStream in) {
r = new OggPacketReader(in);
}
void initStep {
OggPacket p = null;
// find first packet (info)
if (sid < 0) {
while ((p = r.getNextPacket()) != null) {
if (p.isBeginningOfStream() && p.getData().length > 10) {
if (OpusPacketFactory.isOpusStream(p)) {
sid = p.getSid();
info = (OpusInfo) OpusPacketFactory.create(p);
break;
}
}
}
}
// find second packet (tags)
if (tags == null) {
if ((p = r.getNextPacketWithSid(sid)) != null)
tags = (OpusTags) OpusPacketFactory.create(r.getNextPacketWithSid(sid));
}
}
public OpusAudioData getNextAudioPacket() throws IOException {
OggPacket p = null;
OpusPacket op = null;
while ((p = r.getNextPacketWithSid(sid)) != null) {
op = OpusPacketFactory.create(p);
if (op cast OpusAudioData) ret op;
else
warn("Skipping non audio packet " + op + " mid audio stream");
}
null;
}
/**
* Skips the audio data to the next packet with a granule
* of at least the given granule position.
* Note that skipping backwards is not currently supported!
*/
public void skipToGranule(long granulePosition) throws IOException {
r.skipToGranulePosition(sid, granulePosition);
}
/**
* Returns the Ogg Stream ID
*/
public int getSid() {
ret sid;
}
/**
* This is an Opus file
*/
public OggStreamType getType() {
ret OggStreamIdentifier.OPUS_AUDIO;
}
public OpusInfo getInfo() {
return info;
}
public OpusTags getTags() {
return tags;
}
/**
* Opus doesn't have setup headers, so this is always null
*/
public OggAudioSetupHeader getSetup() {
null;
}
public void close() throws IOException {
dispose r;
dispose ogg;
}
}