Examples of FLVReader


Examples of org.red5.io.flv.impl.FLVReader

  @Test
  public void testFLVReaderFileWithPreProcessInfo() {
    File file = new File("target/test-classes/fixtures/131647.flv");
    //File file = new File("target/test-classes/fixtures/test.flv");
    try {
      FLVReader reader = new FLVReader(file, true);
      KeyFrameMeta meta = reader.analyzeKeyFrames();
      log.debug("Meta: {}", meta);
      ITag tag = null;
      for (int t = 0; t < 6; t++) {
        tag = reader.readTag();
        log.debug("Tag: {}", tag);
      }
      reader.close();
      log.info("----------------------------------------------------------------------------------");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.red5.io.flv.impl.FLVReader

  public void testFLVReaderFile() {
    File[] files = new File[] { new File("target/test-classes/fixtures/h264_aac.flv"), new File("target/test-classes/fixtures/h264_mp3.flv"),
        new File("target/test-classes/fixtures/h264_speex.flv") };
    try {
      for (File file : files) {
        FLVReader reader = new FLVReader(file, true);

        KeyFrameMeta meta = reader.analyzeKeyFrames();
        log.debug("Meta: {}", meta);

        ITag tag = null;
        for (int t = 0; t < 6; t++) {
          tag = reader.readTag();
          log.debug("Tag: {}", tag);
        }
        reader.close();
        log.info("----------------------------------------------------------------------------------");
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.red5.io.flv.impl.FLVReader

   * {@inheritDoc}
   */
  public void write(IMetaData meta) throws IOException {
    // Get cue points, FLV reader and writer
    IMetaCue[] metaArr = meta.getMetaCue();
    FLVReader reader = new FLVReader(file, false);
    FLVWriter writer = new FLVWriter(fos, false);
    ITag tag = null;

    // Read first tag
    if (reader.hasMoreTags()) {
      tag = reader.readTag();
      if (tag.getDataType() == IoConstants.TYPE_METADATA) {
        if (!reader.hasMoreTags())
          throw new IOException(
              "File we're writing is metadata only?");
      }
    }

    meta.setDuration(((double) reader.getDuration() / 1000));
    meta.setVideoCodecId(reader.getVideoCodecId());
    meta.setAudioCodecId(reader.getAudioCodecId());

    ITag injectedTag = injectMetaData(meta, tag);
    injectedTag.setPreviousTagSize(0);
    tag.setPreviousTagSize(injectedTag.getBodySize());

    writer.writeHeader();
    writer.writeTag(injectedTag);
    writer.writeTag(tag);

    int cuePointTimeStamp = 0;
    int counter = 0;

    if (metaArr != null) {
      Arrays.sort(metaArr);
      cuePointTimeStamp = getTimeInMilliseconds(metaArr[0]);
    }

    while (reader.hasMoreTags()) {
      tag = reader.readTag();

      // if there are cuePoints in the array
      if (counter < metaArr.length) {

        // If the tag has a greater timestamp than the
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.