当前位置: 首页>>代码示例>>Java>>正文


Java CreateJobRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.elastictranscoder.model.CreateJobRequest的典型用法代码示例。如果您正苦于以下问题:Java CreateJobRequest类的具体用法?Java CreateJobRequest怎么用?Java CreateJobRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CreateJobRequest类属于com.amazonaws.services.elastictranscoder.model包,在下文中一共展示了CreateJobRequest类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createGifJob

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
public CreateJobResult createGifJob(String pipelineId, String inputKey) {
	JobInput input = new JobInput().withKey(inputKey);
    	    
    List<CreateJobOutput> gifJobOutputs = new ArrayList<>();
    
    Iterator<String> gifPresetKeys = gifPresets.keySet().iterator();
    while (gifPresetKeys.hasNext()) {
    	String gifPresetKey = gifPresetKeys.next(); 
	    CreateJobOutput gifJob = new CreateJobOutput()
        .withKey(gifPresetKey)
        .withPresetId((String)gifPresets.get(gifPresetKey));		    
	    gifJobOutputs.add(gifJob);
    }
    
    // Create the job.
    CreateJobRequest createJobRequest = new CreateJobRequest()
        .withPipelineId(pipelineId)
        .withInput(input)
        .withOutputKeyPrefix(inputKey + "/")
        .withOutputs(gifJobOutputs);

    return transcoderClient.createJob(createJobRequest);		
}
 
开发者ID:TimShi,项目名称:s3_video,代码行数:24,代码来源:AWSAdapter.java

示例2: createElasticTranscoderJob

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
/**
 * Creates a job in Elastic Transcoder using the configured pipeline, input
 * key, preset, and output key prefix.
 *
 * @return Job ID of the job that was created in Elastic Transcoder.
 * @throws Exception
 */
private String createElasticTranscoderJob(String inputUrl) throws Exception
{
    JobInput input = new JobInput().withKey(inputUrl);
    List<CreateJobOutput> outputs = new ArrayList<>();

    for(Map.Entry<String, String> entry : GlobalParams.VIDEO_PRESETS.entrySet()) {
        String suffix = entry.getKey();
        String preset = entry.getValue();

        String outputUrl = createSuffixUrl(inputUrl, suffix);
        if(!outputUrl.isEmpty()) {
            CreateJobOutput out = new CreateJobOutput();
            out.withKey(outputUrl);
            out.withPresetId(preset);
            if(suffix.equals(STREAM)) {
                out.withSegmentDuration("1");
            }
            outputs.add(out);
        }
    }

    CreateJobRequest createJobRequest = new CreateJobRequest()
            .withPipelineId(PIPELINE_ID)
            .withInput(input)
            .withOutputs(outputs);
    return amazonElasticTranscoder.createJob(createJobRequest).getJob().getId();
}
 
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:35,代码来源:VideoConverter.java

示例3: createVideoPreview

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
@Override
public void createVideoPreview(Video video) {
	String pipelineId = config.getProperty(ConfigProps.TRANSCODE_PIPELINE);
	String presetId = config.getProperty(ConfigProps.TRANSCODE_PRESET);
	if (pipelineId == null || presetId == null) {
		return;
	}
	CreateJobRequest encodeJob = new CreateJobRequest()
			.withPipelineId(pipelineId)
			.withInput(
					new JobInput().withKey(video.getOriginalKey())
							.withAspectRatio("auto").withContainer("auto")
							.withFrameRate("auto").withInterlaced("auto")
							.withResolution("auto"))
			.withOutputKeyPrefix(
					"uploads/converted/" + video.getOwner() + "/")
			.withOutput(
					new CreateJobOutput()
							.withKey(UUID.randomUUID().toString())
							.withPresetId(presetId)
							.withThumbnailPattern(
									"thumbs/"
											+ UUID.randomUUID().toString()
											+ "-{count}"));

	try {
		CreateJobResult result = transcoderClient.createJob(encodeJob);
		video.setTranscodeJobId(result.getJob().getId());
		video.setThumbnailKey("static/img/in_progress_poster.png");
		save(video);
	} catch (AmazonServiceException e) {
		LOG.error("Failed creating transcode job for video {}",
				video.getId(), e);
	}
}
 
开发者ID:awslabs,项目名称:amediamanager,代码行数:36,代码来源:VideoServiceImpl.java

示例4: transcode

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
public TranscodingJob transcode( final TranscodeRequest transcodeRequest )
{
    final String inputKey = transcodeRequest.getInputKey();
    final String outputKey = transcodeRequest.getOutputKey();

    // Extract TranscodingService
    logger.info( "Transcoding {} to {}.", inputKey, outputKey );
    final JobInput jobInput =
            new JobInput().withKey( inputKey ).withAspectRatio( "auto" ).withContainer( "auto" )
                    .withFrameRate( "auto" ).withInterlaced( "auto" ).withResolution( "auto" );
    final CreateJobOutput createJobOutput =
            new CreateJobOutput().withKey( outputKey ).withPresetId( ETS_PRESET_1080P ).withRotate( "auto" )
                    .withThumbnailPattern( "" );
    final CreateJobRequest jobRequest =
            new CreateJobRequest().withInput( jobInput ).withOutputs( createJobOutput )
                    .withPipelineId( MOV_TO_MP4_PIPELINE_ID );

    CreateJobResult jobResult;
    try
    {
        jobResult = this.elasticTranscoder.createJob( jobRequest );
    }
    catch ( final AmazonClientException e )
    {
        logger.error( "Error creating ElasticTranscoder Job!", e );
        return null;
    }

    if ( jobResult.getJob() == null )
    {
        logger.error( "Job is null.  Something went wrong!" );
        return null;
    }
    final Job job = jobResult.getJob();
    logger.info( "Job {} is {}.", job.getId(), job.getStatus() );
    return new TranscodingJob( job.getId(), transcodeRequest.getInputPath(), transcodeRequest.getOutputPath() );
}
 
开发者ID:stevenmhood,项目名称:transcoder,代码行数:38,代码来源:TranscodingService.java

示例5: createTranscodeJob

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
public CreateJobResult createTranscodeJob(String pipelineId, String inputKey) throws TranscodeException {
	JobInput input = new JobInput().withKey(inputKey);
    
	boolean isThumbnailConfigured = false;
	
    List<CreateJobOutput> hlsJobOutputs = new ArrayList<>();
    Iterator<String> hlsPresetKeys = hlsPresets.keySet().iterator();
    List<String> hlsJobKeys = new ArrayList<>();	    		
    while (hlsPresetKeys.hasNext()) {
    	String hlsPresetKey = hlsPresetKeys.next();
    	String hlsJobKey = "hls/" + hlsPresetKey;
    	
	    CreateJobOutput hlsJob = new CreateJobOutput()
        .withKey(hlsJobKey)
        .withPresetId((String)hlsPresets.get(hlsPresetKey))
        .withSegmentDuration(segmentDuration);
	    
	    if (!isThumbnailConfigured) {
	    	hlsJob.withThumbnailPattern(THUMBNAIL_PATTERN);
	    	isThumbnailConfigured = true;
	    }
	    
	    hlsJobKeys.add(hlsJobKey);
	    hlsJobOutputs.add(hlsJob);		    
    }
    
    // Setup master playlist which can be used to play using adaptive bitrate.
    CreateJobPlaylist playlist = new CreateJobPlaylist()
        .withName("hls") 
        .withFormat("HLSv3")
        .withOutputKeys(hlsJobKeys);
    
    List<CreateJobOutput> webmJobOutputs = new ArrayList<>();
    Iterator<String> webmPresetKeys = webmPresets.keySet().iterator();
    while (webmPresetKeys.hasNext()) {
    	String webmPresetKey = webmPresetKeys.next(); 
	    CreateJobOutput webmJob = new CreateJobOutput()
        .withKey(webmPresetKey)
        .withPresetId((String)webmPresets.get(webmPresetKey));		    

	    if (!isThumbnailConfigured) {
	    	webmJob.withThumbnailPattern(THUMBNAIL_PATTERN);
	    	isThumbnailConfigured = true;
	    }

	    webmJobOutputs.add(webmJob);
    }

    List<CreateJobOutput> outputs = new ArrayList<>();
    outputs.addAll(hlsJobOutputs);
    outputs.addAll(webmJobOutputs);
    
    // Create the job.
    CreateJobRequest createJobRequest = new CreateJobRequest()
        .withPipelineId(pipelineId)
        .withInput(input)
        .withOutputKeyPrefix(inputKey + "/")
        .withOutputs(outputs)
        .withPlaylists(playlist);

    return transcoderClient.createJob(createJobRequest);
}
 
开发者ID:TimShi,项目名称:s3_video,代码行数:63,代码来源:AWSAdapter.java

示例6: execute

import com.amazonaws.services.elastictranscoder.model.CreateJobRequest; //导入依赖的package包/类
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);
	
	
	// 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;
	}
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:68,代码来源:Create.java


注:本文中的com.amazonaws.services.elastictranscoder.model.CreateJobRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。