Examples of MetadataBlockDataPicture


Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

        List<TagField> metadataBlockPics = this.get(VorbisCommentFieldKey.METADATA_BLOCK_PICTURE);
        for (TagField tagField : metadataBlockPics) {

            try {
                byte[] imageBinaryData = Base64Coder.decode(((TagTextField) tagField).getContent());
                MetadataBlockDataPicture coverArt = new MetadataBlockDataPicture(ByteBuffer.wrap(imageBinaryData));
                Artwork artwork = Artwork.createArtworkFromMetadataBlockDataPicture(coverArt);
                artworkList.add(artwork);
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            } catch (InvalidFrameException ife) {
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

     *
     * @return MetadataBlockDataPicture
     */
    private MetadataBlockDataPicture createMetadataBlockDataPicture(Artwork artwork) throws FieldDataInvalidException {
        if (artwork.isLinked()) {
            return new MetadataBlockDataPicture(
                    Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                    artwork.getPictureType(),
                    MetadataBlockDataPicture.IMAGE_IS_URL,
                    "",
                    0,
                    0,
                    0,
                    0);
        } else {
            BufferedImage image;
            try {
                image = artwork.getImage();
            } catch (IOException ioe) {
                throw new FieldDataInvalidException("Unable to create MetadataBlockDataPicture from buffered:" + ioe.getMessage());
            }

            return new MetadataBlockDataPicture(artwork.getBinaryData(),
                    artwork.getPictureType(),
                    artwork.getMimeType(),
                    artwork.getDescription(),
                    image.getWidth(),
                    image.getHeight(),
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

        }

        //Images
        ListIterator<MetadataBlockDataPicture> li = flacTag.getImages().listIterator();
        while (li.hasNext()) {
            MetadataBlockDataPicture imageField = li.next();
            MetadataBlockHeader imageHeader;

            if (paddingSize > 0 || li.hasNext()) {
                imageHeader = new MetadataBlockHeader(false, BlockType.PICTURE, imageField.getLength());
            } else {
                imageHeader = new MetadataBlockHeader(true, BlockType.PICTURE, imageField.getLength());
            }
            buf.put(imageHeader.getBytes());
            buf.put(imageField.getBytes());
        }

        //Padding
//        //logger.info("Convert flac tag at" + buf.position());
        if (paddingSize > 0) {
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

                    tag = vorbisCommentReader.read(commentHeaderRawPacket, false);
                    break;

                case PICTURE:
                    try {
                        MetadataBlockDataPicture mbdp = new MetadataBlockDataPicture(mbh, raf);
                        images.add(mbdp);
                    } catch (IOException ioe) {
                        //logger.warning("Unable to read picture metablock, ignoring:" + ioe.getMessage());
                    } catch (InvalidFrameException ive) {
                        //logger.warning("Unable to read picture metablock, ignoring" + ive.getMessage());
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

            return tag.getFields(id);
        }
    }

    public TagField createArtworkField(byte[] imageData, int pictureType, String mimeType, String description, int width, int height, int colourDepth, int indexedColouredCount) throws FieldDataInvalidException {
        return new MetadataBlockDataPicture(imageData, pictureType, mimeType, description, width, height, colourDepth, indexedColouredCount);
    }
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

        try {
            final ByteArrayOutputStream output = new ByteArrayOutputStream();
            ImageIO.write(bi, ImageFormats.getFormatForMimeType(mimeType), new DataOutputStream(output));

            //Add to image list
            return new MetadataBlockDataPicture(output.toByteArray(), pictureType, mimeType, description, bi.getWidth(), bi.getHeight(), colourDepth, indexedColouredCount);
        } catch (IOException ioe) {
            throw new FieldDataInvalidException("Unable to convert image to bytearray, check mimetype parameter");
        }
    }
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

     * @param url
     * @return
     */
    public TagField createLinkedArtworkField(String url) {
        //Add to image list
        return new MetadataBlockDataPicture(Utils.getDefaultBytes(url, TextEncoding.CHARSET_ISO_8859_1), PictureTypes.DEFAULT_ID, MetadataBlockDataPicture.IMAGE_IS_URL, "", 0, 0, 0, 0);
    }
View Full Code Here

Examples of org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture

     *
     * @return
     */
    public TagField createField(Artwork artwork) throws FieldDataInvalidException {
        if (artwork.isLinked()) {
            return new MetadataBlockDataPicture(
                    Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                    artwork.getPictureType(),
                    MetadataBlockDataPicture.IMAGE_IS_URL,
                    "",
                    0,
                    0,
                    0,
                    0);
        } else {
            BufferedImage image;
            try {
                image = artwork.getImage();
            } catch (IOException ioe) {
                throw new FieldDataInvalidException("Unable to createField bufferd image from the image");
            }

            return new MetadataBlockDataPicture(artwork.getBinaryData(),
                    artwork.getPictureType(),
                    artwork.getMimeType(),
                    artwork.getDescription(),
                    image.getWidth(),
                    image.getHeight(),
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.