Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge master and add SetHardwareDeviceContext #126

Merged
merged 41 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ce9d0b5
OpenIOContextWithDictionary
oldma3095 Dec 10, 2024
7aed9ec
OpenIOContext
oldma3095 Dec 11, 2024
314f10a
Merge branch 'asticode:master' into master
oldma3095 Dec 11, 2024
27d143e
OpenIOContext
oldma3095 Dec 11, 2024
12d7b00
Merge branch 'asticode:master' into master
oldma3095 Dec 12, 2024
e4f6abc
IOInterrupterCB
oldma3095 Dec 12, 2024
7bf889d
Merge remote-tracking branch 'origin/master'
oldma3095 Dec 12, 2024
a3c8b86
OpenIOContext(filename string, flags IOContextFlags, ii *IOInterrupte…
oldma3095 Dec 12, 2024
37d482b
Merge branch 'asticode:master' into master
oldma3095 Dec 13, 2024
9894cd7
Program and Discard
oldma3095 Dec 13, 2024
385462d
Program and Discard
oldma3095 Dec 13, 2024
e80f3cc
Program and Discard
oldma3095 Dec 13, 2024
ffb44b5
Program and Discard
oldma3095 Dec 13, 2024
64a05c0
Program and Discard
oldma3095 Dec 14, 2024
213eb46
Program and Discard
oldma3095 Dec 14, 2024
a24d493
CodecContext
oldma3095 Dec 16, 2024
6750680
another pr
oldma3095 Dec 17, 2024
5bcf207
delete Flags()
oldma3095 Dec 17, 2024
cf06f77
delete Flags()
oldma3095 Dec 17, 2024
c0e22af
delete Flags()
oldma3095 Dec 17, 2024
4fb268f
delete PmtVersion()
oldma3095 Dec 17, 2024
13bb060
SetStreamIndex
oldma3095 Dec 18, 2024
dec5570
SetStreamIndex
oldma3095 Dec 18, 2024
08409f4
Merge remote-tracking branch 'origin/master'
oldma3095 Dec 18, 2024
a27bb0f
MaxBFrames()
oldma3095 Dec 18, 2024
eb4cba6
rename rate control methods
oldma3095 Dec 19, 2024
882e8d8
test passed
oldma3095 Dec 19, 2024
0b0a9f0
Merge branch 'asticode:master' into master
oldma3095 Dec 20, 2024
843ae8d
Merge branch 'asticode:master' into master
oldma3095 Dec 20, 2024
b46e692
Merge branch 'asticode:master' into master
oldma3095 Dec 23, 2024
2b1c488
bufferSrcCtx initialize with dictionary
oldma3095 Dec 23, 2024
a5aeb81
bufferSrcCtx initialize with dictionary
oldma3095 Dec 23, 2024
f827411
SetHardwareDeviceContext
oldma3095 Dec 23, 2024
5271cbc
SetHardwareDeviceContext
oldma3095 Dec 23, 2024
6359aba
Merge remote-tracking branch 'origin/master'
oldma3095 Dec 23, 2024
144ff0b
FilterGraph.NbFilters()
oldma3095 Dec 23, 2024
9a24afc
filter_graph_test
oldma3095 Dec 24, 2024
1540ebf
Merge remote-tracking branch 'origin/master'
oldma3095 Dec 24, 2024
876caa5
FilterGraph.Dump
oldma3095 Dec 24, 2024
3e0bc8f
FilterGraph.Dump
oldma3095 Dec 24, 2024
3304eea
remove FilterGraph.Dump
oldma3095 Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions filter_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ func (fc *FilterContext) Class() *Class {
return newClassFromC(unsafe.Pointer(fc.c))
}

// https://ffmpeg.org/doxygen/7.0/structAVFilterContext.html#addd946fbe5af506a2b19f9ad7cb97c35
func (fc *FilterContext) SetHardwareDeviceContext(hdc *HardwareDeviceContext) {
if fc.c.hw_device_ctx != nil {
C.av_buffer_unref(&fc.c.hw_device_ctx)
}
if hdc != nil {
fc.c.hw_device_ctx = C.av_buffer_ref(hdc.c)
} else {
fc.c.hw_device_ctx = nil
}
}

// https://ffmpeg.org/doxygen/7.0/structAVFilterContext.html#a6eee53e57dddfa7cca1cade870c8a44e
func (fc *FilterContext) Filter() *Filter {
return newFilterFromC(fc.c.filter)
Expand Down
25 changes: 25 additions & 0 deletions filter_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package astiav
import "C"
import (
"errors"
"math"
"unsafe"
)

Expand Down Expand Up @@ -154,3 +155,27 @@ func (g *FilterGraph) SendCommand(target, cmd, args string, f FilterCommandFlags
})
return
}

// https://ffmpeg.org/doxygen/7.0/structAVFilterGraph.html#a0ba5c820c760788ea5f8e40c476f9704
func (g *FilterGraph) NbFilters() int {
return int(g.c.nb_filters)
}

// https://ffmpeg.org/doxygen/7.0/structAVFilterGraph.html#a1dafd3d239f7c2f5e3ac109578ef926d
func (g *FilterGraph) Filters() (fs []*FilterContext) {
fcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterContext)(nil))](*C.AVFilterContext))(unsafe.Pointer(g.c.filters))
for i := 0; i < g.NbFilters(); i++ {
fs = append(fs, newFilterContext(fcs[i]))
}
return
}

// https://ffmpeg.org/doxygen/7.0/group__lavfi.html#gadb442aca4e5a8c3ba740f6049f0a288b
func (g *FilterGraph) Dump() string {
oldma3095 marked this conversation as resolved.
Show resolved Hide resolved
var res = C.avfilter_graph_dump(g.c, nil)
if res == nil {
return ""
}
defer C.free(unsafe.Pointer(res))
return C.GoString(res)
}
9 changes: 9 additions & 0 deletions filter_graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,17 @@ func TestFilterGraph(t *testing.T) {
outputs = o
}

require.Equal(t, len(buffersrcContexts)+1, fg.NbFilters())
fs := fg.Filters()
require.Equal(t, len(buffersrcContexts)+1, len(fs))
require.Equal(t, buffersinkContext.FilterContext(), fs[0])
for idx, c := range fs[1:] {
require.Equal(t, buffersrcContexts[idx].FilterContext(), c)
}

require.NoError(t, fg.Parse(v.content, inputs, outputs))
require.NoError(t, fg.Configure())
require.NotEmpty(t, fg.Dump())

require.Equal(t, v.buffersink.frameRate, buffersinkContext.FrameRate())
require.Equal(t, v.buffersink.mediaType, buffersinkContext.MediaType())
Expand Down
Loading