コード例 #1
0
 public int fetchHeaders(final Info info, final Comment comment, final int[] serialno, Page page) {
   if (page == null) {
     page = new Page();
     final int retValue = this.getNextPage(page, this.m_chunkSize);
     if (retValue == -128) {
       return -128;
     }
     if (retValue < 0) {
       return -130;
     }
   }
   if (serialno != null) {
     serialno[0] = page.serialno();
   }
   this.m_oggStreamState.init(page.serialno());
   info.init();
   comment.init();
   final Packet packet = new Packet();
   int i = 0;
   while (i < 3) {
     this.m_oggStreamState.pagein(page);
     while (i < 3) {
       final int result = this.m_oggStreamState.packetout(packet);
       if (result == 0) {
         break;
       }
       if (result == -1) {
         info.clear();
         this.m_oggStreamState.clear();
         return -1;
       }
       if (info.synthesis_headerin(comment, packet) != 0) {
         info.clear();
         this.m_oggStreamState.clear();
         return -1;
       }
       ++i;
     }
     if (i < 3 && this.getNextPage(page, 1L) < 0) {
       info.clear();
       this.m_oggStreamState.clear();
       return -1;
     }
   }
   return 0;
 }
コード例 #2
0
 @Override
 public void reset() {
   if (!this.m_isReset) {
     if (this.m_vorbisStream.isSeekable()) {
       this.rawSeek(this.m_dataOffsets[0]);
     } else {
       this.m_oggStreamState.clear();
       this.m_block.clear();
       this.m_dspState.clear();
       if (this.m_info != null) {
         for (final Info info : this.m_info) {
           info.clear();
         }
       }
       this.m_oggSyncState.clear();
       try {
         if (this.m_vorbisStream != null) {
           this.m_vorbisStream.reset();
         }
       } catch (Exception e) {
         JOrbisStream.m_logger.error((Object) "Exception", (Throwable) e);
       }
       this.m_links = 0;
       this.m_offset = 0L;
       this.m_offsets = null;
       this.m_dataOffsets = null;
       this.m_serialnos = null;
       this.m_pcmLengths = null;
       this.m_info = null;
       this.m_comments = null;
       this.m_pcmOffset = 0L;
       this.m_decodeReady = false;
       this.m_currentSerialno = 0;
       this.m_currentLink = 0;
       this.initialize(this.m_vorbisStream);
     }
     this.m_isReset = true;
   }
 }
コード例 #3
0
ファイル: VorbisFile.java プロジェクト: hcodename47/open-ig
  /**
   * Uses the local ogg_stream storage in vf; this is important for non-streaming input sources.
   *
   * @param vi the info block
   * @param vc comment block
   * @param serialno serial numbers
   * @param ogPtr ogg pointer page
   * @return success codes OV_*
   */
  int fetchHeaders(Info vi, Comment vc, int[] serialno, Page ogPtr) {
    Page og = new Page();
    Packet op = new Packet();
    int ret;

    if (ogPtr == null) {
      ret = getNextPage(og, CHUNKSIZE);
      if (ret == OV_EREAD) {
        return OV_EREAD;
      }
      if (ret < 0) {
        return OV_ENOTVORBIS;
      }
      ogPtr = og;
    }

    if (serialno != null) {
      serialno[0] = ogPtr.serialno();
    }

    os.init(ogPtr.serialno());

    // extract the initial header from the first page and verify that the
    // Ogg bitstream is in fact Vorbis data

    vi.init();
    vc.init();

    int i = 0;
    while (i < 3) {
      os.pagein(ogPtr);
      while (i < 3) {
        int result = os.packetout(op);
        if (result == 0) {
          break;
        }
        if (result == -1) {
          vi.clear();
          vc.clear();
          os.clear();
          return -1;
        }
        if (vi.synthesisHeaderin(vc, op) != 0) {
          vi.clear();
          vc.clear();
          os.clear();
          return -1;
        }
        i++;
      }
      if (i < 3) {
        if (getNextPage(ogPtr, 1) < 0) {
          vi.clear();
          vc.clear();
          os.clear();
          return -1;
        }
      }
    }
    return 0;
  }