mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-05 16:06:52 +08:00
Merge pull request #61 from alef-ru/dev/input-order
Fixed incorrect order of input files
This commit is contained in:
@@ -343,6 +343,25 @@ func TestView(t *testing.T) {
|
|||||||
t.Log(b)
|
t.Log(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInputOrder(t *testing.T) {
|
||||||
|
const streamNum = 12
|
||||||
|
streams := make([]*Stream, 0, streamNum)
|
||||||
|
expectedFilenames := make([]string, 0, streamNum)
|
||||||
|
for i := 0; i < streamNum; i++ {
|
||||||
|
filename := fmt.Sprintf("%02d.mp4", i) // These files don't exist, but it's fine in this test.
|
||||||
|
expectedFilenames = append(expectedFilenames, filename)
|
||||||
|
streams = append(streams, Input(filename))
|
||||||
|
}
|
||||||
|
stream := Concat(streams).Output("output.mp4")
|
||||||
|
args := stream.GetArgs()
|
||||||
|
actualFilenames := make([]string, 0, streamNum)
|
||||||
|
//Command looks like `-i 00.mp4 -i 01.mp4...` so actual filenames are the first streamNum even args
|
||||||
|
for i := 1; i <= streamNum*2; i += 2 {
|
||||||
|
actualFilenames = append(actualFilenames, args[i])
|
||||||
|
}
|
||||||
|
assert.Equal(t, expectedFilenames, actualFilenames)
|
||||||
|
}
|
||||||
|
|
||||||
func printArgs(args []string) {
|
func printArgs(args []string) {
|
||||||
for _, a := range args {
|
for _, a := range args {
|
||||||
fmt.Printf("%s ", a)
|
fmt.Printf("%s ", a)
|
||||||
|
2
node.go
2
node.go
@@ -201,7 +201,7 @@ func (n *Node) __getIncomingEdgeMap() map[Label]NodeInfo {
|
|||||||
incomingEdgeMap := map[Label]NodeInfo{}
|
incomingEdgeMap := map[Label]NodeInfo{}
|
||||||
streamMap := getStreamMap(n.streamSpec)
|
streamMap := getStreamMap(n.streamSpec)
|
||||||
for i, s := range streamMap {
|
for i, s := range streamMap {
|
||||||
incomingEdgeMap[Label(fmt.Sprintf("%v", i))] = NodeInfo{
|
incomingEdgeMap[Label(fmt.Sprintf("%06v", i))] = NodeInfo{
|
||||||
Node: s.Node,
|
Node: s.Node,
|
||||||
Label: s.Label,
|
Label: s.Label,
|
||||||
Selector: s.Selector,
|
Selector: s.Selector,
|
||||||
|
Reference in New Issue
Block a user