0

I am using Gstreamer RTSPMediaFactory (libgstrtspserver 1.0) v 1.2.3-0. From Python, I have derived from the MediaFactory, and overridden create_element. Unfortunately, my create_element is never called, so the RtspServer complains no launch line specified.

I printed out all the methods declared in the super instance, and got this:

['set_buffer_size', 'set_suspend_mode', 'set_protocols', 'construct', 'get_suspend_mode', 'get_launch', 'set_launch', 'is_eos_shutdown', 'get_permissions', 'get_address_pool', 'set_shared', 'is_shared', 'set_address_pool', 'get_protocols', 'get_buffer_size', 'set_permissions', 'set_eos_shutdown']

No create_element!

No wonder, my implementation is never being called... but why is there no create_element function? What do I do?

Adam
  • 4,159
  • 4
  • 32
  • 53

1 Answers1

0

I use version 1.4.3.

This is my full test:

from gi.repository import Gst, GObject, GstRtspServer
Gst.init(None)
rtsp_server = GstRtspServer.RTSPServer()
rtsp_server.attach(None)


class Factory(GstRtspServer.RTSPMediaFactoryURI):

    def __init__(self):
        super(Factory, self).__init__()
        print [(x, type(y)) for x, y
               in GstRtspServer.RTSPMediaFactory.__dict__.items()]

    def do_create_element(self, url):
        print "in do_create_element"

factory = Factory()
factory.set_uri('rtsp://camera_url')
rtsp_server.get_mount_points().add_factory('/mount', factory)
GObject.MainLoop().run()

On start it printout:

[('set_buffer_size', <type 'function'>), ('do_media_configure', <class 'gi.types.NativeVFunc'>),
('__module__', <type 'str'>), ('do_configure', <class 'gi.types.NativeVFunc'>),
('set_suspend_mode', <type 'function'>), ('do_media_constructed', <class 'gi.types.NativeVFunc'>),
('__info__', <type 'ObjectInfo'>), ('do_create_element', <class 'gi.types.NativeVFunc'>),
('priv', <type 'property'>), ('set_protocols', <type 'function'>),
('construct', <type 'function'>), ('get_suspend_mode', <type 'function'>),
('_gst_reserved', <type 'property'>), ('new', <type 'classmethod'>),
('__gtype__', <type 'gobject.GType'>), ('get_launch', <type 'function'>),
('__doc__', <type 'NoneType'>), ('set_launch', <type 'function'>),
('do_construct', <class 'gi.types.NativeVFunc'>), ('parent', <type 'property'>),
('is_eos_shutdown', <type 'function'>), ('get_permissions', <type 'function'>),
('get_address_pool', <type 'function'>), ('do_gen_key', <class 'gi.types.NativeVFunc'>),
('set_shared', <type 'function'>), ('create_element', <type 'function'>),
('is_shared', <type 'function'>), ('set_address_pool', <type 'function'>),
('get_protocols', <type 'function'>), ('get_buffer_size', <type 'function'>),
('get_profiles', <type 'function'>), ('set_permissions', <type 'function'>),
('set_profiles', <type 'function'>), ('set_eos_shutdown', <type 'function'>)]

as you see it have create_element func, but you have to override do_create_element, that have type gi.types.NativeVFunc. and if I connect with rtsp client to rtsp://127.0.0.1:8554/mount it printout:

in do_create_element
aborilov
  • 7,416
  • 3
  • 21
  • 20
  • Thanks - none of that code works in 1.2.3-0. There are only a couple of methods reported as being overrideable. – Adam Sep 23 '15 at 01:22