NooB Q. - controlling a remote gstreamer app

Sean McNamara smcnam at gmail.com
Sat Feb 25 08:31:58 PST 2012


Hi,

On Sat, Feb 25, 2012 at 12:26 AM,  <gstream at ccc2.com> wrote:
> Hi All,
>
> I am not a C. programmer at all. I have followed the tutorials and
> examples and have a working videomixer2 application. Can you give advice
> as to how I can interact with this app on a remote linux box. I assume it
> is with sockets etc (telnet?). Any advice and some examples would be
> great.

First, this is not a gstreamer question. Just because you're *using*
gstreamer doesn't mean that the nature of your question is at all
related to gstreamer. This is a general applications programming
question, because the nature of your question is *networking*, not
*the gstreamer API*. I'm replying as a courtesy, but please keep the
SNR of this list high by not posting further non-gstreamer questions
to this list.

This is where having some software engineering knowledge would help you.

First of all, if you're doing this over the public internet, you need
an authentication mechanism for your network service. And since
authentication over plain text is basically the same as having no
authentication, you're going to need encryption, message
authentication, and a bunch of other things. Rather than trying to
design something like this from scratch, I'd suggest to just use an
existing solution that is secure enough that most people trust it.

Basically, don't try to cheat by doing something simple/easy like
telnet, unless this service is ONLY going to listen on a LAN IP
address and you trust every computer that connects to that LAN.
Assuming you're good with using existing GNOME technology, you might
look at using libsoup as an HTTPS ("S" for "SSLv3" / "TLS") server.
Once you have an authenticated SSL or TLS tunnel with the client, you
can pretty much code up an arbitrary request/response protocol between
the client and server.

It'd go something like this, starting at OSI layer 5 (Session):

0. Client establishes a TCP socket connection on port 443 (or
whatever) with server. (Layer 5)
1. Client sends an SSL HelloRequest to server. (Layer 6)
2. Client and server complete an SSL handshake to establish a secure
connection. (Layer 6)
3. Client pushes across an HTTP Request (tunneled through SSL) with a
body containing the authentication data. Don't use URL params. For a
low-risk system like this with no concept of user accounts, just a 20+
character password could be sufficient.
4. If the client sent the right password, the server sends an HTTP
Response back with a body containing something like "OK". If the
client sent the wrong password, terminate the TCP connection and don't
respond to that host until they initiate a new connection.
5. Client pushes across another HTTP Request, with a body containing
plain text that the server will parse to figure out what property to
set on the element, and what value. You can do something as simple as
name=value.
6. Server will call g_object_set() on the appropriate gstreamer
element, in order to set the property at runtime.
7. Here, you can optionally keep the channel open for re-use (to avoid
having to start over from step 1 if you want to set another property).
Or you can kill it on either side if you're done.

If you use libsoup on the server, you can do this without starting
another thread, because libsoup has async methods that call a callback
that's tied into the GLib main loop. Only using one thread doesn't
scale extremely well to a large number of clients, but this sounds
like a simple job, so a simple solution will do.

If the server is behind a NAT (i.e. it can listen on an IP that will
let it connect to other LAN computers but not let the public internet
connect to it), you CAN use the above method (extra security never
hurts), but you could skip the SSL if you want, if you are sure that
no unauthorized persons can connect to your LAN (an unsecured wifi
network would be an example of an *insecure* LAN).

If you have no idea where to start, start here:
http://developer.gnome.org/libsoup/stable/libsoup-server-howto.html .
I would recommend learning the APIs and their semantics, rather than
just blindly copying and pasting from examples.

BTW, you don't *have* to use C to write gstreamer apps. Since you
indicated you don't really know how to program in C, I would suggest
that you don't, unless you have some specific reason to. I would
suggest Python or Vala  for a task such as this one. You get soup and
gstreamer bindings "for free" in those languages, and the syntax is a
lot friendlier.


>
> As an example I am using
>  g_object_set (G_OBJECT (decoder2), "max-size-time", (guint64)300000000,
> NULL);

...So you already know the only gstreamer-relevant topic in your
question, and this entire post has been off-topic for this list. Just
FYI.

>
> and would like to update this function with a new time manually.
>
> I have found some basic telnet socket examples but have no clue on how to
> mix both applications together so I can control gst.
>
> thx
> Art.
>
> _______________________________________________
> 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