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

How to build properly on Windows? #22

Open
darkvertex opened this issue Dec 23, 2020 · 2 comments
Open

How to build properly on Windows? #22

darkvertex opened this issue Dec 23, 2020 · 2 comments

Comments

@darkvertex
Copy link

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}
@notedit
Copy link
Owner

notedit commented Dec 23, 2020

I do not have a windows device, sorry.

@jinzhongmin
Copy link

是不是没有运行 MainLoopNew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants