package com.platform.modules.live.service;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.aliyuncs.exceptions.ClientException;
import com.platform.modules.live.dto.TranscodeCompleteDto;
import org.springframework.web.multipart.MultipartFile;

import com.baomidou.mybatisplus.service.IService;
import com.platform.common.utils.PageUtils;
import com.platform.modules.live.entity.LiveMultimediaEntity;

/**
 * 素材信息
 * 
 * @author weiyan
 * @email 
 * @date 2019-03-12 10:09:03
 */
public interface LiveMultimediaService extends IService<LiveMultimediaEntity> {
	
	PageUtils queryPageByParams(Map<String, Object> params);
	
	PageUtils queryAppPageByParams(Map<String, Object> params);
	
	PageUtils queryCommonPageByParams(Map<String, Object> params);
	
	Map<String, Object> info(Integer id);
	
	Map<String, Object> getInfoByMediaId(String mediaId);

	Map<String, Object> save(LiveMultimediaEntity liveMultimedia, MultipartFile mediaFile,  Long userId);

	Map<String, Object> save(LiveMultimediaEntity liveMultimedia, Long userId);

	void getVideoMezzanineInfo(String vedioId, LiveMultimediaEntity entity) throws Exception;

	void getImageInfo(String imageId, LiveMultimediaEntity entity) throws Exception;

	void update(LiveMultimediaEntity liveMultimedia, Long userId);

	void delete(Integer id, Long userId);

	void deleteBatch(Integer[] ids,Long userId);
	
	void fileUploadComplete(String videoId,String fileUrl);
	
	void getVideoInfo(String videoId);
	
	void getImageInfo(String imageId);
	
	void videoAnalysisComplete(String videoId,Integer width,Integer height,Float Duration,String Bitrate,String Fps,Long Size);

	void addLiveRecordVideoComplete(String videoId, String domainName, String appName, String streamName, String recordStartTime, String recordEndTime, String eventTime);

	void transcodeComplete(String videoId, TranscodeCompleteDto dto) throws ClientException;

	void updateOriMediaUrl(String videoId, String fileUrl, Long size);
	/**
	 * 新建转码任务
	 * @param videoId 视频ID
	 * @param serviceId 转码业务ID
	 * @param serviceType 业务类型：1直播录制 2 素材上传 3云剪辑合成
	 */
	void createTranscode(Integer serviceId, Integer serviceType, String videoId, Integer transcodeStatus);
	/**
	 * 更新转码任务
	 * @param videoId 视频ID
	 * @param transcodeStatus 转码状态
	 * */
	void updateTranscode(String videoId, Integer transcodeStatus);
	/**
	 * 重新转码
	 * @param videoId 视频ID
	 * */
	boolean reTranscode(String videoId);
	/**
	 * 根据路径获取素材
	 *
	 * @param mediaUrl 素材路径
	 * */
	LiveMultimediaEntity getByMediaUrl(String mediaUrl);
	
	/**
	 * 保存至本地
	 * @param videoUrl
	 * @param title
	 * @param response
	 */
	void saveToLocal(String videoUrl,String title, HttpServletResponse response);
}
