Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 85 additions & 0 deletions cmd/wtf/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package main

import (
"fmt"
"os"

"github.com/tinyzimmer/go-glib/glib"
"github.com/tinyzimmer/go-gst/gst"
"github.com/tinyzimmer/go-gst/gst/app"
)

func MonitorPipeline(mainLoop *glib.MainLoop, pipeline *gst.Pipeline) func(msg *gst.Message) bool {
return func(msg *gst.Message) bool {
switch msg.Type() {
case gst.MessageEOS:
pipeline.BlockSetState(gst.StateNull)
mainLoop.Quit()
case gst.MessageError:
err := msg.ParseError()
fmt.Println("ERROR:", err.Error())
if debug := err.DebugString(); debug != "" {
fmt.Println("DEBUG:", debug)
}
mainLoop.Quit()
default:
fmt.Println(msg)
}
return true
}
}

func input() (*gst.Pipeline, *app.Sink) {
r, err := gst.NewPipelineFromString("videotestsrc ! vp8enc ! rtpvp8pay ! appsink name=sink")
if err != nil {
panic(err)
}

sink, err := r.GetElementByName("sink")
if err != nil {
panic(err)
}

return r, app.SinkFromElement(sink)
}

func output() (*gst.Pipeline, *app.Source) {
w, err := gst.NewPipelineFromString("appsrc name=source format=time ! rtpvp8depay ! vp8dec ! autovideosink")
if err != nil {
panic(err)
}

src, err := w.GetElementByName("source")
if err != nil {
panic(err)
}

return w, app.SrcFromElement(src)
}

func main() {
gst.Init(&os.Args)

mainLoop := glib.NewMainLoop(glib.MainContextDefault(), false)

r, sink := input()
w, src := output()

r.GetPipelineBus().AddWatch(MonitorPipeline(mainLoop, r))
w.GetPipelineBus().AddWatch(MonitorPipeline(mainLoop, w))

sink.SetCallbacks(&app.SinkCallbacks{
NewSampleFunc: func(sink *app.Sink) gst.FlowReturn {
sample := sink.PullSample()
if sample == nil {
return gst.FlowEOS
}
return src.PushSample(sample)
},
})

r.SetState(gst.StatePlaying)
w.SetState(gst.StatePlaying)

mainLoop.Run()
}
6 changes: 1 addition & 5 deletions examples/transcode-file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@ transcode-file is a simple application that shows how to transcode an ivf file o
go run main.go -addr localhost:50051 -i input.ivf -o output.ivf
```

You should see an `output.ivf` file produced. The output file does not contain the last ~1s
of video. This is a known issue due to the transcoder expecting live video sources, not
sources that terminate.

If you intend to transcode mostly non-live video sources, it would be easier to use ffmpeg :)
You should see an `output.ivf` file produced.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ require (
require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tinyzimmer/go-glib v0.0.24 // indirect
github.com/tinyzimmer/go-gst v0.2.32 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/text v0.3.7 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down Expand Up @@ -130,6 +132,10 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tinyzimmer/go-glib v0.0.24 h1:ktZZC22/9t88kGRgNEFV/SESgIWhGHE+q7Z7Qj++luw=
github.com/tinyzimmer/go-glib v0.0.24/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM=
github.com/tinyzimmer/go-gst v0.2.32 h1:bwJ1VfLyoeQPxuE7LgCTwwvMXFufnFoSws7QhaCfsY8=
github.com/tinyzimmer/go-gst v0.2.32/go.mod h1:V4h+HPS3mVGSwUJ7IBi3WAkJWITZasebERyqk3TEXUM=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
Expand Down
3 changes: 0 additions & 3 deletions internal/gst/README.md

This file was deleted.

61 changes: 0 additions & 61 deletions internal/gst/bin.go

This file was deleted.

22 changes: 0 additions & 22 deletions internal/gst/caps.go

This file was deleted.

141 changes: 0 additions & 141 deletions internal/gst/element.go

This file was deleted.

12 changes: 0 additions & 12 deletions internal/gst/gst.go

This file was deleted.

Loading