Skip to content

Commit 5b5d198

Browse files
committed
Updated
1 parent 53a1700 commit 5b5d198

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

Makefile

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Paths to packages
22
GO=$(shell which go)
33
DOCKER=$(shell which docker)
4+
PKG_CONFIG=$(shell which pkg-config)
45

56
# Source version
67
FFMPEG_VERSION=ffmpeg-7.1.1
@@ -63,13 +64,12 @@ ${BUILD_DIR}/${FFMPEG_VERSION}:
6364

6465
# Configure ffmpeg
6566
.PHONY: ffmpeg-configure
66-
ffmpeg-configure: mkdir ${BUILD_DIR}/${FFMPEG_VERSION} ffmpeg-dep
67+
ffmpeg-configure: mkdir pkconfig-dep ${BUILD_DIR}/${FFMPEG_VERSION} ffmpeg-dep
6768
@echo "Configuring ${FFMPEG_VERSION} => ${PREFIX}"
6869
@cd ${BUILD_DIR}/${FFMPEG_VERSION} && ./configure \
69-
--enable-static --disable-doc --disable-programs \
70+
--disable-doc --disable-programs \
7071
--prefix="$(shell realpath ${PREFIX})" \
71-
--pkg-config-flags="--static" \
72-
--extra-libs="-lpthread" \
72+
--enable-static --pkg-config="${PKG_CONFIG}" --pkg-config-flags="--static" --extra-libs="-lpthread" \
7373
--enable-gpl --enable-nonfree ${FFMPEG_CONFIG}
7474

7575
# Build ffmpeg
@@ -198,6 +198,11 @@ go-dep:
198198
docker-dep:
199199
@test -f "${DOCKER}" && test -x "${DOCKER}" || (echo "Missing docker binary" && exit 1)
200200

201+
.PHONY: pkconfig-dep
202+
pkconfig-dep:
203+
@test -f "${PKG_CONFIG}" && test -x "${PKG_CONFIG}" || (echo "Missing pkg-config binary" && exit 1)
204+
205+
201206
.PHONY: mkdir
202207
mkdir:
203208
@echo Mkdir ${BUILD_DIR}
@@ -218,15 +223,19 @@ clean: go-tidy
218223
# Check for FFmpeg dependencies
219224
.PHONY: ffmpeg-dep
220225
ffmpeg-dep:
221-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists libass && echo "--enable-libass"))
222-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists fdk-aac && echo "--enable-libfdk-aac"))
223-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists lame && echo "--enable-libmp3lame"))
224-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists freetype2 && echo "--enable-libfreetype"))
225-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists theora && echo "--enable-libtheora"))
226-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists vorbis && echo "--enable-libvorbis"))
227-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists opus && echo "--enable-libopus"))
228-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists x264 && echo "--enable-libx264"))
229-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists x265 && echo "--enable-libx265"))
230-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists xvid && echo "--enable-libxvid"))
231-
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell pkg-config --exists vpx && echo "--enable-libvpx"))
226+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists libass && echo "--enable-libass"))
227+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists fdk-aac && echo "--enable-libfdk-aac"))
228+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists lame && echo "--enable-libmp3lame"))
229+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists freetype2 && echo "--enable-libfreetype"))
230+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists theora && echo "--enable-libtheora"))
231+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists vorbis && echo "--enable-libvorbis"))
232+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists opus && echo "--enable-libopus"))
233+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists x264 && echo "--enable-libx264"))
234+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists x265 && echo "--enable-libx265"))
235+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists xvid && echo "--enable-libxvid"))
236+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists vpx && echo "--enable-libvpx"))
237+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists libgcrypt && echo "--enable-gcrypt"))
238+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists aom && echo "--enable-libaom"))
239+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists libbluray && echo "--enable-libbluray"))
240+
$(eval FFMPEG_CONFIG := $(FFMPEG_CONFIG) $(shell ${PKG_CONFIG} --exists dav1d && echo "--enable-libdav1d"))
232241
@echo "FFmpeg configuration: $(FFMPEG_CONFIG)"

pkg/avfilter/graph.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package avfilter
22

33
import (
44
"errors"
5+
"fmt"
56

67
// Packages
78
media "github.com/mutablelogic/go-media"
@@ -48,6 +49,8 @@ func ParseGraph(desc string) (*Graph, error) {
4849
graph.out = out
4950
}
5051

52+
fmt.Println("graph=", graph)
53+
5154
// Validate the graph
5255
if err := ff.AVFilterGraph_config(graph.ctx); err != nil {
5356
return nil, errors.Join(err, graph.Close())

sys/ffmpeg71/avfilter_graph.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ func AVFilterGraph_create_filter(graph *AVFilterGraph, filter *AVFilter, name, a
7373
func AVFilterGraph_parse(graph *AVFilterGraph, filters string) ([]*AVFilterInOut, []*AVFilterInOut, error) {
7474
var ins, outs *AVFilterInOut
7575

76+
// Allocate cstring for the filter spec
7677
cFilters := C.CString(filters)
7778
defer C.free(unsafe.Pointer(cFilters))
79+
80+
// First attempt to parse the filter graph: returns any inputs and outputs
7881
if err := AVError(C.avfilter_graph_parse_ptr((*C.AVFilterGraph)(graph), cFilters, (**C.AVFilterInOut)(unsafe.Pointer(&ins)), (**C.AVFilterInOut)(unsafe.Pointer(&outs)), nil)); err != 0 {
7982
AVFilterInOut_free(ins)
8083
AVFilterInOut_free(outs)
8184
return nil, nil, fmt.Errorf("avfilter_graph_parse: %w", err)
8285
}
8386

84-
// TODO: If ins is 0 and outs is 0, we return the linked list of inputs and outputs
85-
// Or else we try again with the ins and outs
86-
8787
// Return success
8888
return AVFilterInOut_list(ins), AVFilterInOut_list(outs), nil
8989
}

sys/ffmpeg71/avfilter_graph_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ func Test_avfilter_graph_002(t *testing.T) {
4646
defer ff.AVFilterInOut_list_free(in)
4747
defer ff.AVFilterInOut_list_free(out)
4848

49-
// Configure the graph
50-
err = ff.AVFilterGraph_config(graph)
51-
if !assert.NoError(err) {
52-
t.FailNow()
53-
}
54-
5549
t.Log("graph=", graph)
56-
50+
t.Log("in=", in)
51+
t.Log("out=", out)
52+
53+
// One input and one output
54+
assert.Len(in, 1)
55+
assert.Equal("a", in[0].Name())
56+
assert.Len(out, 1)
57+
assert.Equal("b", out[0].Name())
5758
}

0 commit comments

Comments
 (0)