You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
701 B
35 lines
701 B
package ffmpeg
|
|
|
|
import (
|
|
"go.uber.org/zap"
|
|
"ycmediakit/internal/pkg/global"
|
|
"ycmediakit/internal/pkg/result"
|
|
"ycmediakit/internal/pkg/server/ffmpegServer"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var (
|
|
cfg *ffmpegServer.FfmpegConfig
|
|
log *zap.Logger
|
|
)
|
|
|
|
func init() {
|
|
cfg = &global.AppConfig.Ffmpeg
|
|
log = zap.L()
|
|
}
|
|
|
|
func ProbeStream(c *gin.Context) {
|
|
target := c.Query("target")
|
|
target, ok := ffmpegServer.PrepareUrl(target)
|
|
if !ok {
|
|
result.InvalidParams.WithVoidData().Failure(c)
|
|
return
|
|
}
|
|
jsonStr, err := ffmpegServer.ProbeStreamsWithTimeout(target, cfg.Timeout)
|
|
if err != nil {
|
|
result.Wrong.WithVoidData().WithMsg(err.Error()).Error(c)
|
|
return
|
|
}
|
|
result.Ok.WithData(jsonStr).Success(c)
|
|
}
|
|
|