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) }