Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 42 lines (35 sloc) 1.15 KB
#! /usr/bin/env lua
--
-- Sample GStreamer application, port of public Vala GStreamer Audio
-- Stream Example (http://live.gnome.org/Vala/GStreamerSample)
--
local lgi = require 'lgi'
local GLib = lgi.GLib
local Gst = lgi.Gst
local main_loop = GLib.MainLoop()
local function bus_callback(bus, message)
if message.type.ERROR then
print('Error:', message:parse_error().message)
main_loop:quit()
elseif message.type.EOS then
print 'end of stream'
main_loop:quit()
elseif message.type.STATE_CHANGED then
local old, new, pending = message:parse_state_changed()
print(string.format('state changed: %s->%s:%s', old, new, pending))
elseif message.type.TAG then
message:parse_tag():foreach(
function(list, tag)
print(('tag: %s = %s'):format(tag, tostring(list:get(tag))))
end)
end
return true
end
local play = Gst.ElementFactory.make('playbin', 'play')
play.uri = 'http://ice1.somafm.com/dronezone-128-mp3'
--play.uri = 'http://www.cybertechmedia.com/samples/raycharles.mov'
play.bus:add_watch(GLib.PRIORITY_DEFAULT, bus_callback)
play.state = 'PLAYING'
-- Run the loop.
main_loop:run()
play.state = 'NULL'