Package com.itstherules.tags

Examples of com.itstherules.tags.FlvTag


        metaTag = new MetaTag(ioHelper);
        if (!metaTag.getEvent().equals("onMetaData")) continue;
        found = true;
        break;
      }
      new FlvTag(ioHelper);
    } while (true);
  }
View Full Code Here


  }
 
  public void writeTags() {
    BufferHelper bufh = new BufferHelper();
    ByteHelper bh = new ByteHelper();
    FlvTag tmpFlvt = null;
    int fpos = 0;
    byte buf[] = null;
    byte type[] = null;
    byte dsize[] = null;
    byte tstamp[] = null;
    byte prevTagSize[] = null;
    byte ender[] = bh.getUintBytes(0, 4);
    try {
      stream.open();
    } catch (Exception ex) {
      System.out.println("Error - unable to open specified output file");
      if (debug) ex.printStackTrace();
      return;
    }
    stream.write(bufh.byte2buffer(flvh.getFlvHeaderBytes()));
    stream.write(bufh.byte2buffer(ender));
    stream.setInputStream(inStream);
    for (Iterator<TagStore> iterator = tags.iterator(); iterator.hasNext();) {
      TagStore ts = iterator.next();
      type = bh.getUintBytes(ts.getType(), 1);
      dsize = bh.getUintBytes(ts.getDataSize(), 3);
      tstamp = bh.getUintBytes(ts.getTimestamp(), 3);
      if (prevTagSize != null) {
        buf = new byte[type.length + dsize.length + tstamp.length + ender.length + prevTagSize.length];
        System.arraycopy(prevTagSize, 0, buf, 0, prevTagSize.length);
        fpos += prevTagSize.length;
      } else {
        buf = new byte[type.length + dsize.length + tstamp.length + ender.length];
      }
      System.arraycopy(type, 0, buf, fpos, type.length);
      fpos += type.length;
      System.arraycopy(dsize, 0, buf, fpos, dsize.length);
      fpos += dsize.length;
      System.arraycopy(tstamp, 0, buf, fpos, tstamp.length);
      fpos += tstamp.length;
      System.arraycopy(ender, 0, buf, fpos, ender.length);
      prevTagSize = null;
      type = null;
      dsize = null;
      tstamp = null;
      stream.write(bufh.byte2buffer(buf));
      if (ts.getType() == 18 && ts.isNew()) {
        stream.write(((MetaTag) ts.getTag()).getDataAsBuffer());
        prevTagSize = bh.getUintBytes(((MetaTag) ts.getTag()).getDataSizeFromBuffer() - 4, 4);
      } else {
        tmpFlvt = (FlvTag) ts.getTag();
        stream.writeDirect(tmpFlvt.getStartingOffset(), tmpFlvt.getDataSize() - 15);
        prevTagSize = bh.getUintBytes(tmpFlvt.getDataSize() - 4, 4);
      }
      buf = null;
      fpos = 0;
    }
    if (prevTagSize != null) stream.write(bufh.byte2buffer(prevTagSize));
View Full Code Here

        if (mt.getEvent().equals("onCuePoint")) cuePointTags.add(mt.getMetaData());
        else if (mt.getEvent().equals("onMetaData")) onMetaTag = lastTag;
        tags.add(stor);
        break;
      case 0: // '\0'
        FlvTag ft = new FlvTag(ioh);
        totalByteOffset += ft.getDataSize();
        stor.setDataSize(ft.getDataSize() - 15);
        stor.setTimestamp(ft.getTimestamp());
        stor.setType(tagType);
        stor.setTag(ft);
        tags.add(stor);
        break;
      default:
        FlvTag flt = new FlvTag(ioh);
        totalByteOffset += flt.getDataSize();
        stor.setDataSize(flt.getDataSize() - 15);
        stor.setTimestamp(flt.getTimestamp());
        stor.setType(tagType);
        stor.setTag(flt);
        tags.add(stor);
        break;
    }
View Full Code Here

TOP

Related Classes of com.itstherules.tags.FlvTag

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.