#include <string.h>
#include <fcntl.h>
+static gint isatis_fd = -1;
+
GST_DEBUG_CATEGORY_STATIC(isatissrc_debug);
#define GST_CAT_DEFAULT isatissrc_debug
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
+void gst_isatis_src_set_fd(gint fd)
+{
+ GST_DEBUG("setting fd to %d", fd);
+
+ isatis_fd = fd;
+}
+
static GstURIType gst_isatis_src_uri_get_type(void)
{
return GST_URI_SRC;
static gchar **gst_isatis_src_uri_get_protocols(void)
{
- static gchar *protocols[] = { "isatis", NULL };
+ static gchar *protocols[] = { "http", NULL };
return protocols;
}
static gboolean gst_isatis_src_uri_set_uri(GstURIHandler *handler, const gchar *uri)
{
GstIsatisSrc *src = GST_ISATIS_SRC(handler);
- gint fd;
- GST_DEBUG_OBJECT(src, "setting URI to %s", uri);
-
- if (sscanf(uri, "isatis://%d", &fd) != 1 || fd < 0)
+ if (isatis_fd < 0)
return FALSE;
+ GST_DEBUG_OBJECT(src, "setting URI to %s", uri);
+
g_free(src->uri);
- src->socket = isatis_socket_create(fd);
+ src->socket = isatis_socket_create(isatis_fd);
src->uri = g_strdup(uri);
return TRUE;
GST_DEBUG_OBJECT(src, "initializing");
src->socket = NULL;
- src->uri = g_strdup("isatis://0");
+ src->uri = g_strdup("");
src->eos = FALSE;
src->buffer_queue = g_queue_new();
}
static gboolean gst_isatis_plugin_init(GstPlugin *plugin)
{
- return gst_element_register(plugin, "isatissrc", GST_RANK_PRIMARY, gst_isatis_src_get_type());
+ /* Kludge: ensure we're definitely ranked higher than anyone else */
+ return gst_element_register(plugin, "isatissrc", GST_RANK_PRIMARY + 128, gst_isatis_src_get_type());
}
/* Sigh. */
#include <gdk/gdkx.h>
#include <glib.h>
+#include "isatissrc.h"
+
typedef struct _PlayerInternal
{
gint xid;
static gboolean parse_args(int *argc, char ***argv, PlayerInternal *priv)
{
+ gint fd = -1;
GOptionEntry options[] =
{
{ "xid", 'x', 0, G_OPTION_ARG_INT, &priv->xid, "XID of embed window", NULL },
+ { "isatis-fd", 'i', 0, G_OPTION_ARG_INT, &fd, "Plugin communication FD", NULL },
{ NULL }
};
GOptionContext *ctx;
g_option_context_free(ctx);
+ if (fd >= 0)
+ gst_isatis_src_set_fd(fd);
+
return TRUE;
}
/* Child process */
{
char xid_buf[32];
- char uri_buf[32];
- char *uri;
+ char fd_buf[32];
/* Close the input side of the pipe in the child process */
close(socket_fds[1]);
snprintf(xid_buf, sizeof(xid_buf), "0x%lx", priv->xid);
-
- /* Shortcut file:// URIs for direct file access */
- if (!strncmp("file://", priv->uri, 7))
- uri = priv->uri;
- else
- {
- snprintf(uri_buf, sizeof(uri_buf), "isatis://%d", socket_fds[0]);
-
- uri = uri_buf;
- }
+ snprintf(fd_buf, sizeof(fd_buf), "%d", socket_fds[0]);
execl(BINDIR "/isatis-player",
"isatis-player",
"--xid",
xid_buf,
- uri,
+ "--isatis-fd",
+ fd_buf,
+ priv->uri,
NULL);
DBG(("exec() failed\n"));