Merge pull request #3 from andrewiankidd/ffprobe-default-opts

expose ProbeWithTimeout functionality without default options
This commit is contained in:
leiiwang
2021-05-20 10:11:31 +08:00
committed by GitHub

View File

@@ -13,8 +13,17 @@ func Probe(fileName string, kwargs ...KwArgs) (string, error) {
} }
func ProbeWithTimeout(fileName string, timeOut time.Duration, kwargs KwArgs) (string, error) { func ProbeWithTimeout(fileName string, timeOut time.Duration, kwargs KwArgs) (string, error) {
args := []string{"-show_format", "-show_streams", "-of", "json"} args := KwArgs{
args = append(args, ConvertKwargsToCmdLineArgs(kwargs)...) "show_format": "",
"show_streams": "",
"of": "json",
}
return ProbeWithTimeoutExec(fileName, timeOut, MergeKwArgs([]KwArgs{args, kwargs}))
}
func ProbeWithTimeoutExec(fileName string, timeOut time.Duration, kwargs KwArgs) (string, error) {
args := ConvertKwargsToCmdLineArgs(kwargs)
args = append(args, fileName) args = append(args, fileName)
ctx := context.Background() ctx := context.Background()
if timeOut > 0 { if timeOut > 0 {