ocarina/src/core/gstreamer.py

67 lines
1.1 KiB
Python

# This is a simple test plugin, to make sure everything is working
__author__="bjschuma"
__date__ ="$Dec 21, 2009 11:58:37 PM$"
global name, app, type, path, opt
name = "test"
app = "scion"
type = "core"
path = ""
opt = []
from bt.file import *
import gst
import settings
global pipeline
pipeline = None
def load(filename):
filename = expandPath(filename)
if checkPath(filename) == False:
return
write("loading file: "+filename)
bin = gst.element_factory_make("playbin", None)
bin.set_property("uri", "file://"+filename)
bin.set_state(gst.STATE_PAUSED)
global pipeline
pipeline = gst.Pipeline("player")
pipeline.add(bin)
def play():
global pipeline
pipeline.set_state(gst.STATE_PLAYING)
# Called every time the plugin is enabled
def open():
global pipeline
pipeline = gst.Pipeline()
pipeline.set_state(gst.STATE_NULL)
write(songs)
if len(songs) > 0:
load(songs[0])
# Called every time the plugin is stopped
def close():
global pipeline
pipeline.set_state(gst.STATE_NULL)
# Called when the plugin needs to perform some action
def run(args=None):
pass