python gstreamer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

python gstreamer

Fabien ROCHER
Hello,
With this code, I can play a music file encode in vorbis and muxer in ogg. Now I want to play a video in mpg. To do it, I want use the element playbin.

#!/usr/bin/python
# import a buch of things
import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
import gtk.glade

# create a class and its constructor
class Main:
    def __init__(self):

        # set up the glade file
        self.wTree = gtk.glade.XML("Gui_client.glade", "mainwindow")
       
        signals = {
            "on_play_clicked" : self.OnPlay,
            "on_stop_clicked" : self.OnStop,
            "on_quit_clicked" : self.OnQuit,
        }

        self.wTree.signal_autoconnect(signals)

        # creating the pipeline
        self.pipeline = gst.Pipeline("mypipeline")

        # creating a gnlcomposition
        self.comp = gst.element_factory_make("gnlcomposition", "mycomposition")
        self.pipeline.add(self.comp)
        self.comp.connect("pad-added", self.OnPad)

        # create an audioconvert
        self.compconvert = gst.element_factory_make("audioconvert", "compconvert")
        self.pipeline.add(self.compconvert)

        # create an alsasink
        self.sink = gst.element_factory_make("alsasink", "alsasink")
        self.pipeline.add(self.sink)
        self.compconvert.link(self.sink)
       
        # create a gnlfilesource
        self.audio = gst.element_factory_make("gnlfilesource", "audio")
        self.comp.add(self.audio)

        # set the gnlfilesource properties
        self.audio.set_property("location", "/home/toto/Desktop/VoD/Sound.ogg")
        self.audio.set_property("start", 10 * gst.SECOND)
        self.audio.set_property("duration", 10000000 * gst.SECOND )


        # show the window
        self.window = self.wTree.get_widget("mainwindow")
        self.window.show_all()

    def OnPad(self, comp, pad):
        print "pad added!"
        convpad = self.compconvert.get_compatible_pad(pad, pad.get_caps())
        pad.link(convpad)

    def OnPlay(self, widget):
        print "play"
        self.pipeline.set_state(gst.STATE_PLAYING)

    def OnStop(self, widget):
        print "stop"
        self.pipeline.set_state(gst.STATE_NULL)

    def OnQuit(self, widget):
        print "quitting"
        gtk.main_quit()

start=Main()
gtk.main()



Now I want to play a video in mpg. To do it, I would like to use the playbin element but I don't arrive there.
Somebody knows how I could make that ?

Thanks,
Fab

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: python gstreamer

Jens Persson-2
I don't know exactly where your problem is but playbin is a ready to run
pipeline. Just set the uri property and then just start it with
STATE_PLAYING.
This page might help ->
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html

Greets Jens

>
> Now I want to play a video in mpg. To do it, I would like to use the
> playbin element but I don't arrive there.
> Somebody knows how I could make that ?
>
> Thanks,
> Fab
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>  


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel