コード例 #1
0
 private static long tell(final AudioStreamProvider stream) {
   if (!stream.isSeekable()) {
     return 0L;
   }
   try {
     return stream.tell();
   } catch (IOException e) {
     JOrbisStream.m_logger.debug(
         (Object) "Probl\u00e8me lors du tell sur le stream !", (Throwable) e);
     return 0L;
   }
 }
コード例 #2
0
 @Override
 public boolean initialize(final AudioStreamProvider asp) {
   this.m_vorbisStream = asp;
   try {
     this.m_vorbisStream.openStream();
   } catch (IOException e) {
     JOrbisStream.m_logger.info(
         (Object) ("Probl\u00e8me \u00e0 l'ouverture du stream " + asp.getDescription()));
     try {
       this.m_vorbisStream.close();
     } catch (IOException e2) {
       JOrbisStream.m_logger.info(
           (Object) ("Probl\u00e8me au nettoyage du stream " + asp.getDescription()));
     }
     return false;
   }
   this.m_offset = 0L;
   final boolean reuse = this.m_oggPage != null;
   if (reuse) {
     assert this.m_oggPacket != null
         && this.m_oggSyncState != null
         && this.m_oggStreamState != null
         && this.m_dspState != null
         && this.m_block != null;
     this.m_oggPage.reinit();
     this.m_oggPacket.reinit();
     this.m_oggSyncState.reinit();
     this.m_oggStreamState.reinit();
     this.m_dspState = new DspState();
     this.m_block.init(this.m_dspState);
   } else {
     assert this.m_oggPacket == null
         && this.m_oggSyncState == null
         && this.m_oggStreamState == null
         && this.m_dspState == null
         && this.m_block == null;
     this.m_oggPage = new Page();
     this.m_oggPacket = new Packet();
     this.m_oggSyncState = new SyncState();
     this.m_oggStreamState = new StreamState();
     this.m_dspState = new DspState();
     this.m_block = new Block(this.m_dspState);
   }
   if (asp.isSeekable()) {
     return this.openSeekable();
   }
   return this.openNonSeekable();
 }
コード例 #3
0
 private static int seek(final AudioStreamProvider stream, final long offset, final int type) {
   if (!stream.isSeekable()) {
     return -1;
   }
   try {
     if (type == 0) {
       stream.seek(offset);
     } else if (type == 1) {
       stream.seek(stream.length() - offset);
     }
     return 0;
   } catch (IOException ex) {
     JOrbisStream.m_logger.debug(
         (Object) "Probl\u00e8me lors du seek sur le stream !", (Throwable) ex);
     return -1;
   }
 }