package cn.reghao.tnb.content.app.vod.model.po;

import cn.reghao.jutil.jdk.db.BaseObject;
import cn.reghao.oss.sdk.model.dto.media.VideoInfo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 视频文件
 *
 * @author reghao
 * @date 2021-11-22 10:21:15
 */
@NoArgsConstructor
@Setter
@Getter
public class VideoFile extends BaseObject<Integer> {
    private String videoId;
    private String objectId;
    private Integer channelCode;
    private String videoCodec;
    private Long vbitRate;
    private String audioCodec;
    private Long abitRate;
    private String formatName;
    private String urlType;
    private String url;
    private String quality;
    private Integer width;
    private Integer height;
    private Boolean horizontal;
    // 单位秒
    private Integer duration;
    private Long size;

    public VideoFile(String videoId, VideoInfo videoInfo, int channelCode) {
        this.videoId = videoId;
        this.objectId = videoInfo.getObjectId();
        this.channelCode = channelCode;
        this.videoCodec = videoInfo.getVideoCodec();
        this.vbitRate = videoInfo.getVbitRate();
        this.audioCodec = videoInfo.getAudioCodec();
        this.abitRate = videoInfo.getAbitRate();
        this.formatName = videoInfo.getFormatName();
        this.urlType = videoInfo.getUrlType();
        this.url = videoInfo.getUrl();
        this.quality = videoInfo.getQuality();
        this.width = videoInfo.getWidth();
        this.height = videoInfo.getHeight();
        this.horizontal = videoInfo.getWidth()>videoInfo.getHeight();
        this.duration = videoInfo.getDuration();
        this.size = videoInfo.getSize();
    }
}
