libsaria: Remove old audio code
I had commented it out while introducing the new stuff. I should be able to safely remove it now.
This commit is contained in:
parent
8574cda529
commit
fca5fd1bae
|
@ -13,6 +13,7 @@ def load_file(file):
|
|||
lock_audio()
|
||||
pipeline.load_file("file", file)
|
||||
unlock_audio()
|
||||
#callback.song_changed()
|
||||
|
||||
def get_state():
|
||||
lock_audio()
|
||||
|
@ -85,79 +86,3 @@ def get_progress():
|
|||
# if message.type == gst.MESSAGE_EOS:
|
||||
# source_proc.next()
|
||||
#pipeline.bus.connect("message", bus_message)
|
||||
|
||||
#__all__ = ['audio']
|
||||
|
||||
#import gst
|
||||
#import libsaria
|
||||
#from libsaria import prefs
|
||||
#call = libsaria.event.call
|
||||
#expand = libsaria.path.expand
|
||||
#exists = libsaria.path.exists
|
||||
#audio = None
|
||||
#tdelta = None
|
||||
|
||||
#prefs.init("libsaria.audio.volume", 1.0)
|
||||
|
||||
#def init():
|
||||
#global tdelta
|
||||
#global audio
|
||||
|
||||
#from datetime import timedelta as tdelta
|
||||
#import audio
|
||||
#audio.init()
|
||||
|
||||
|
||||
#def end_of_song():
|
||||
#global audio
|
||||
#return call("EOS", audio.reset)
|
||||
|
||||
|
||||
#def seek(prcnt):
|
||||
#global audio
|
||||
#return call("SEEK", audio.seek, prcnt)
|
||||
|
||||
|
||||
#def seek_sec(sec):
|
||||
#global audio
|
||||
#dur = audio.duration()
|
||||
#if dur > 0:
|
||||
#prcnt = get_progress() + (1 * sec * 1000000000) / audio.duration()
|
||||
#if prcnt > 1:
|
||||
#prcnt = 1
|
||||
#if prcnt < 0:
|
||||
#prcnt = 0
|
||||
#seek(prcnt)
|
||||
|
||||
|
||||
#def get_progress():
|
||||
#global audio
|
||||
#dur = audio.duration()
|
||||
#if dur > 0:
|
||||
#return audio.position() / dur
|
||||
#return 0
|
||||
|
||||
|
||||
#def get_time():
|
||||
#global audio
|
||||
#global tdelta
|
||||
#if audio.get_state() == gst.STATE_NULL:
|
||||
#return ""
|
||||
#pos = audio.position()
|
||||
#pos /= 1000
|
||||
#time = str(tdelta(microseconds=pos))
|
||||
#time = time.rsplit('.', 1)[0]
|
||||
#time = time.split(':', 1)[1]
|
||||
#return time
|
||||
|
||||
|
||||
#def get_time_at(prcnt):
|
||||
#duration = audio.duration()
|
||||
#if duration == 0:
|
||||
#return "00:00"
|
||||
#pos = duration * prcnt
|
||||
#pos /= 1000
|
||||
#time = str(tdelta(microseconds=pos))
|
||||
#time = time.rsplit('.', 1)[0]
|
||||
#time = time.split(':', 1)[1]
|
||||
#return time
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
# Bryan Schumaker (8/7/2010)
|
||||
|
||||
#import libsaria
|
||||
#from libsaria import threads
|
||||
|
||||
#lock = threads.get_mutex("gstreamer")
|
||||
#gst = None
|
||||
#player = None
|
||||
#time = None
|
||||
#bus = None
|
||||
#length = None
|
||||
#call = libsaria.event.call
|
||||
|
||||
## An init function for faster startup
|
||||
#def init():
|
||||
#global gst
|
||||
#global player
|
||||
#global time
|
||||
#global lock
|
||||
#import gst
|
||||
|
||||
#lock.acquire()
|
||||
#player = gst.element_factory_make("playbin2", "player")
|
||||
#set_volume_locked(libsaria.prefs.get("libsaria.audio.volume"))
|
||||
#time = gst.Format(gst.FORMAT_TIME)
|
||||
#bus = player.get_bus()
|
||||
#bus.add_signal_watch()
|
||||
#bus.connect("message", on_message)
|
||||
#lock.release()
|
||||
|
||||
#def reset_locked():
|
||||
#global player
|
||||
#global length
|
||||
#player.set_state(gst.STATE_NULL)
|
||||
#length = None
|
||||
|
||||
#def reset():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#reset_locked()
|
||||
#lock.release()
|
||||
|
||||
|
||||
#def on_message(bus, message):
|
||||
#if message.type == gst.MESSAGE_EOS:
|
||||
#libsaria.audio.end_of_song()
|
||||
|
||||
|
||||
#def on_quit():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#reset_locked()
|
||||
#lock.release()
|
||||
#libsaria.event.invite("PREQUIT", on_quit)
|
||||
|
||||
|
||||
#def get_state_locked():
|
||||
#global player
|
||||
#return player.get_state()[1]
|
||||
|
||||
#def get_state():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#state = get_state_locked()
|
||||
#lock.release()
|
||||
#return state
|
||||
|
||||
|
||||
## Returns the length of the song in ms
|
||||
#def duration_locked():
|
||||
#global length
|
||||
#global player
|
||||
#global time
|
||||
#if get_state_locked() == gst.STATE_NULL:
|
||||
#return 0
|
||||
#if length == None:
|
||||
#try:
|
||||
#length = player.query_duration(time)[0]
|
||||
#except:
|
||||
#length = 0
|
||||
#return float(length)
|
||||
|
||||
#def duration():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = duration_locked()
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
|
||||
#def position_locked():
|
||||
#global time
|
||||
#global player
|
||||
#if get_state_locked() == gst.STATE_NULL:
|
||||
#return float(0)
|
||||
#try:
|
||||
#pos = player.query_position(time)[0]
|
||||
#except:
|
||||
#pos = 0
|
||||
#return float(pos)
|
||||
|
||||
#def position():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = position_locked()
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
|
||||
#def load_locked(file):
|
||||
#global gst
|
||||
#global player
|
||||
#reset_locked()
|
||||
##player.set_state(gst.STATE_NULL)
|
||||
#player.set_property("uri", "file://%s"%file)
|
||||
#player.set_state(gst.STATE_PAUSED)
|
||||
#return file
|
||||
|
||||
#def load(file):
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = load_locked(file)
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
|
||||
#def play_locked():
|
||||
#global gst
|
||||
#global player
|
||||
#player.set_state(gst.STATE_PLAYING)
|
||||
#return get_state_locked() == gst.STATE_PLAYING
|
||||
|
||||
#def play():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = play_locked()
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
|
||||
#def pause_locked():
|
||||
#global gst
|
||||
#global player
|
||||
#player.set_state(gst.STATE_PAUSED)
|
||||
#return get_state_locked() == gst.STATE_PAUSED
|
||||
|
||||
#def pause():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = pause_locked()
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
#def stop_locked():
|
||||
#pause_locked()
|
||||
#seek_locked(0)
|
||||
#return get_state_locked() == gst.STATE_PAUSED
|
||||
|
||||
#def stop():
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = stop_locked()
|
||||
#lock.release()
|
||||
#return ret
|
||||
|
||||
|
||||
#def seek_locked(prcnt):
|
||||
#global player
|
||||
#global time
|
||||
#global gst
|
||||
#try:
|
||||
#spot = duration_locked() * prcnt
|
||||
#player.seek_simple(time, gst.SEEK_FLAG_FLUSH, spot)
|
||||
#except:
|
||||
#pass
|
||||
|
||||
#def seek(prcnt):
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#seek_locked(prcnt)
|
||||
#lock.release()
|
||||
|
||||
|
||||
#def set_volume_locked(prcnt):
|
||||
#global player
|
||||
#player.set_property("volume", prcnt)
|
||||
#libsaria.prefs.set("libsaria.audio.volume", prcnt)
|
||||
#return prcnt
|
||||
|
||||
#def set_volume(prcnt):
|
||||
#global lock
|
||||
#lock.acquire()
|
||||
#ret = set_volume_locked(prcnt)
|
||||
#lock.release()
|
||||
#return ret
|
Loading…
Reference in New Issue