Python plugins + gstreamer

I have some code that generates this error:

** Message: pygobject_register_sinkfunc is deprecated (GstObject)
Traceback (most recent call last):
File "PlayingVideo.py", line 199, in <module>
player = VideoPlayer()
File "PlayingVideo.py", line 84, in __init__
self.constructPipeline()
File "PlayingVideo.py", line 99, in constructPipeline
self.decodebin = gst.element_factory_make("decodebin")
gst.ElementNotFoundError: decodebin

      

Here's the code:

import time
import thread
import gobject
import pygst
pygst.require("0.10")
import gst
import os

class VideoPlayer:
    """
    Simple Video player that just 'plays' a valid input Video file.
    """
    def __init__(self):
        self.use_parse_launch = False
        self.decodebin = None
        self.inFileLocation="YE7VID_720_60_P_MVI_1921.MOV"

        self.constructPipeline()
        self.is_playing = False
        self.connectSignals()

    def constructPipeline(self):
        """
        Add and link elements in a GStreamer pipeline.
        """
        # Create the pipeline instance
        self.player = gst.Pipeline()

        # Define pipeline elements
        self.filesrc = gst.element_factory_make("filesrc")
        self.filesrc.set_property("location",
                              self.inFileLocation)
        self.decodebin = gst.element_factory_make("decodebin")

        # audioconvert for audio processing pipeline
        self.audioconvert = gst.element_factory_make("audioconvert")

        # Autoconvert element for video processing
        self.autoconvert = gst.element_factory_make("autoconvert")

        self.audiosink = gst.element_factory_make("autoaudiosink")

        self.videosink = gst.element_factory_make("autovideosink")

        # As a precaution add videio capability filter
        # in the video processing pipeline.
        videocap = gst.Caps("video/x-raw-yuv")
        self.filter = gst.element_factory_make("capsfilter")
        self.filter.set_property("caps", videocap)
        # Converts the video from one colorspace to another
        self.colorSpace = gst.element_factory_make("ffmpegcolorspace")

        self.queue1 = gst.element_factory_make("queue")
        self.queue2 = gst.element_factory_make("queue")

        # Add elements to the pipeline
        self.player.add(self.filesrc,
                        self.decodebin,
                        self.autoconvert,
                        self.audioconvert,
                        self.queue1,
                        self.queue2,
                        self.filter,
                        self.colorSpace,
                        self.audiosink,
                        self.videosink)

        # Link elements in the pipeline.
        gst.element_link_many(self.filesrc, self.decodebin)
        gst.element_link_many(self.queue1, self.autoconvert,
                              self.filter, self.colorSpace,
                              self.videosink)
        gst.element_link_many(self.queue2, self.audioconvert,
                              self.audiosink)

    def connectSignals(self):
        """
        Connects signals with the methods.
        """
        # Capture the messages put on the bus.
        bus = self.player.get_bus()
        bus.add_signal_watch()
        bus.connect("message", self.message_handler)

        # Connect the decodebin signal
        if not self.decodebin is None:
            self.decodebin.connect("pad_added", self.decodebin_pad_added)

    def decodebin_pad_added(self, decodebin, pad):
        """
        Manually link the decodebin pad with a compatible pad on
        queue elements, when the decodebin "pad-added" signal
        is generated.
        """
        compatible_pad = None
        caps = pad.get_caps()
        name = caps[0].get_name()
        print "\n cap name is = ", name
        if name[:5] == 'video':
            compatible_pad = self.queue1.get_compatible_pad(pad, caps)
        elif name[:5] == 'audio':
            compatible_pad = self.queue2.get_compatible_pad(pad, caps)

        if compatible_pad:
            pad.link(compatible_pad)

    def play(self):
        """
        Play the media file
        """
        self.is_playing = True
        self.player.set_state(gst.STATE_PLAYING)
        while self.is_playing:
            time.sleep(1)
        evt_loop.quit()

    def message_handler(self, bus, message):
        """
        Capture the messages on the bus and
        set the appropriate flag.
        """
        msgType = message.type
        if msgType == gst.MESSAGE_ERROR:
            self.player.set_state(gst.STATE_NULL)
            self.is_playing = False
            print "\n Unable to play Video. Error: ", \
            message.parse_error()
        elif msgType == gst.MESSAGE_EOS:
            self.player.set_state(gst.STATE_NULL)
            self.is_playing = False

# Run the program
player = VideoPlayer()
thread.start_new_thread(player.play, ())
gobject.threads_init()
evt_loop = gobject.MainLoop()
evt_loop.run()

      

I am using archlinux and install all gkger pkgs. Before the problem with decodebin

I got similar errors with autoconvert

, videosink

etc ...

[zen@(none) lebut]$ locate decodebin
/home/zen/Downloads/decodebin.py
/usr/lib/gstreamer-0.10/libgstdecodebin.so
/usr/lib/gstreamer-0.10/libgstdecodebin2.so
/usr/share/gst-python/0.10/examples/decodebin.py
/usr/share/gtk-doc/html/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-decodebin.html
/usr/share/gtk-doc/html/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-decodebin2.html
/usr/share/gtk-doc/html/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-plugin-decodebin.html
/usr/share/gtk-doc/html/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-plugin-uridecodebin.html
/usr/share/gtk-doc/html/gst-plugins-base-plugins-0.10/gst-plugins-base-plugins-uridecodebin.html

      

Seems to be something like a package problem. Does anyone have any idea?

+3


source to share


2 answers


The fix is ​​to delete the ~ / .gstreamer-0.10 folder



+1


source


 self.decodebin = gst.element_factory_make("decodebin")

      



according to the Reference Manual , decodebin is deprecated and no longer supported. Try using decodebin2 instead.

+2


source







All Articles