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 gtk
import gobject

MAEMO = False

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")

bus = player.get_bus()
bus.add_signal_watch()

# set up signal handlers
bus.connect("message::tag", on_tag)
bus.connect("message::error", on_error)

def start_mp3():
    global player
    
    print "\nmp3:"
    player.set_state(gst.STATE_NULL) # reset player
    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) # reset player FIXME: doesnt work
    # I have to recreate player here to make it work:
    # 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) # start mp3 after 1s
gobject.timeout_add(3000, start_ogg) # switch to ogg after 3s

try:
    gtk.main()
except KeyboardInterrupt:
    player.set_state(gst.STATE_NULL)


_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to