2010-06-01 23:45:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
* 2002 Kristian Rietveld <kris@gtk.org>
|
|
|
|
* 2002,2003 Colin Walters <walters@gnu.org>
|
2010-06-04 20:04:53 +00:00
|
|
|
* 2001,2010 Bastien Nocera <hadess@hadess.net>
|
|
|
|
* 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2010-06-01 23:45:06 +00:00
|
|
|
*
|
|
|
|
* rtmpsrc.c:
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-rtmpsrc
|
|
|
|
*
|
|
|
|
* This plugin reads data from a local or remote location specified
|
|
|
|
* by an URI. This location can be specified using any protocol supported by
|
2010-06-04 20:04:53 +00:00
|
|
|
* the RTMP library, i.e. rtmp, rtmpt, rtmps, rtmpe, rtmfp, rtmpte and rtmpts.
|
2010-06-01 23:45:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch lines</title>
|
|
|
|
* |[
|
2010-06-04 20:04:53 +00:00
|
|
|
* gst-launch -v rtmpsrc location=rtmp://somehost/someurl ! fakesink
|
|
|
|
* ]| Open an RTMP location and pass its content to fakesink.
|
2010-06-01 23:45:06 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib/gi18n-lib.h>
|
|
|
|
|
|
|
|
#include "gstrtmpsrc.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (rtmpsrc_debug);
|
|
|
|
#define GST_CAT_DEFAULT rtmpsrc_debug
|
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2010-06-04 20:04:53 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_LOCATION,
|
2010-06-01 23:45:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void gst_rtmp_src_uri_handler_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
|
|
|
|
|
|
|
static void gst_rtmp_src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_rtmp_src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2010-06-04 20:04:53 +00:00
|
|
|
static void gst_rtmp_src_finalize (GObject * object);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
static gboolean gst_rtmp_src_stop (GstBaseSrc * src);
|
|
|
|
static gboolean gst_rtmp_src_start (GstBaseSrc * src);
|
|
|
|
static gboolean gst_rtmp_src_is_seekable (GstBaseSrc * src);
|
2010-06-04 20:04:53 +00:00
|
|
|
static GstFlowReturn gst_rtmp_src_create (GstPushSrc * pushsrc,
|
|
|
|
GstBuffer ** buffer);
|
2010-06-01 23:45:06 +00:00
|
|
|
static gboolean gst_rtmp_src_query (GstBaseSrc * src, GstQuery * query);
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
static void
|
|
|
|
_do_init (GType gtype)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
2010-06-04 20:04:53 +00:00
|
|
|
static const GInterfaceInfo urihandler_info = {
|
|
|
|
gst_rtmp_src_uri_handler_init,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
g_type_add_interface_static (gtype, GST_TYPE_URI_HANDLER, &urihandler_info);
|
2010-06-01 23:45:06 +00:00
|
|
|
}
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstRTMPSrc, gst_rtmp_src, GstPushSrc, GST_TYPE_PUSH_SRC,
|
|
|
|
_do_init);
|
|
|
|
|
2010-06-01 23:45:06 +00:00
|
|
|
static void
|
|
|
|
gst_rtmp_src_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&srctemplate));
|
|
|
|
|
|
|
|
gst_element_class_set_details_simple (element_class,
|
|
|
|
"RTMP Source",
|
|
|
|
"Source/File",
|
|
|
|
"Read RTMP streams",
|
2010-06-04 20:04:53 +00:00
|
|
|
"Bastien Nocera <hadess@hadess.net>, "
|
|
|
|
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
2010-06-01 23:45:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtmp_src_class_init (GstRTMPSrcClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
2010-06-04 20:04:53 +00:00
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
|
2010-06-04 20:04:53 +00:00
|
|
|
gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
gobject_class->finalize = gst_rtmp_src_finalize;
|
|
|
|
gobject_class->set_property = gst_rtmp_src_set_property;
|
|
|
|
gobject_class->get_property = gst_rtmp_src_get_property;
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass),
|
2010-06-04 20:04:53 +00:00
|
|
|
"location", PROP_LOCATION, G_PARAM_READWRITE, NULL);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_rtmp_src_start);
|
|
|
|
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_rtmp_src_stop);
|
|
|
|
gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_rtmp_src_is_seekable);
|
2010-06-04 20:04:53 +00:00
|
|
|
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_rtmp_src_create);
|
2010-06-01 23:45:06 +00:00
|
|
|
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_rtmp_src_query);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-04 20:04:53 +00:00
|
|
|
gst_rtmp_src_init (GstRTMPSrc * rtmpsrc, GstRTMPSrcClass * klass)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
|
|
|
rtmpsrc->curoffset = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtmp_src_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *rtmpsrc = GST_RTMP_SRC (object);
|
|
|
|
|
|
|
|
g_free (rtmpsrc->uri);
|
|
|
|
rtmpsrc->uri = NULL;
|
|
|
|
|
|
|
|
if (rtmpsrc->rtmp) {
|
|
|
|
RTMP_Close (rtmpsrc->rtmp);
|
|
|
|
RTMP_Free (rtmpsrc->rtmp);
|
|
|
|
rtmpsrc->rtmp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* URI interface support.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static GstURIType
|
|
|
|
gst_rtmp_src_uri_get_type (void)
|
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar **
|
|
|
|
gst_rtmp_src_uri_get_protocols (void)
|
|
|
|
{
|
2010-06-04 20:04:53 +00:00
|
|
|
static gchar *protocols[] =
|
|
|
|
{ (char *) "rtmp", (char *) "rtmpt", (char *) "rtmps", (char *) "rtmpe",
|
|
|
|
(char *) "rtmfp", (char *) "rtmpte", (char *) "rtmpts", NULL
|
|
|
|
};
|
2010-06-01 23:45:06 +00:00
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gst_rtmp_src_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *src = GST_RTMP_SRC (handler);
|
|
|
|
|
|
|
|
return src->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_rtmp_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *src = GST_RTMP_SRC (handler);
|
2010-06-04 20:04:53 +00:00
|
|
|
gchar *new_location;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
if (GST_STATE (src) >= GST_STATE_PAUSED)
|
2010-06-01 23:45:06 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
g_free (src->uri);
|
|
|
|
src->uri = NULL;
|
|
|
|
|
|
|
|
if (src->rtmp) {
|
|
|
|
RTMP_Close (src->rtmp);
|
|
|
|
RTMP_Free (src->rtmp);
|
|
|
|
src->rtmp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uri != NULL) {
|
|
|
|
|
|
|
|
new_location = g_strdup (uri);
|
|
|
|
|
|
|
|
src->rtmp = RTMP_Alloc ();
|
|
|
|
RTMP_Init (src->rtmp);
|
|
|
|
if (!RTMP_SetupURL (src->rtmp, new_location)) {
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, NULL,
|
|
|
|
("Failed to setup URL '%s'", src->uri));
|
|
|
|
g_free (new_location);
|
|
|
|
RTMP_Free (src->rtmp);
|
|
|
|
src->rtmp = NULL;
|
|
|
|
return FALSE;
|
|
|
|
} else {
|
|
|
|
src->uri = g_strdup (uri);
|
|
|
|
GST_DEBUG_OBJECT (src, "parsed uri '%s' properly", src->uri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (src, "Changed URI to %s", GST_STR_NULL (uri));
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtmp_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_rtmp_src_uri_get_type;
|
|
|
|
iface->get_protocols = gst_rtmp_src_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_rtmp_src_uri_get_uri;
|
|
|
|
iface->set_uri = gst_rtmp_src_uri_set_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtmp_src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
|
|
|
|
src = GST_RTMP_SRC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2010-06-04 20:04:53 +00:00
|
|
|
case PROP_LOCATION:{
|
|
|
|
gst_rtmp_src_uri_set_uri (GST_URI_HANDLER (src),
|
|
|
|
g_value_get_string (value));
|
2010-06-01 23:45:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtmp_src_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
|
|
|
|
src = GST_RTMP_SRC (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2010-06-04 20:04:53 +00:00
|
|
|
case PROP_LOCATION:
|
2010-06-01 23:45:06 +00:00
|
|
|
g_value_set_string (value, src->uri);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read a new buffer from src->reqoffset, takes care of events
|
|
|
|
* and seeking and such.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2010-06-04 20:04:53 +00:00
|
|
|
gst_rtmp_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
GstBuffer *buf;
|
|
|
|
guint8 *data;
|
|
|
|
guint todo;
|
|
|
|
int read;
|
2010-06-04 20:04:53 +00:00
|
|
|
int size;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
src = GST_RTMP_SRC (pushsrc);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (src->rtmp != NULL, GST_FLOW_ERROR);
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
size = GST_BASE_SRC_CAST (pushsrc)->blocksize;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
GST_DEBUG ("reading from %" G_GUINT64_FORMAT
|
|
|
|
", size %u", src->curoffset, size);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
buf = gst_buffer_try_new_and_alloc (size);
|
2010-06-04 20:04:53 +00:00
|
|
|
if (G_UNLIKELY (buf == NULL)) {
|
2010-06-01 23:45:06 +00:00
|
|
|
GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
|
|
|
|
/* FIXME add FLV header first time around? */
|
|
|
|
read = 0;
|
|
|
|
|
|
|
|
todo = size;
|
|
|
|
while (todo > 0) {
|
2010-06-04 20:04:53 +00:00
|
|
|
read = RTMP_Read (src->rtmp, (char *) data, todo);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
if (G_UNLIKELY (read == 0))
|
2010-06-01 23:45:06 +00:00
|
|
|
goto eos;
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
if (G_UNLIKELY (read == -1))
|
2010-06-01 23:45:06 +00:00
|
|
|
goto read_failed;
|
|
|
|
|
|
|
|
if (read < todo) {
|
|
|
|
data = &data[read];
|
|
|
|
todo -= read;
|
|
|
|
} else {
|
|
|
|
todo = 0;
|
|
|
|
}
|
|
|
|
GST_LOG (" got size %" G_GUINT64_FORMAT, read);
|
|
|
|
}
|
|
|
|
GST_BUFFER_OFFSET (buf) = src->curoffset;
|
|
|
|
src->curoffset += size;
|
|
|
|
|
|
|
|
/* we're done, return the buffer */
|
|
|
|
*buffer = buf;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
read_failed:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
|
|
|
("Failed to read data: %s", "FIXME"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
GST_DEBUG_OBJECT (src, "Reading data gave EOS");
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_rtmp_src_query (GstBaseSrc * basesrc, GstQuery * query)
|
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstRTMPSrc *src = GST_RTMP_SRC (basesrc);
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_URI:
|
|
|
|
gst_query_set_uri (query, src->uri);
|
|
|
|
ret = TRUE;
|
|
|
|
break;
|
2010-06-04 20:04:53 +00:00
|
|
|
case GST_QUERY_DURATION:{
|
|
|
|
GstFormat format;
|
|
|
|
gdouble duration;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
|
|
|
if (format == GST_FORMAT_TIME && src->rtmp) {
|
|
|
|
duration = RTMP_GetDuration (src->rtmp);
|
|
|
|
if (duration != 0.0) {
|
|
|
|
gst_query_set_duration (query, format, duration * GST_SECOND);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-06-01 23:45:06 +00:00
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-06-04 20:04:53 +00:00
|
|
|
|
2010-06-01 23:45:06 +00:00
|
|
|
static gboolean
|
|
|
|
gst_rtmp_src_is_seekable (GstBaseSrc * basesrc)
|
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
|
|
|
|
src = GST_RTMP_SRC (basesrc);
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
return FALSE;
|
2010-06-01 23:45:06 +00:00
|
|
|
}
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
/* open the file, do stuff necessary to go to PAUSED state */
|
2010-06-01 23:45:06 +00:00
|
|
|
static gboolean
|
2010-06-04 20:04:53 +00:00
|
|
|
gst_rtmp_src_start (GstBaseSrc * basesrc)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
|
|
|
|
src = GST_RTMP_SRC (basesrc);
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
if (!src->uri) {
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("No filename given"));
|
2010-06-01 23:45:06 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
src->curoffset = 0;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
/* open if required */
|
|
|
|
if (!RTMP_IsConnected (src->rtmp)) {
|
|
|
|
if (!RTMP_Connect (src->rtmp, NULL)) {
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
|
|
|
|
("Could not connect to RTMP stream \"%s\" for reading: %s (%d)",
|
|
|
|
src->uri, "FIXME", 0));
|
|
|
|
return FALSE;
|
2010-06-01 23:45:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-06-04 20:04:53 +00:00
|
|
|
gst_rtmp_src_stop (GstBaseSrc * basesrc)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
|
|
|
GstRTMPSrc *src;
|
|
|
|
|
|
|
|
src = GST_RTMP_SRC (basesrc);
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
//FIXME you can't run RTMP_Close multiple times
|
|
|
|
// RTMP_Close (src->rtmp);
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
src->curoffset = 0;
|
2010-06-01 23:45:06 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-06-04 20:04:53 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2010-06-01 23:45:06 +00:00
|
|
|
{
|
2010-06-04 20:04:53 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (rtmpsrc_debug, "rtmpsrc", 0, "RTMP Source");
|
2010-06-01 23:45:06 +00:00
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
return gst_element_register (plugin, "rtmpsrc", GST_RANK_PRIMARY,
|
|
|
|
GST_TYPE_RTMP_SRC);
|
2010-06-01 23:45:06 +00:00
|
|
|
}
|
|
|
|
|
2010-06-04 20:04:53 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"rtmpsrc",
|
|
|
|
"RTMP source",
|
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|