[*] 服务端录制
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.acgist.taoyao.boot.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* FFmpeg配置
|
||||
*
|
||||
* @author acgist
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(title = "FFmpeg配置", description = "FFmpeg配置")
|
||||
@ConfigurationProperties(prefix = "taoyao.ffmpeg")
|
||||
public class FfmpegProperties {
|
||||
|
||||
@Schema(title = "SDP模板", description = "SDP模板")
|
||||
private String sdp;
|
||||
@Schema(title = "媒体录像", description = "媒体录像")
|
||||
private String record;
|
||||
@Schema(title = "预览截图", description = "预览截图")
|
||||
private String preview;
|
||||
@Schema(title = "视频时长", description = "视频时长")
|
||||
private String duration;
|
||||
@Schema(title = "存储目录", description = "存储目录")
|
||||
private String storagePath;
|
||||
@Schema(title = "图片存储目录", description = "图片存储目录")
|
||||
private String storageImagePath;
|
||||
@Schema(title = "视频存储目录", description = "视频存储目录")
|
||||
private String storageVideoPath;
|
||||
@Schema(title = "录像最小端口", description = "录像最小端口")
|
||||
private Integer minPort;
|
||||
@Schema(title = "录像最大端口", description = "录像最大端口")
|
||||
private Integer maxPort;
|
||||
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import org.springframework.web.context.request.async.AsyncRequestTimeoutExceptio
|
||||
import org.springframework.web.multipart.support.MissingServletRequestPartException;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import com.acgist.taoyao.boot.config.FfmpegProperties;
|
||||
import com.acgist.taoyao.boot.config.IdProperties;
|
||||
import com.acgist.taoyao.boot.config.IpRewriteProperties;
|
||||
import com.acgist.taoyao.boot.config.MediaProperties;
|
||||
@@ -86,6 +87,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@EnableConfigurationProperties({
|
||||
IdProperties.class,
|
||||
MediaProperties.class,
|
||||
FfmpegProperties.class,
|
||||
ScriptProperties.class,
|
||||
SocketProperties.class,
|
||||
TaoyaoProperties.class,
|
||||
@@ -94,11 +96,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||
IpRewriteProperties.class
|
||||
})
|
||||
public class BootAutoConfiguration {
|
||||
|
||||
|
||||
private final FfmpegProperties ffmpegProperties;
|
||||
private final TaoyaoProperties taoyaoProperties;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
public BootAutoConfiguration(TaoyaoProperties taoyaoProperties, ApplicationContext applicationContext) {
|
||||
public BootAutoConfiguration(FfmpegProperties ffmpegProperties, TaoyaoProperties taoyaoProperties, ApplicationContext applicationContext) {
|
||||
this.ffmpegProperties = ffmpegProperties;
|
||||
this.taoyaoProperties = taoyaoProperties;
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
@@ -188,6 +192,8 @@ public class BootAutoConfiguration {
|
||||
this.applicationContext.getBeansOfType(TaskScheduler.class).forEach((k, v) -> {
|
||||
log.info("系统定时任务线程池:{} - {}", k, v);
|
||||
});
|
||||
FileUtils.mkdirs(this.ffmpegProperties.getStorageImagePath());
|
||||
FileUtils.mkdirs(this.ffmpegProperties.getStorageVideoPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.acgist.taoyao.boot.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@@ -55,4 +56,24 @@ public final class FileUtils {
|
||||
return BigDecimal.valueOf(value).setScale(2, RoundingMode.HALF_EVEN) + UNITS[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 是否Linux平台
|
||||
*/
|
||||
public static final boolean linux() {
|
||||
return File.separatorChar == '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建目录
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
public static final void mkdirs(String path) {
|
||||
final File file = new File(path);
|
||||
if(file.exists()) {
|
||||
return;
|
||||
}
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user