Package entagged.audioformats.asf.data

Examples of entagged.audioformats.asf.data.ContentDescription


     * @throws IOException
     *                   read errors.
     */
    private ContentDescription parseData(RandomAccessFile raf)
            throws IOException {
        ContentDescription result = null;
        long chunkStart = raf.getFilePointer();
        GUID guid = Utils.readGUID(raf);
        if (GUID.GUID_CONTENTDESCRIPTION.equals(guid)) {
            BigInteger chunkLen = Utils.readBig64(raf);
            result = new ContentDescription(chunkStart, chunkLen);
            /*
             * Now comes 16-Bit values representing the length of the Strings
             * which follows.
             */
            int[] stringSizes = getStringSizes(raf);
            /*
             * Now we know the String length of each occuring String.
             */
            String[] strings = new String[stringSizes.length];
            for (int i = 0; i < strings.length; i++) {
                if (stringSizes[i] > 0)
                    strings[i] = readFixedSizeUTF16Str(raf, stringSizes[i]);
            }
            if (stringSizes[0] > 0)
                result.setTitle(strings[0]);
            if (stringSizes[1] > 0)
                result.setAuthor(strings[1]);
            if (stringSizes[2] > 0)
                result.setCopyRight(strings[2]);
            if (stringSizes[3] > 0)
                result.setComment(strings[3]);
            if (stringSizes[4] > 0)
                result.setRating(strings[4]);
        }
        return result;
    }
View Full Code Here


            ContentDescription contentDescription, RandomAccessFile rafTemp)
            throws IOException {
        // Store current Location
        long chunkStart = rafTemp.getFilePointer();
        // Create a content description object out of tag values.
        ContentDescription description = TagConverter
                .createContentDescription(tag);
        // Add optional existing values which aren't covered with tag.
        if (contentDescription != null) {
            description.setRating(contentDescription.getRating());
        }
        // Create byte[] for the asf file.
        byte[] asfContent = description.getBytes();
        // write content
        rafTemp.write(asfContent);
        // Create chunk information
        return new Chunk(GUID.GUID_CONTENTDESCRIPTION, chunkStart, BigInteger
                .valueOf(asfContent.length));
View Full Code Here

       */
      FileHeader fileHeader = null;
      ExtendedContentDescription extendedDescription = null;
      EncodingChunk encodingChunk = null;
      StreamChunk streamChunk = null;
      ContentDescription contentDescription = null;
      StreamBitratePropertiesChunk bitratePropertiesChunk = null;

      Iterator iterator = chunks.iterator();
      while (iterator.hasNext()) {
        Chunk currentChunk = (Chunk) iterator.next();
View Full Code Here

     *                   This string will be set to each known field.
     * @return The number of errors occured.
     */
    private int testContentDescription(AsfHeader header, String toTest) {
        int errorCount = 0;
        ContentDescription desc = header.getContentDescription();
        try {
            desc.setAuthor(toTest);
        } catch (Exception e) {
            errorCount++;
        }
        try {
            desc.setComment(toTest);
        } catch (Exception e) {
            errorCount++;
        }
        try {
            desc.setCopyRight(toTest);
        } catch (Exception e) {
            errorCount++;
        }
        try {
            desc.setRating(toTest);
        } catch (Exception e) {
            errorCount++;
        }
        try {
            desc.setTitle(toTest);
        } catch (Exception e) {
            errorCount++;
        }
        return errorCount;
    }
View Full Code Here

   * @see Tag#getFirstComment() <br>
   *
   * @return A new content description object filled with <code>tag</code>.
   */
  public static ContentDescription createContentDescription(Tag tag) {
    ContentDescription result = new ContentDescription();
    result.setAuthor(tag.getFirstArtist());
    result.setTitle(tag.getFirstTitle());
    result.setComment(tag.getFirstComment());
    TagTextField cpField = AsfCopyrightField.getCopyright(tag);
    if (cpField != null) {
      result.setCopyRight(cpField.getContent());
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of entagged.audioformats.asf.data.ContentDescription

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.