package vip.xiaonuo.disk.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.disk.dto.file.TranscodingReqDTO;
import vip.xiaonuo.disk.service.TranscodingService;

import javax.annotation.Resource;

/**
 * 资源转码controller
 *
 * @author jinjilong
 */
@RestController
@Slf4j
@Validated
public class TranscodingController {

    @Resource
    private TranscodingService transcodingService;


    /**
     * 视频资源转码
     *
     * @param transcodingReqDTO 转码请求
     * @return 转码结果
     *
     * @author jinjilong
     */
    @PostMapping("/transcoding/file")
    public CommonResult<String> transcodingVideo(@RequestBody TranscodingReqDTO transcodingReqDTO) {
        return transcodingService.transcodingVideo(transcodingReqDTO);
    }
    @PostMapping("/transcodingResource/file")
    public CommonResult<String> transcodingResource(@RequestBody TranscodingReqDTO transcodingReqDTO) {
        return transcodingService.transcodingResource(transcodingReqDTO);
    }

}
