SwfdecSocket

SwfdecSocket — object used for network connections

Synopsis


#include <swfdec/swfdec.h>

                    SwfdecSocket;
                    SwfdecSocketClass;

Object Hierarchy

  GObject
   +----SwfdecStream
         +----SwfdecSocket
               +----SwfdecGtkSocket

Description

SwfdecSockets are used to implement TCP streams. These are for example used to implement RTMP support or the XMLSocket script class. Backends are supposed to provide an implementation for this, as by default this class is unimplemented. However, swfdec-gtk or other convenience libraries provide a socket implementation by default.

The socket implementation used by a SwfdecPlayer can be set with the SwfdecPlayer:socket-type property.

Details

SwfdecSocket

typedef struct _SwfdecSocket SwfdecSocket;

This is the base object used for providing input. It is abstract, create a subclass to provide your own socket implementation. All members are considered private.


SwfdecSocketClass

typedef struct {
  void			(* connect)		(SwfdecSocket *	socket,
						 SwfdecPlayer *	player,
						 const char *	hostname,
						 guint		port);

  void			(* send)		(SwfdecSocket *	socket,
						 SwfdecBuffer *	buffer);
} SwfdecSocketClass;

This is the socket class. When you create a subclass, you need to implement the functions listed above.

connect ()

Connect the given newly created socket to the given hostname and port. If you encounter an error, call swfdec_stream_error(), but still make sure the socket object does not break.

send ()

Called to send data down the given socket. This function will only be called when the socket is open. You get passed a reference to the buffer, so it is your responsibility to call swfdec_buffer_unref() on it when you are done with it.