func CallC(rc *impl.RCM_Cmd) (interface{}, error) { var cid = rc.Kvs().StrVal("cid") log.D("run_rc_s doing call_c by cid(%v)", cid) var cmd = rcs.CmdC(cid) if cmd == nil { return util.Map{ "code": -1, "err": "not found", }, nil } var name = rc.StrVal("name") var args = rc.MapVal("args") log.D("run_rc_s call client by name(%v),args(%v)", name, util.S2Json(args)) var res, err = cmd.Exec_m(name, args) log.D("run_rc_s call client result->%v", util.S2Json(res)) return res, err }
func TestParseVideo(t *testing.T) { FFPROBE_C = "/usr/local/bin/ffprobe" video, err := ParseVideo("xx.mp4") if err != nil { t.Error(err.Error()) return } fmt.Println(util.S2Json(video)) video, err = ParseVideo("ffcm.go") if err == nil { t.Error("error") return } ParseStreams("xx") ParseData("@lx:xds", "\\[[/]*STREAM\\]") }
func (a *AbsV) Build(dtcm *dtm.DTCM_S, id, info interface{}, args ...interface{}) (interface{}, interface{}, []interface{}, error) { var src = fmt.Sprintf("%v", args[0]) video, err := ParseVideo(filepath.Join(a.WDir, src)) if err != nil { err = util.Err("AbsV parse video by src(%v) error->%v", src, err) log.E("%v", err) return nil, nil, nil, err } video.Info = info video.Alias = a.Alias var mv, _ = util.Json2Map(util.S2Json(video)) var tw, th, dur = video.Width, video.Height, int64(video.Duration * 1000000) var dst interface{} if len(args) > 1 { dst = args[1] } else { dst = strings.TrimSuffix(src, filepath.Ext(src)) } log.D("AbsV adding task by src(%v),width(%v),height(%v),duration(%v)", src, tw, th, dur) return id, mv, []interface{}{ src, dst, tw, th, dur, }, nil }
func Args_m(rc *impl.RCM_Cmd) (interface{}, error) { log.D("run_rc_s doing Args_m->%v", util.S2Json(rc.Map)) return rc.Map, nil }