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

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

Introduction

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

Prototype


public void setEncryption(Encryption encryption) 

Source Link

Document

The encryption settings, if any, that are used for decrypting your input files.

Usage

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

License:Open Source License

public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException {
    AmazonKey amazonKey = getAmazonKey(_session, argStruct);
    AmazonElasticTranscoder et = getAmazonElasticTranscoder(amazonKey);

    CreateJobRequest cjr = new CreateJobRequest();

    cjr.setPipelineId(getNamedStringParam(argStruct, "pipelineid", null));
    if (cjr.getPipelineId() == null || cjr.getPipelineId().isEmpty())
        throwException(_session, "please provide a valid pipelineid");

    cjr.setOutputKeyPrefix(getNamedStringParam(argStruct, "outputkeyprefix", null));
    if (cjr.getOutputKeyPrefix() != null && cjr.getOutputKeyPrefix().isEmpty())
        throwException(_session, "please provide a valid outputkeyprefix");

    // Handle the input
    cfStructData input = getNamedStructParam(_session, argStruct, "input", null);
    if (input == null)
        throwException(_session, "please provide a 'input'");

    JobInput jobinput = new JobInput();

    if (input.containsKey("aspectratio"))
        jobinput.setAspectRatio(input.getData("aspectratio").getString());

    if (input.containsKey("container"))
        jobinput.setContainer(input.getData("container").getString());

    if (input.containsKey("framerate"))
        jobinput.setFrameRate(input.getData("framerate").getString());

    if (input.containsKey("interlaced"))
        jobinput.setInterlaced(input.getData("interlaced").getString());

    if (input.containsKey("key"))
        jobinput.setKey(input.getData("key").getString());

    if (input.containsKey("resolution"))
        jobinput.setResolution(input.getData("resolution").getString());

    if (input.containsKey("encryption"))
        jobinput.setEncryption(getEncryption((cfStructData) input.getData("encryption")));

    cjr.setInput(jobinput);/*from w ww . j  a  v a  2  s  .  c  om*/

    // Set the output
    cfArrayData outputArr = getNamedArrayParam(_session, argStruct, "outputs", null);
    if (outputArr == null)
        throwException(_session, "please provide 'outputs'");

    List<CreateJobOutput> outputs = new LinkedList();
    for (int x = 0; x < outputArr.size(); x++)
        outputs.add(getCreateJobOutput((cfStructData) outputArr.getData(x + 1)));

    cjr.setOutputs(outputs);

    // Now after collection all that; create the actual pipeline
    try {
        CreateJobResult cpres = et.createJob(cjr);
        return new cfStringData(cpres.getJob().getId());
    } catch (Exception e) {
        throwException(_session, "AmazonElasticTranscoder: " + e.getMessage());
        return cfBooleanData.TRUE;
    }
}