Package org.red5.io.flv

Examples of org.red5.io.flv.IFLV


     */
  private void writeMetadataTag(double duration, Integer videoCodecId, Integer audioCodecId) throws IOException {
    metaPosition = channel.position();
    IoBuffer buf = IoBuffer.allocate(1024);
    buf.setAutoExpand(true);
    Output out = new Output(buf);
    out.writeString("onMetaData");
    Map<Object, Object> params = new HashMap<Object, Object>(4);
    params.put("duration", duration);
    if (videoCodecId != null) {
      params.put("videocodecid", videoCodecId.intValue());
    }
    if (audioCodecId != null) {
      params.put("audiocodecid", audioCodecId.intValue());
    }
    params.put("canSeekToEnd", true);
    out.writeMap(params, new Serializer());
    buf.flip();

    if (fileMetaSize == 0) {
      fileMetaSize = buf.limit();
    }
View Full Code Here


   *
   * @throws IOException      Any I/O exception
   */
  public void writeHeader() throws IOException {
    //Header fields (in same order than spec, for comparison purposes)
    FLVHeader flvHeader = new FLVHeader();
    flvHeader.setSignature("FLV".getBytes());
    flvHeader.setVersion ((byte)0x01);
    flvHeader.setFlagReserved01 ((byte) 0x0);
    flvHeader.setFlagAudio (true);
    flvHeader.setFlagReserved02 ((byte) 0x0);
    flvHeader.setFlagVideo (true);
    flvHeader.write(out);
   
    //Dump header to output channel
    channel.write(out.buf());
  }
View Full Code Here

    }
    // Create new file
    f.createNewFile();

    // Use service to grab FLV file
    IFLV flv = (IFLV) service.getStreamableFile(f);

    // Grab a writer for writing a new FLV
    ITagWriter writer = flv.getWriter();

    // Create a reader for testing
    File readfile = new File(path);
    //assertTrue(readfile.exists());

    IFLV readflv = (IFLV) service.getStreamableFile(readfile);
    readflv.setCache(NoCacheImpl.getInstance());

    // Grab a reader for reading a FLV in
    ITagReader reader = readflv.getReader();

    // Inject MetaData
    writeTagsWithInjection(reader, writer);

  }
View Full Code Here

    }
    // Create new file
    f.createNewFile();

    // Use service to grab FLV file
    IFLV flv = (IFLV) service.getStreamableFile(f);

    // Grab a writer for writing a new FLV
    ITagWriter writer = flv.getWriter();

    // Create a reader for testing
    File readfile = new File(path);
    IFLV readflv = (IFLV) service.getStreamableFile(readfile);
    readflv.setCache(NoCacheImpl.getInstance());

    // Grab a reader for reading a FLV in
    ITagReader reader = readflv.getReader();

    // Inject MetaData
    writeTagsWithInjection(reader, writer);

  }
View Full Code Here

      System.out.println("Path: " + f.getAbsolutePath());
    }       
    // Get MetaData to embed
    MetaData<?, ?> meta = createMeta();
    // Read in a FLV file for reading tags
    IFLV flv = (IFLV) service.getStreamableFile(f);
    flv.setCache(NoCacheImpl.getInstance());
    // set the MetaService
    flv.setMetaService(metaService);
    // set the MetaData
    flv.setMetaData(meta);
  }
View Full Code Here

   * @throws FileNotFoundException if file not found
   */
  public void testFLVFile() throws FileNotFoundException, IOException {
    File f = new File("target/test-classes/fixtures/test.flv");
    System.out.println("test: " + f);
    IFLV flv = (IFLV) service.getStreamableFile(f);
    flv.setCache(NoCacheImpl.getInstance());
    System.out.println("test: " + flv);
    ITagReader reader = flv.getReader();
    System.out.println("test: " + reader);
    ITag tag = null;
    System.out.println("test: " + reader.hasMoreTags());
    while (reader.hasMoreTags()) {
      tag = reader.readTag();
View Full Code Here

    if (writer != null && !this.isClosed) {
      try {
       
        log.debug("#################### -start- closeStream ########################");
        log.debug("#################### -start- closeStream ########################");
        FLVWriter flvWriter = (FLVWriter) writer;
        //log.debug("duration: "+flvWriter.getDuration());
        //log.debug(writer.getClass().getName());
       
        writer.close();
       
View Full Code Here

       
        int timeStamp = streampacket.getTimestamp();
       
        timeStamp -= startTimeStamp;
       
              ITag tag = new Tag();
              tag.setDataType(streampacket.getDataType());
             
              //log.debug("data.limit() :: "+data.limit());
        tag.setBodySize(data.limit());
        tag.setTimestamp(timeStamp);
        tag.setBody(data);
       
       
        if (this.isInterview) {
          if (timeStamp <= 500) {
            //We will cut the first 0.5 seconds
View Full Code Here

    if (fileMetaSize == 0) {
      fileMetaSize = buf.limit();
    }

    ITag onMetaData = new Tag(ITag.TYPE_METADATA, 0, fileMetaSize, buf, 0);
    writeTag(onMetaData);
  }
View Full Code Here

         
          FlvRecordingMetaDeltaDaoImpl.getInstance().addFlvRecordingMetaDelta(flvRecordingMetaDelta);
         
        }
       
              ITag tag = new Tag();
              tag.setDataType(streampacket.getDataType());
             
              //log.debug("data.limit() :: "+data.limit());
        tag.setBodySize(data.limit());
        tag.setTimestamp(timeStamp);
        tag.setBody(data);
       
        writer.writeTag(tag);
     
      }
     
View Full Code Here

TOP

Related Classes of org.red5.io.flv.IFLV

Copyright © 2018 www.massapicom. 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.