gst icon indicating copy to clipboard operation
gst copied to clipboard

How to build properly on Windows?

Open darkvertex opened this issue 3 years ago • 2 comments

Hello,

What is the correct procedure to get one of the examples working on Windows?

I probably missed something silly, but I tried downloading and installing https://gstreamer.freedesktop.org/data/pkg/windows/1.18.2/mingw/gstreamer-1.0-devel-mingw-x86_64-1.18.2.msi then I tried to go build one of the examples:

package main

import (
	"fmt"
	"log"
	"time"

	"github.com/notedit/gst"
)

func main() {
	log.Printf("HELLO")

	pipeline, err := gst.ParseLaunch("appsrc name=mysource format=time is-live=true do-timestamp=true ! videoconvert ! autovideosink")

	if err != nil {
		panic("pipeline error")
	}
	log.Printf("pipe: %v", pipeline)
	videoCap := gst.CapsFromString("video/x-raw,format=RGB,width=320,height=240,bpp=24,depth=24")

	element := pipeline.GetByName("mysource")

	element.SetObject("caps", videoCap)

	pipeline.SetState(gst.StatePlaying)

	i := 0
	for {

		if i > 100 {
			break
		}

		data := make([]byte, 320*240*3)

		err := element.PushBuffer(data)

		if err != nil {
			fmt.Println("push buffer error")
			break
		}

		fmt.Println("push one")
		i++
		time.Sleep(50000000)
	}

	pipeline.SetState(gst.StateNull)

	pipeline = nil
	element = nil
	videoCap = nil
}

After an error about PKG_CONFIG_PATH not set properly, I notice there is a folder with a bunch of .pc files, including C:\gstreamer\1.0\mingw_x86_64\lib\pkgconfig\gstreamer-1.0.pc

So I set my PKG_CONFIG_PATH env var to C:/gstreamer/1.0/mingw_x86_64/lib/pkgconfig and finally go build silently builds an .exe, yet when I run it nothing happens. No error, no console output, it just quits immediately.

Any ideas?

My gstreamer-1.0.pc looks like this:

prefix=C:/gstreamer/1.0/mingw_x86_64
exec_prefix=${prefix}
libexecdir=${prefix}/libexec
libdir=${prefix}/lib
includedir=${prefix}/include/gstreamer-1.0
toolsdir=${exec_prefix}/bin
pluginsdir=${prefix}/lib/gstreamer-1.0
datarootdir=${prefix}/share
datadir=${datarootdir}
girdir=${datadir}/gir-1.0
typelibdir=${libdir}/girepository-1.0
pluginscannerdir=${libexecdir}/gstreamer-1.0

Name: GStreamer
Description: Streaming media framework
Version: 1.18.2
Requires: glib-2.0, gobject-2.0
Requires.private: gmodule-no-export-2.0  
Libs: -L${libdir} -lgstreamer-1.0
Cflags: -I${includedir}

darkvertex avatar Dec 23 '20 03:12 darkvertex

I do not have a windows device, sorry.

notedit avatar Dec 23 '20 11:12 notedit

是不是没有运行 MainLoopNew

jinzhongmin avatar Apr 13 '22 01:04 jinzhongmin