mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
Added suport to mmsh. There's still a sucks msg "ERROR: Pipeline cant PREROOL..." to be fixed.
Original commit message from CVS: Added suport to mmsh. There's still a sucks msg "ERROR: Pipeline cant PREROOL..." to be fixed.
This commit is contained in:
parent
1501b485b1
commit
e066132634
4 changed files with 88 additions and 28 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-12-11 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* ext/libmms/gstmms.c:
|
||||||
|
* ext/libmms/gstmms.h:
|
||||||
|
Added suport to mmsh. There's still a sucks msg "ERROR: Pipeline cant
|
||||||
|
PREROOL..." to be fixed.
|
||||||
|
|
||||||
2005-12-09 Jan Schmidt <thaytan@mad.scientist.com>
|
2005-12-09 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* ext/faad/gstfaad.c: (gst_faad_chanpos_to_gst),
|
* ext/faad/gstfaad.c: (gst_faad_chanpos_to_gst),
|
||||||
|
|
|
@ -408,7 +408,7 @@ dnl *** libmms ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
|
||||||
GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
|
GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
|
||||||
dnl check with pkg-config first
|
dnl check with pkg-config first
|
||||||
PKG_CHECK_MODULES(LIBMMS, libmms >= 0.1, HAVE_LIBMMS="yes", HAVE_LIBMMS="no")
|
PKG_CHECK_MODULES(LIBMMS, libmms >= 0.2, HAVE_LIBMMS="yes", HAVE_LIBMMS="no")
|
||||||
])
|
])
|
||||||
AC_SUBST(LIBMMS_LIBS)
|
AC_SUBST(LIBMMS_LIBS)
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ static gboolean gst_mms_src_query (GstPad * pad, GstQuery * query);
|
||||||
|
|
||||||
|
|
||||||
static gboolean gst_mms_start (GstBaseSrc * bsrc);
|
static gboolean gst_mms_start (GstBaseSrc * bsrc);
|
||||||
|
static gboolean gst_mms_stop (GstBaseSrc * bsrc);
|
||||||
static GstFlowReturn gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf);
|
static GstFlowReturn gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -131,6 +132,7 @@ gst_mms_class_init (GstMMSClass * klass)
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
gstbasesrc_class->start = gst_mms_start;
|
gstbasesrc_class->start = gst_mms_start;
|
||||||
|
gstbasesrc_class->stop = gst_mms_stop;
|
||||||
|
|
||||||
gstpushsrc_class->create = gst_mms_create;
|
gstpushsrc_class->create = gst_mms_create;
|
||||||
|
|
||||||
|
@ -152,6 +154,7 @@ gst_mms_init (GstMMS * mmssrc, GstMMSClass * g_class)
|
||||||
|
|
||||||
mmssrc->uri_name = NULL;
|
mmssrc->uri_name = NULL;
|
||||||
mmssrc->connection = NULL;
|
mmssrc->connection = NULL;
|
||||||
|
mmssrc->connection_h = NULL;
|
||||||
mmssrc->blocksize = 2048;
|
mmssrc->blocksize = 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +190,11 @@ gst_mms_src_query (GstPad * pad, GstQuery * query)
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (mmssrc->connection) {
|
||||||
value = (gint64) mms_get_current_pos (mmssrc->connection);
|
value = (gint64) mms_get_current_pos (mmssrc->connection);
|
||||||
|
} else {
|
||||||
|
value = (gint64) mmsh_get_current_pos (mmssrc->connection_h);
|
||||||
|
}
|
||||||
gst_query_set_position (query, format, value);
|
gst_query_set_position (query, format, value);
|
||||||
break;
|
break;
|
||||||
case GST_QUERY_DURATION:
|
case GST_QUERY_DURATION:
|
||||||
|
@ -196,7 +203,11 @@ gst_mms_src_query (GstPad * pad, GstQuery * query)
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (mmssrc->connection) {
|
||||||
value = (gint64) mms_get_length (mmssrc->connection);
|
value = (gint64) mms_get_length (mmssrc->connection);
|
||||||
|
} else {
|
||||||
|
value = (gint64) mmsh_get_length (mmssrc->connection_h);
|
||||||
|
}
|
||||||
gst_query_set_duration (query, format, value);
|
gst_query_set_duration (query, format, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -229,15 +240,14 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||||
|
|
||||||
*buf = NULL;
|
*buf = NULL;
|
||||||
mmssrc = GST_MMS (psrc);
|
mmssrc = GST_MMS (psrc);
|
||||||
*buf = gst_buffer_new ();
|
*buf = gst_buffer_new_and_alloc (mmssrc->blocksize);
|
||||||
|
|
||||||
if (NULL == *buf) {
|
if (NULL == *buf) {
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = g_malloc0 (mmssrc->blocksize);
|
data = GST_BUFFER_DATA (*buf);
|
||||||
GST_BUFFER_DATA (*buf) = data;
|
|
||||||
GST_DEBUG ("mms: data: %p\n", data);
|
GST_DEBUG ("mms: data: %p\n", data);
|
||||||
|
|
||||||
if (NULL == GST_BUFFER_DATA (*buf)) {
|
if (NULL == GST_BUFFER_DATA (*buf)) {
|
||||||
|
@ -249,11 +259,40 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||||
|
|
||||||
GST_BUFFER_SIZE (*buf) = 0;
|
GST_BUFFER_SIZE (*buf) = 0;
|
||||||
GST_DEBUG ("reading %d bytes", mmssrc->blocksize);
|
GST_DEBUG ("reading %d bytes", mmssrc->blocksize);
|
||||||
|
if (mmssrc->connection) {
|
||||||
result =
|
result =
|
||||||
mms_read (NULL, mmssrc->connection, (char *) data, mmssrc->blocksize);
|
mms_read (NULL, mmssrc->connection, (char *) data, mmssrc->blocksize);
|
||||||
GST_BUFFER_OFFSET (*buf) = mms_get_current_pos (mmssrc->connection) - result;
|
} else {
|
||||||
GST_BUFFER_SIZE (*buf) = result;
|
result =
|
||||||
|
mmsh_read (NULL, mmssrc->connection_h, (char *) data,
|
||||||
|
mmssrc->blocksize);
|
||||||
|
}
|
||||||
|
printf ("%d\t", result);
|
||||||
|
fflush (stdout);
|
||||||
|
|
||||||
|
/* EOS? */
|
||||||
|
if (result == 0) {
|
||||||
|
GstPad *peer;
|
||||||
|
|
||||||
|
gst_buffer_unref (*buf);
|
||||||
|
*buf = NULL;
|
||||||
|
GST_DEBUG ("Returning EOS");
|
||||||
|
peer = gst_pad_get_peer (GST_BASE_SRC_PAD (mmssrc));
|
||||||
|
if (!gst_pad_send_event (peer, gst_event_new_eos ())) {
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
g_object_unref (peer);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mmssrc->connection) {
|
||||||
|
GST_BUFFER_OFFSET (*buf) =
|
||||||
|
mms_get_current_pos (mmssrc->connection) - result;
|
||||||
|
} else {
|
||||||
|
GST_BUFFER_OFFSET (*buf) =
|
||||||
|
mmsh_get_current_pos (mmssrc->connection_h) - result;
|
||||||
|
}
|
||||||
|
GST_BUFFER_SIZE (*buf) = result;
|
||||||
|
|
||||||
/* DEBUG */
|
/* DEBUG */
|
||||||
query = gst_query_new_position (GST_QUERY_POSITION);
|
query = gst_query_new_position (GST_QUERY_POSITION);
|
||||||
|
@ -262,19 +301,6 @@ gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||||
gst_query_unref (query);
|
gst_query_unref (query);
|
||||||
GST_DEBUG ("mms position: %lld\n", query_res);
|
GST_DEBUG ("mms position: %lld\n", query_res);
|
||||||
|
|
||||||
|
|
||||||
/* EOS? */
|
|
||||||
if (result == 0) {
|
|
||||||
gst_buffer_unref (*buf);
|
|
||||||
*buf = NULL;
|
|
||||||
GST_DEBUG ("Returning EOS");
|
|
||||||
if (!gst_pad_send_event (GST_BASE_SRC (mmssrc)->srcpad,
|
|
||||||
gst_event_new_eos ())) {
|
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -284,7 +310,7 @@ static gboolean
|
||||||
gst_mms_start (GstBaseSrc * bsrc)
|
gst_mms_start (GstBaseSrc * bsrc)
|
||||||
{
|
{
|
||||||
GstMMS *mms;
|
GstMMS *mms;
|
||||||
gboolean ret = TRUE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
mms = GST_MMS (bsrc);
|
mms = GST_MMS (bsrc);
|
||||||
|
|
||||||
|
@ -293,10 +319,17 @@ gst_mms_start (GstBaseSrc * bsrc)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* FIXME: pass some sane arguments here */
|
/* FIXME: pass some sane arguments here */
|
||||||
|
gst_mms_stop (bsrc);
|
||||||
|
|
||||||
mms->connection = mms_connect (NULL, NULL, mms->uri_name, 128 * 1024);
|
mms->connection = mms_connect (NULL, NULL, mms->uri_name, 128 * 1024);
|
||||||
if (!mms->connection) {
|
if (mms->connection) {
|
||||||
ret = FALSE;
|
ret = TRUE;
|
||||||
goto done;
|
} else {
|
||||||
|
mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, 128 * 1024);
|
||||||
|
if (mms->connection_h) {
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -304,6 +337,23 @@ done:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_mms_stop (GstBaseSrc * bsrc)
|
||||||
|
{
|
||||||
|
GstMMS *mms;
|
||||||
|
|
||||||
|
mms = GST_MMS (bsrc);
|
||||||
|
if (mms->connection != NULL) {
|
||||||
|
mms_close (mms->connection);
|
||||||
|
mms->connection = NULL;
|
||||||
|
}
|
||||||
|
if (mms->connection_h != NULL) {
|
||||||
|
mmsh_close (mms->connection_h);
|
||||||
|
mms->connection_h = NULL;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mms_set_property (GObject * object, guint prop_id,
|
gst_mms_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
@ -387,7 +437,7 @@ gst_mms_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
||||||
GstMMS *src = GST_MMS (handler);
|
GstMMS *src = GST_MMS (handler);
|
||||||
|
|
||||||
protocol = gst_uri_get_protocol (uri);
|
protocol = gst_uri_get_protocol (uri);
|
||||||
if (strcmp (protocol, "mms") != 0) {
|
if ((strcmp (protocol, "mms") != 0) && (strcmp (protocol, "mmsh") != 0)) {
|
||||||
g_free (protocol);
|
g_free (protocol);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <libmms/mms.h>
|
#include <libmms/mms.h>
|
||||||
|
#include <libmms/mmsh.h>
|
||||||
#include <gst/base/gstpushsrc.h>
|
#include <gst/base/gstpushsrc.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -32,6 +33,7 @@ struct _GstMMS
|
||||||
|
|
||||||
gchar *uri_name;
|
gchar *uri_name;
|
||||||
gpointer connection;
|
gpointer connection;
|
||||||
|
gpointer connection_h;
|
||||||
gint blocksize;
|
gint blocksize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue