Add IDs for disambiguation to graph elements

This commit is contained in:
Ingo Oppermann
2025-03-12 21:08:33 +01:00
parent 5ab1333a54
commit 9557f7e10a
8 changed files with 60 additions and 0 deletions

View File

@@ -6510,6 +6510,9 @@ const docTemplate = `{
"dst_filter": {
"type": "string"
},
"dst_id": {
"type": "string"
},
"dst_name": {
"type": "string"
},
@@ -6522,6 +6525,9 @@ const docTemplate = `{
"height": {
"type": "integer"
},
"id": {
"type": "string"
},
"index": {
"type": "integer"
},
@@ -6559,6 +6565,9 @@ const docTemplate = `{
"copy": {
"type": "boolean"
},
"id": {
"type": "string"
},
"index": {
"type": "integer"
},

View File

@@ -6503,6 +6503,9 @@
"dst_filter": {
"type": "string"
},
"dst_id": {
"type": "string"
},
"dst_name": {
"type": "string"
},
@@ -6515,6 +6518,9 @@
"height": {
"type": "integer"
},
"id": {
"type": "string"
},
"index": {
"type": "integer"
},
@@ -6552,6 +6558,9 @@
"copy": {
"type": "boolean"
},
"id": {
"type": "string"
},
"index": {
"type": "integer"
},

View File

@@ -975,6 +975,8 @@ definitions:
properties:
dst_filter:
type: string
dst_id:
type: string
dst_name:
type: string
filter:
@@ -983,6 +985,8 @@ definitions:
type: string
height:
type: integer
id:
type: string
index:
type: integer
inpad:
@@ -1008,6 +1012,8 @@ definitions:
properties:
copy:
type: boolean
id:
type: string
index:
type: integer
input:

View File

@@ -309,8 +309,10 @@ func (io *ffmpegProcessIO) export() ProgressIO {
}
type ffmpegGraphElement struct {
SrcID string `json:"src_id"`
SrcName string `json:"src_name"`
SrcFilter string `json:"src_filter"`
DstID string `json:"dst_id"`
DstName string `json:"dst_name"`
DstFilter string `json:"dst_filter"`
Inpad string `json:"inpad"`
@@ -334,6 +336,7 @@ type ffmpegGraphMapping struct {
Output *ffmpegMappingIO `json:"output"`
Graph struct {
Index int `json:"index"`
ID string `json:"id"`
Name string `json:"name"`
} `json:"graph"`
Copy bool `json:"copy"`
@@ -363,8 +366,10 @@ func (f *ffmpegProcess) ExportMapping() StreamMapping {
for _, g := range graph.Graph {
e := GraphElement{
Index: graph.Index,
ID: g.SrcID,
Name: g.SrcName,
Filter: g.SrcFilter,
DstID: g.DstID,
DstName: g.DstName,
DstFilter: g.DstFilter,
Inpad: g.Inpad,
@@ -387,6 +392,7 @@ func (f *ffmpegProcess) ExportMapping() StreamMapping {
Input: -1,
Output: -1,
Index: fm.Graph.Index,
ID: fm.Graph.ID,
Name: fm.Graph.Name,
Copy: fm.Copy,
}
@@ -614,8 +620,10 @@ type UsageGPUMemory struct {
type GraphElement struct {
Index int
ID string
Name string
Filter string
DstID string
DstName string
DstFilter string
Inpad string
@@ -633,6 +641,7 @@ type GraphMapping struct {
Input int
Output int
Index int
ID string
Name string
Copy bool
}

View File

@@ -252,8 +252,10 @@ func (p *Progress) Marshal() app.Progress {
type GraphElement struct {
Index int `json:"index"`
ID string `json:"id"`
Name string `json:"name"`
Filter string `json:"filter"`
DstID string `json:"dst_id"`
DstName string `json:"dst_name"`
DstFilter string `json:"dst_filter"`
Inpad string `json:"inpad"`
@@ -269,8 +271,10 @@ type GraphElement struct {
func (g *GraphElement) Unmarshal(a *app.GraphElement) {
g.Index = a.Index
g.ID = a.ID
g.Name = a.Name
g.Filter = a.Filter
g.DstID = a.DstID
g.DstName = a.DstName
g.DstFilter = a.DstFilter
g.Inpad = a.Inpad
@@ -287,8 +291,10 @@ func (g *GraphElement) Unmarshal(a *app.GraphElement) {
func (g *GraphElement) Marshal() app.GraphElement {
a := app.GraphElement{
Index: g.Index,
ID: g.ID,
Name: g.Name,
Filter: g.Filter,
DstID: g.DstID,
DstName: g.DstName,
DstFilter: g.DstFilter,
Inpad: g.Inpad,
@@ -309,6 +315,7 @@ type GraphMapping struct {
Input int `json:"input"`
Output int `json:"output"`
Index int `json:"index"`
ID string `json:"id"`
Name string `json:"name"`
Copy bool `json:"copy"`
}
@@ -317,6 +324,7 @@ func (g *GraphMapping) Unmarshal(a *app.GraphMapping) {
g.Input = a.Input
g.Output = a.Output
g.Index = a.Index
g.ID = a.ID
g.Name = a.Name
g.Copy = a.Copy
}
@@ -326,6 +334,7 @@ func (g *GraphMapping) Marshal() app.GraphMapping {
Input: g.Input,
Output: g.Output,
Index: g.Index,
ID: g.ID,
Name: g.Name,
Copy: g.Copy,
}

View File

@@ -147,8 +147,10 @@ func TestProcessReportHistoryEntry(t *testing.T) {
Graphs: []app.GraphElement{
{
Index: 5,
ID: "id",
Name: "foobar",
Filter: "infilter",
DstID: "dstid",
DstName: "outfilter_",
DstFilter: "outfilter",
Inpad: "inpad",
@@ -167,6 +169,7 @@ func TestProcessReportHistoryEntry(t *testing.T) {
Input: 1,
Output: 3,
Index: 39,
ID: "id",
Name: "foobar",
Copy: true,
},
@@ -339,8 +342,10 @@ func TestProcessReport(t *testing.T) {
Graphs: []app.GraphElement{
{
Index: 5,
ID: "id",
Name: "foobar",
Filter: "infilter",
DstID: "dstid",
DstName: "outfilter_",
DstFilter: "outfilter",
Inpad: "inpad",
@@ -359,6 +364,7 @@ func TestProcessReport(t *testing.T) {
Input: 1,
Output: 3,
Index: 39,
ID: "id",
Name: "foobar",
Copy: true,
},

View File

@@ -203,8 +203,10 @@ func (p *Progress) MarshalParser() parse.Progress {
type GraphElement struct {
Index int
ID string
Name string
Filter string
DstID string
DstName string
DstFilter string
Inpad string
@@ -220,8 +222,10 @@ type GraphElement struct {
func (g *GraphElement) UnmarshalParser(p *parse.GraphElement) {
g.Index = p.Index
g.ID = p.ID
g.Name = p.Name
g.Filter = p.Filter
g.DstID = p.DstID
g.DstName = p.DstName
g.DstFilter = p.DstFilter
g.Inpad = p.Inpad
@@ -238,8 +242,10 @@ func (g *GraphElement) UnmarshalParser(p *parse.GraphElement) {
func (g *GraphElement) MarshalParser() parse.GraphElement {
p := parse.GraphElement{
Index: g.Index,
ID: g.ID,
Name: g.Name,
Filter: g.Filter,
DstID: g.DstID,
DstName: g.DstName,
DstFilter: g.DstFilter,
Inpad: g.Inpad,
@@ -260,6 +266,7 @@ type GraphMapping struct {
Input int // Index of input stream, negative if output element
Output int // Index of output stream, negative if input element
Index int // Index of the graph, negative if streamcopy
ID string // ID of the source resp. destination, empty if streamcopy, the name can be ambigous
Name string // Name of the source resp. destination, empty if streamcopy
Copy bool // Whether it's a streamcopy i.e. there's no graph
}
@@ -268,6 +275,7 @@ func (g *GraphMapping) UnmarshalParser(p *parse.GraphMapping) {
g.Input = p.Input
g.Output = p.Output
g.Index = p.Index
g.ID = p.ID
g.Name = p.Name
g.Copy = p.Copy
}
@@ -277,6 +285,7 @@ func (g *GraphMapping) MarshalParser() parse.GraphMapping {
Input: g.Input,
Output: g.Output,
Index: g.Index,
ID: g.ID,
Name: g.Name,
Copy: g.Copy,
}

View File

@@ -178,8 +178,10 @@ func TestStreamMapping(t *testing.T) {
Graphs: []parse.GraphElement{
{
Index: 5,
ID: "id",
Name: "foobar",
Filter: "infilter",
DstID: "dstid",
DstName: "outfilter_",
DstFilter: "outfilter",
Inpad: "inpad",
@@ -198,6 +200,7 @@ func TestStreamMapping(t *testing.T) {
Input: 1,
Output: 3,
Index: 39,
ID: "id",
Name: "foobar",
Copy: true,
},