[gst-devel] Unix sockets in gsttcp{server,client}{src,sink}.[ch]

Raphaël Slinckx raphael at slinckx.net
Tue Sep 27 10:47:53 CEST 2005


Hi !

Some time ago i needed unix sockets in gstreamer for my summer of code
assignement, so i did a first implementation of it that can be found at
http://bugzilla.gnome.org/show_bug.cgi?id=314624

After some discussion with thomasvs, he suggested to take this to the
list for a broader range of opinions.

Currently the gst tcp sinks have the following properties:
* host: of the form of an ip address or a host name
* port: the port number to be used or 0 for a kernel-chosen one.
        (also note that currently, there is no way to know which
         port was chosen by the kernel)

The patch uses the following:
* socket-type: an enum, either GST_TCP_SOCKET_TYPE_INET, or
               GST_TCP_SOCKET_TYPE_UNIX.
* address: Either the old host format, when using INET sockets, or
           the path to the unix socket when using UNIX sockets.
* port: Used only when INET sockets are used, ignored otherwise.
        (I also update port number value after binding the socket so
         one can retreive the port number that is used)

This may or may not be a good approach.
Thomas suggested the following:
* location: unix:///path/to/socket or tcp://ip:port
This way you cannot read the port value that was choosen

* location: unix:///path/to/socket or tcp://ip
* port: number, used only when tcp:// location

There is also the option of subclassing things.
GstSocket{server,client}{src,sink} GstTcpSocket{}{} GstUnixSocket{}{}
There is however the problem that it's more complex, redundant and
time-consuming o do than the above. The difference between unix/tcp
sockets is really one or two lines here and there, the rest being
boilerplate code. I don't like it.

What do you think ?
Raf





More information about the gstreamer-devel mailing list