-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package astiav | ||
|
||
//#include <libavfilter/avfilter.h> | ||
import "C" | ||
import ( | ||
"math" | ||
"unsafe" | ||
) | ||
|
||
// https://github.com/FFmpeg/FFmpeg/blob/n7.0/libavfilter/avfilter.h#L1142 | ||
type FilterChain struct { | ||
c *C.AVFilterChain | ||
} | ||
|
||
func newFilterChainFromC(c *C.AVFilterChain) *FilterChain { | ||
if c == nil { | ||
return nil | ||
} | ||
return &FilterChain{c: c} | ||
} | ||
|
||
func (fc *FilterChain) Filters() (fs []*FilterParams) { | ||
fcs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterParams)(nil))](*C.AVFilterParams))(unsafe.Pointer(fc.c.filters)) | ||
for i := 0; i < fc.NbFilters(); i++ { | ||
fs = append(fs, newFilterParamsFromC(fcs[i])) | ||
} | ||
return | ||
} | ||
|
||
func (fc *FilterChain) NbFilters() int { | ||
return int(fc.c.nb_filters) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package astiav | ||
|
||
//#include <libavfilter/avfilter.h> | ||
import "C" | ||
import ( | ||
"math" | ||
"unsafe" | ||
) | ||
|
||
// https://github.com/FFmpeg/FFmpeg/blob/n7.0/libavfilter/avfilter.h#L1156 | ||
type FilterGraphSegment struct { | ||
c *C.AVFilterGraphSegment | ||
} | ||
|
||
func newFilterGraphSegmentFromC(c *C.AVFilterGraphSegment) *FilterGraphSegment { | ||
if c == nil { | ||
return nil | ||
} | ||
return &FilterGraphSegment{c: c} | ||
} | ||
|
||
func (fgs *FilterGraphSegment) Free() { | ||
C.avfilter_graph_segment_free(&fgs.c) | ||
} | ||
|
||
func (fgs *FilterGraphSegment) Chains() (cs []*FilterChain) { | ||
ccs := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.AVFilterChain)(nil))](*C.AVFilterChain))(unsafe.Pointer(fgs.c.chains)) | ||
for i := 0; i < fgs.NbChains(); i++ { | ||
cs = append(cs, newFilterChainFromC(ccs[i])) | ||
} | ||
return | ||
} | ||
|
||
func (fgs *FilterGraphSegment) NbChains() int { | ||
return int(fgs.c.nb_chains) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package astiav | ||
|
||
// Struct attributes are internal but there are C functions to get some of them | ||
type FilterPad struct { | ||
mediaType MediaType | ||
} | ||
|
||
func newFilterPad(mediaType MediaType) *FilterPad { | ||
return &FilterPad{mediaType: mediaType} | ||
} | ||
|
||
func (fp *FilterPad) MediaType() MediaType { | ||
return fp.mediaType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package astiav | ||
|
||
//#include <libavfilter/avfilter.h> | ||
import "C" | ||
|
||
// https://github.com/FFmpeg/FFmpeg/blob/n7.0/libavfilter/avfilter.h#L1075 | ||
type FilterParams struct { | ||
c *C.AVFilterParams | ||
} | ||
|
||
func newFilterParamsFromC(c *C.AVFilterParams) *FilterParams { | ||
if c == nil { | ||
return nil | ||
} | ||
return &FilterParams{c: c} | ||
} | ||
|
||
func (fp *FilterParams) FilterName() string { | ||
return C.GoString(fp.c.filter_name) | ||
} |