I have attached more clear examples. Hope you can see the Problem now.
original mail:
Hi,
I'm using the gstreamer ogg plugins from ogg-support for my music
player. while writing
it I've run into the following problems:
1.) I'm using the playbin element for playback. For switching songs I
simply change the "uri" property. This works fine with mp3 files, but
messes up the pipeline when I try to put an ogg in it.
theres a example for this attached.
2.) even when I manage to get the ogg pipline for playback I dont get
the messages for tags.
Greets
Pavel
#!/usr/bin/env python
import gst
import gobject
MAEMO = True
if MAEMO:
base = "/media/mmc2/youamp"
else:
base = "/home/pavel/workspace/youamp"
player = gst.element_factory_make("playbin")
def start_mp3():
global player
print "\nmp3:"
player.set_property("uri", "file://%s/test.mp3" % base)
player.set_state(gst.STATE_PLAYING)
return False
def start_ogg():
global player
print "\nogg:"
player.set_state(gst.STATE_NULL)
player = gst.element_factory_make("playbin")
player.set_property("uri", "file://%s/test.ogg" % base)
player.set_state(gst.STATE_PLAYING)
return False
gobject.timeout_add(1000, start_mp3)
gobject.timeout_add(3000, start_ogg)
try:
gobject.MainLoop().run()
except KeyboardInterrupt:
player.set_state(gst.STATE_NULL)
#!/usr/bin/env python
import gst
import gobject
MAEMO = True
if MAEMO:
base = "/media/mmc2/youamp"
else:
base = "/home/pavel/workspace/youamp"
def on_tag(bus, message):
tags = message.parse_tag()
for k in tags.keys():
if k in ("artist", "album", "title", "replaygain-track-gain"):
print "%s:\t\t%s" % (k, tags[k])
def on_error(bus, message):
print message.parse_error()
player = gst.element_factory_make("playbin")
fakesink = gst.element_factory_make("fakesink", "fakesink")
player.set_property("video-sink", fakesink)
bus = player.get_bus()
bus.add_signal_watch()
# set up signal handlers
bus.connect("message::tag", on_tag)
bus.connect("message::error", on_error)
player.set_state(gst.STATE_READY)
def start_mp3():
global player
print "\nmp3:"
player.set_property("uri", "file://%s/test.mp3" % base)
player.set_state(gst.STATE_PLAYING)
return False
def start_ogg():
global player
print "\nogg:"
player.set_state(gst.STATE_READY)
player.set_property("uri", "file://%s/test.ogg" % base)
player.set_state(gst.STATE_PLAYING)
return False
gobject.timeout_add(1000, start_mp3)
gobject.timeout_add(3000, start_ogg)
try:
gobject.MainLoop().run()
except KeyboardInterrupt:
player.set_state(gst.STATE_NULL)
_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers