2026-05-19 14:33:06 +08:00
|
|
|
|
package video
|
|
|
|
|
|
|
2026-05-20 11:32:39 +08:00
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
|
|
|
2026-05-19 14:33:06 +08:00
|
|
|
|
// ConcatReq 视频拼接请求(JSON body / URL 方式)
|
|
|
|
|
|
type ConcatReq struct {
|
2026-05-20 11:32:39 +08:00
|
|
|
|
g.Meta `path:"/concat" method:"post" tags:"视频拼接" summary:"视频拼接(URL模式)" dc:"从视频URL下载并拼接"`
|
2026-05-19 14:33:06 +08:00
|
|
|
|
VideoURLs []string `json:"video_urls" v:"required#视频URL列表不能为空" dc:"视频URL列表(按此顺序拼接)"`
|
|
|
|
|
|
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
2026-05-20 11:32:39 +08:00
|
|
|
|
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 13:18:55 +08:00
|
|
|
|
// ConcatAsyncReq 视频拼接-异步请求(URL模式)
|
|
|
|
|
|
type ConcatAsyncReq struct {
|
|
|
|
|
|
g.Meta `path:"/concat/async" method:"post" tags:"视频拼接" summary:"视频拼接-异步(URL模式)" dc:"异步拼接视频,立即返回taskId,完成后通过callback_url通知结果"`
|
|
|
|
|
|
VideoURLs []string `json:"video_urls" v:"required#视频URL列表不能为空" dc:"视频URL列表(按此顺序拼接)"`
|
|
|
|
|
|
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
|
|
|
|
|
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
|
|
|
|
|
CallbackURL string `json:"callback_url" v:"required#回调地址不能为空" dc:"回调地址,拼接完成后POST结果到该地址"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-20 11:32:39 +08:00
|
|
|
|
// ConcatUploadReq 视频拼接请求(文件上传模式)
|
|
|
|
|
|
type ConcatUploadReq struct {
|
|
|
|
|
|
g.Meta `path:"/concat/upload" method:"post" tags:"视频拼接" summary:"视频拼接(文件上传)" dc:"上传视频文件并拼接(至少2个视频)"`
|
|
|
|
|
|
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
|
|
|
|
|
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
2026-05-19 14:33:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 13:18:55 +08:00
|
|
|
|
// ConcatUploadAsyncReq 视频拼接-异步请求(文件上传模式)
|
|
|
|
|
|
type ConcatUploadAsyncReq struct {
|
|
|
|
|
|
g.Meta `path:"/concat/upload/async" method:"post" tags:"视频拼接" summary:"视频拼接-异步(文件上传)" dc:"异步拼接上传的视频,立即返回taskId,完成后通过callback_url通知结果"`
|
|
|
|
|
|
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
|
|
|
|
|
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
|
|
|
|
|
CallbackURL string `json:"callback_url" v:"required#回调地址不能为空" dc:"回调地址,拼接完成后POST结果到该地址"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-19 14:33:06 +08:00
|
|
|
|
// ConcatRes 视频拼接响应
|
|
|
|
|
|
type ConcatRes struct {
|
|
|
|
|
|
OutputPath string `json:"outputPath" dc:"输出文件路径"`
|
|
|
|
|
|
FileSize int64 `json:"fileSize" dc:"文件大小(字节)"`
|
|
|
|
|
|
Duration float64 `json:"duration" dc:"总时长(秒)"`
|
|
|
|
|
|
DurationStr string `json:"durationStr" dc:"可读时长"`
|
|
|
|
|
|
MethodUsed string `json:"methodUsed" dc:"实际使用的拼接方式"`
|
|
|
|
|
|
InputFiles int `json:"inputFiles" dc:"输入文件数"`
|
2026-05-20 11:32:39 +08:00
|
|
|
|
FileURL string `json:"fileURL" dc:"MinIO访问地址(上传后返回)"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 13:18:55 +08:00
|
|
|
|
// ---------- 异步拼接任务 ----------
|
|
|
|
|
|
|
|
|
|
|
|
// CreateConcatTaskRes 创建异步拼接任务响应
|
|
|
|
|
|
type CreateConcatTaskRes struct {
|
|
|
|
|
|
TaskID string `json:"taskId" dc:"任务ID"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetConcatTaskReq 查询异步拼接任务请求
|
|
|
|
|
|
type GetConcatTaskReq struct {
|
|
|
|
|
|
g.Meta `path:"/concat/task/{taskId}" method:"get" tags:"视频拼接" summary:"查询拼接任务结果" dc:"根据taskId查询异步拼接任务的结果"`
|
|
|
|
|
|
TaskID string `json:"taskId" dc:"任务ID"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetConcatTaskRes 查询异步拼接任务响应
|
|
|
|
|
|
type GetConcatTaskRes struct {
|
|
|
|
|
|
TaskID string `json:"taskId" dc:"任务ID"`
|
|
|
|
|
|
Status string `json:"status" dc:"状态: pending/running/success/failed"`
|
|
|
|
|
|
FileURL string `json:"fileURL,omitempty" dc:"MinIO文件访问路径"`
|
|
|
|
|
|
FileSize int64 `json:"fileSize,omitempty" dc:"文件大小(字节)"`
|
|
|
|
|
|
FileName string `json:"fileName,omitempty" dc:"文件名"`
|
|
|
|
|
|
FileFormat string `json:"fileFormat,omitempty" dc:"文件格式"`
|
|
|
|
|
|
FileAddressPrefix string `json:"fileAddressPrefix,omitempty" dc:"MinIO地址前缀"`
|
|
|
|
|
|
MethodUsed string `json:"methodUsed,omitempty" dc:"实际使用的拼接方式"`
|
|
|
|
|
|
DurationStr string `json:"durationStr,omitempty" dc:"拼接后时长"`
|
|
|
|
|
|
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
|
|
|
|
|
|
CreatedAt int64 `json:"createdAt" dc:"创建时间戳"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------- 上传工具 ----------
|
|
|
|
|
|
|
2026-05-20 11:32:39 +08:00
|
|
|
|
// UploadFileBytesReq 上传文件请求(字节流)
|
|
|
|
|
|
type UploadFileBytesReq struct {
|
|
|
|
|
|
FileName string `json:"fileName" dc:"文件名"`
|
|
|
|
|
|
FileBytes []byte `json:"fileBytes" dc:"文件字节流"`
|
|
|
|
|
|
FileStoreURL string `json:"fileStoreURL" dc:"文件存储路径"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UploadFileBytesRes 上传文件响应
|
|
|
|
|
|
type UploadFileBytesRes struct {
|
|
|
|
|
|
FileURL string `json:"fileURL" dc:"上传地址"`
|
|
|
|
|
|
FileSize int `json:"fileSize" dc:"文件大小"`
|
|
|
|
|
|
FileName string `json:"fileName" dc:"文件名称"`
|
|
|
|
|
|
FileFormat string `json:"fileFormat" dc:"文件格式"`
|
|
|
|
|
|
FileAddressPrefix string `json:"fileAddressPrefix"`
|
2026-05-19 14:33:06 +08:00
|
|
|
|
}
|