예제 #1
0
func TestRTPRelay(t *testing.T) {
	// make a video source, send it via RTP to localhost, depayload it

	// source:
	// filesrc location=t/test.mp4 ! qtdemux name=demuxer  demuxer.video_0 ! rtph264pay config-interval=1 ! udpsink host=127.0.0.1 port=5000
	// sink:
	// udpsrc uri=udp://127.0.0.1:5000 caps="application/x-rtp,media=(string)video" ! rtpjitterbuffer ! rtph264depay ! decodebin ! autovideosink sync=false

	sender := getH264RTPSender(t)
	receiver := getH264RTPReceiver(t)
	assert.NotNil(t, sender, "Constructed RTP sender")
	assert.NotNil(t, receiver, "Constructed RTP receiver")

	senderPipeline := gst.NewPipeline("rtpSender")
	senderPipeline.Add(sender.AsElement())
	receiverPipeline := gst.NewPipeline("rtpReceiver")
	receiverPipeline.Add(receiver.AsElement())

	receiverPipeline.SetState(gst.STATE_PLAYING)
	// senderPipeline.SetState(gst.STATE_PLAYING)
	receiverPipeline.GetBus().AddSignalWatch()
	receiverPipeline.GetBus().Connect("message::error", gstError, nil)

	RunMainLoop()
}
예제 #2
0
/*
  this connects to an IP camera and receives an event on a channel when
  a stream has been made available

hayward~/dev/panoptic-client (master)? $ go run camrelay.go
got src pad:  /GstPipeline:camrelay/GstURIDecodeBin:uri-decoder.GstGhostPad:src_0

*/
func main() {
	// camera stream source
	// ss := panoptic.NewStreamSource("rtsp://10.0.2.70/mpeg4/media.amp")
	ss := panoptic.NewFileSource("./t/test.mp4")

	// output (test)
	sink := gst.ElementFactoryMake("autovideosink", "video-output")

	// pipeline
	pl := gst.NewPipeline("camrelay")
	pl.Add(ss.URISrc, sink)
	pl.SetState(gst.STATE_PLAYING)

	go uriDecodeStatus(ss)

	panoptic.RunMainLoop()
}