Example usage for com.amazonaws.services.elastictranscoder.model CaptionFormat setEncryption

List of usage examples for com.amazonaws.services.elastictranscoder.model CaptionFormat setEncryption

Introduction

In this page you can find the example usage for com.amazonaws.services.elastictranscoder.model CaptionFormat setEncryption.

Prototype


public void setEncryption(Encryption encryption) 

Source Link

Document

The encryption settings, if any, that you want Elastic Transcoder to apply to your caption formats.

Usage

From source file:org.alanwilliamson.amazon.transcoder.job.Create.java

License:Open Source License

private CreateJobOutput getCreateJobOutput(cfStructData d) throws cfmRunTimeException {
    CreateJobOutput cjo = new CreateJobOutput();

    if (d.containsKey("presetid"))
        cjo.setPresetId(d.getData("presetid").getString());

    if (d.containsKey("key"))
        cjo.setKey(d.getData("key").getString());

    if (d.containsKey("rotate"))
        cjo.setRotate(d.getData("rotate").getString());

    if (d.containsKey("segmentduration"))
        cjo.setSegmentDuration(d.getData("segmentduration").getString());

    if (d.containsKey("encryption"))
        cjo.setEncryption(getEncryption((cfStructData) d.getData("encryption")));

    if (d.containsKey("thumbnailencryption"))
        cjo.setThumbnailEncryption(getEncryption((cfStructData) d.getData("thumbnailencryption")));

    if (d.containsKey("thumbnailpattern"))
        cjo.setThumbnailPattern(d.getData("thumbnailpattern").getString());

    // Handle the watermarks
    if (d.containsKey("watermarks") && d.getData("watermarks") instanceof cfArrayData) {
        List<JobWatermark> watermarks = new LinkedList();
        cfArrayData arr = (cfArrayData) d.getData("watermarks");

        for (int x = 0; x < arr.size(); x++) {
            cfStructData s = (cfStructData) arr.getData(x + 1);
            JobWatermark w = new JobWatermark();

            if (s.containsKey("encryption"))
                w.setEncryption(getEncryption((cfStructData) s.getData("encryption")));

            if (s.containsKey("inputkey"))
                w.setInputKey(s.getData("inputkey").getString());

            if (s.containsKey("presetwatermarkid"))
                w.setPresetWatermarkId(s.getData("presetwatermarkid").getString());

            watermarks.add(w);/*from   www.  j  a  v  a2  s. com*/
        }

        cjo.setWatermarks(watermarks);
    }

    // Set the composition
    if (d.containsKey("composition") && d.getData("composition") instanceof cfArrayData) {
        List<Clip> clips = new LinkedList();
        cfArrayData arr = (cfArrayData) d.getData("composition");

        for (int x = 0; x < arr.size(); x++) {
            cfStructData s = (cfStructData) arr.getData(x + 1);

            Clip clip = new Clip();
            TimeSpan ts = new TimeSpan();
            clip.setTimeSpan(ts);

            if (s.containsKey("starttime"))
                ts.setStartTime(s.getData("starttime").getString());
            if (s.containsKey("duration"))
                ts.setDuration(s.getData("duration").getString());

            clips.add(clip);
        }

        cjo.setComposition(clips);
    }

    // handle the captions
    if (d.containsKey("captions") && d.getData("captions") instanceof cfStructData) {
        Captions c = new Captions();
        cfStructData s = (cfStructData) d.getData("captions");

        if (s.containsKey("mergepolicy"))
            c.setMergePolicy(s.getData("mergepolicy").getString());

        // CaptionFormat
        if (s.containsKey("captionformat") && s.getData("captionformat") instanceof cfArrayData) {
            List<CaptionFormat> captionFormatList = new LinkedList();
            cfArrayData arr = (cfArrayData) s.getData("captionformat");

            for (int x = 0; x < arr.size(); x++) {
                cfStructData ss = (cfStructData) arr.getData(x + 1);
                CaptionFormat cf = new CaptionFormat();

                if (ss.containsKey("encryption"))
                    cf.setEncryption(getEncryption((cfStructData) ss.get("encryption")));

                if (ss.containsKey("format"))
                    cf.setFormat(ss.getData("format").getString());

                if (ss.containsKey("pattern"))
                    cf.setPattern(ss.getData("pattern").getString());

                captionFormatList.add(cf);
            }

            c.setCaptionFormats(captionFormatList);
        }

        cjo.setCaptions(c);
    }

    // handle the album art
    if (d.containsKey("albumart") && d.getData("albumart") instanceof cfStructData) {
        JobAlbumArt ja = new JobAlbumArt();
        cfStructData s = (cfStructData) d.getData("albumart");

        if (s.containsKey("mergepolicy"))
            ja.setMergePolicy(s.getData("mergepolicy").getString());

        // artwork
        if (s.containsKey("artwork") && s.getData("artwork") instanceof cfArrayData) {
            List<Artwork> artworkList = new LinkedList();
            cfArrayData arr = (cfArrayData) s.getData("artwork");

            for (int x = 0; x < arr.size(); x++) {
                cfStructData ss = (cfStructData) arr.getData(x + 1);
                Artwork a = new Artwork();

                if (ss.containsKey("encryption"))
                    a.setEncryption(getEncryption((cfStructData) ss.get("encryption")));

                if (ss.containsKey("albumartformat"))
                    a.setAlbumArtFormat(ss.getData("albumartformat").getString());

                if (ss.containsKey("inputkey"))
                    a.setInputKey(ss.getData("inputkey").getString());

                if (ss.containsKey("maxheight"))
                    a.setMaxHeight(ss.getData("maxheight").getString());

                if (ss.containsKey("maxwidth"))
                    a.setMaxWidth(ss.getData("maxwidth").getString());

                if (ss.containsKey("paddingpolicy"))
                    a.setPaddingPolicy(ss.getData("paddingpolicy").getString());

                if (ss.containsKey("sizingpolicy"))
                    a.setSizingPolicy(ss.getData("sizingpolicy").getString());

                artworkList.add(a);
            }

            ja.setArtwork(artworkList);
        }

        cjo.setAlbumArt(ja);
    }

    return cjo;
}