<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 06/14/2012 04:44 PM, iron_guitarist1987 wrote:
<blockquote cite="mid:1339685057339-4655287.post@n4.nabble.com"
type="cite">
<pre wrap="">Hello,
I'm trying to create the simplest text source element that outputs the same
string over and over again. I tried doing something with the audiotestsrc,
but I know is wrong. Below is what I have so far. Any ideas?</pre>
</blockquote>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=657684">https://bugzilla.gnome.org/show_bug.cgi?id=657684</a><br>
<br>
Stefan<br>
<blockquote cite="mid:1339685057339-4655287.post@n4.nabble.com"
type="cite">
<pre wrap="">
thanks
/* GStreamer
* Copyright (C) 2005 Stefan Kost <a class="moz-txt-link-rfc2396E" href="mailto:ensonic@users.sf.net"><ensonic@users.sf.net></a>
*
* 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-texttestsrc
*
* Texttestsrc can be used to generate basic strings.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <gst/controller/gstcontroller.h>
#include "texttestsrc.h"
GST_DEBUG_CATEGORY_STATIC (text_test_src_debug);
#define GST_CAT_DEFAULT text_test_src_debug
enum
{
PROP_0,
PROP_LAST
};
static GstStaticPadTemplate gst_text_test_src_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("text/plain")
);
GST_BOILERPLATE (GstTexttestsrc, gst_text_test_src, GstBaseSrc,
GST_TYPE_BASE_SRC);
#define GST_TYPE_TEXT_TEST_SRC_WAVE (gst_audiostestsrc_wave_get_type())
static void gst_text_test_src_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_text_test_src_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_text_test_src_create (GstBaseSrc * basesrc,
guint64 offset, guint length, GstBuffer ** buffer);
static void
gst_text_test_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 (&gst_text_test_src_src_template));
gst_element_class_set_details_simple (element_class,
"Audio test source", "Source/Audio",
"Creates audio test signals of given frequency and volume",
"Stefan Kost <a class="moz-txt-link-rfc2396E" href="mailto:ensonic@users.sf.net"><ensonic@users.sf.net></a>");
}
static void
gst_text_test_src_class_init (GstTexttestsrcClass * klass)
{
GObjectClass *gobject_class;
GstBaseSrcClass *gstbasesrc_class;
gobject_class = (GObjectClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gobject_class->set_property = gst_text_test_src_set_property;
gobject_class->get_property = gst_text_test_src_get_property;
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_text_test_src_create);
}
static void
gst_text_test_src_init (GstTexttestsrc * src, GstTexttestsrcClass * g_class)
{
GstPad *pad = GST_BASE_SRC_PAD (src);
/* we operate in time */
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_blocksize (GST_BASE_SRC (src), -1);
}
static gboolean
gst_text_test_src_stop (GstBaseSrc * basesrc)
{
return TRUE;
}
static GstFlowReturn
gst_text_test_src_create (GstBaseSrc * basesrc, guint64 offset,
guint length, GstBuffer ** buffer)
{
GstFlowReturn res;
GstTexttestsrc *src;
src = GST_TEXT_TEST_SRC (basesrc);
*buffer = "This is my test string";
return GST_FLOW_OK;
}
static void
gst_text_test_src_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstTexttestsrc *src = GST_TEXT_TEST_SRC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_text_test_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstTexttestsrc *src = GST_TEXT_TEST_SRC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
plugin_init (GstPlugin * plugin)
{
/* initialize gst controller library */
gst_controller_init (NULL, NULL);
GST_DEBUG_CATEGORY_INIT (text_test_src_debug, "texttestsrc", 0,
"Text Test Source");
return gst_element_register (plugin, "texttestsrc",
GST_RANK_NONE, GST_TYPE_TEXT_TEST_SRC);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"texttestsrc",
"Creates test string",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
-----
The greatest trick the devil ever pulled was convincing the World that Java was better than C++.
--
View this message in context: <a class="moz-txt-link-freetext" href="http://gstreamer-devel.966125.n4.nabble.com/Text-test-source-element-tp4655287.html">http://gstreamer-devel.966125.n4.nabble.com/Text-test-source-element-tp4655287.html</a>
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>