Example #1
0
  public static final void writeAsBytes(PrimerPack primerPack, ByteBuffer buffer)
      throws NullPointerException, InsufficientSpaceException {

    if (primerPack == null)
      throw new NullPointerException("Cannot write a null primer pack to a buffer.");
    if (buffer == null)
      throw new NullPointerException("Cannot write a primer pack into a null buffer.");

    if (buffer.remaining() < lengthAsBytes(primerPack))
      throw new InsufficientSpaceException(
          "Insufficient space remaining to write primer pack into given buffer.");

    UL key =
        (UL)
            Forge.makeAUID(
                0x0d010201,
                (short) 0x0105,
                (short) 0x0100,
                new byte[] {0x06, 0x0e, 0x2b, 0x34, 0x02, 0x05, 0x01, 0x01});
    MXFBuilder.writeKey(key, buffer);
    MXFBuilder.writeBERLength(18 * primerPack.countLocalTagEntries() + 8, 4, buffer);

    buffer.putInt(primerPack.countLocalTagEntries());
    buffer.putInt(18);

    for (LocalTagEntry entry : primerPack.getLocalTagEntryBatch()) {
      buffer.putShort(entry.getLocalTag());
      MXFBuilder.writeKey((UL) entry.getUID(), buffer);
    }
  }
Example #2
0
  /**
   * Create a cloned copy of this PrimerPackImpl.
   *
   * @return Cloned copy of this PrimerPackImpl.
   */
  @MediaSetAdd("LocalTagEntry Batch")
  public void addLocalTagEntry(LocalTagEntry localTagEntry) throws NullPointerException {

    if (localTagEntry == null)
      throw new NullPointerException(
          "Cannot add a new local tag entry to this batch with a null value.");

    localTagBatch.put(localTagEntry.getLocalTag(), localTagEntry);
    reverseMap.put(localTagEntry.getUID(), localTagEntry.getLocalTag());
  }
Example #3
0
  /**
   * Create a cloned copy of this PrimerPackImpl.
   *
   * @return Cloned copy of this PrimerPackImpl.
   */
  @MediaPropertyContains("LocalTagEntry Batch")
  public boolean isLocalTagEntryPresent(LocalTagEntry localTagEntry) {

    return localTagBatch.containsKey(localTagEntry.getLocalTag());
  }