Method not available in RTSPMediaFactory
Aborilov Pavel
aborilov at gmail.com
Thu Sep 17 23:46:29 PDT 2015
Hi!
I use version 1.4.3.
This is my full test example:
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://good_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
On 09/17, Adam Langley wrote:
> Hi Aborliv,
>
> I ran my same inspection code for the RTSPMediaFactoryURI, and got the
> following results:
> ['get_uri', 'set_uri']
>
> Interesting that none of the inherited methods show up.
>
> This is my inspection code:
>
> *print*([x *for* x,y *in*
> GstRtspServer.RTSPMediaFactoryURI.__dict__.items() *if* type(y) ==
> FunctionType])
> I have also overridden do_create_element, and it just never gets called.
> The constructor does however.... and the 'print' writes out a bunch of
> methods declared in RTSPMediaFactory - so I know the class is correctly
> derived...
>
> class MyFactory(GstRtspServer.RTSPMediaFactory):
> def __init__(self):
> super(MyFactory, self).__init__()
> print([x for x,y in GstRtspServer.RTSPMediaFactory.__dict__.items()
> if type(y) == FunctionType])
> def do_create_element(self, url):
> # return element here... code deleted
>
> self.server = GstRtspServer.RTSPServer()
> self.server.set_service('554')
> f = MyFactory()
> f.set_shared(True)
> m = self.server.get_mount_points()
> m.add_factory("/video", f)
> self.server.attach(None)
>
> On Thu, Sep 17, 2015 at 5:36 PM, Aborilov Pavel <aborilov at gmail.com> wrote:
>
> > I use RTSPMediaFactoryURI from Python and I have to override method
> > do_create_element, and it works.
> >
> > On 09/17, Adam Langley wrote:
> > > 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?
> > >
> >
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > > gstreamer-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list