diff options
author | Leandro Melo de Sales <leandroal@gmail.com> | 2008-08-21 13:22:38 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2008-08-21 13:22:38 +0000 |
commit | 605482a1a852a42aba6263811d7fa57b110728ba (patch) | |
tree | 14a29b92472bd9ebfc207581f54b307967842e29 /tests/icles/dccp/mp3Speex | |
parent | fd66868120ad27860d140d1a54040dcbffc014a5 (diff) | |
download | gst-plugins-bad-605482a1a852a42aba6263811d7fa57b110728ba.tar.gz gst-plugins-bad-605482a1a852a42aba6263811d7fa57b110728ba.tar.bz2 gst-plugins-bad-605482a1a852a42aba6263811d7fa57b110728ba.zip |
Add dccp plugin. Fixes #542390.
Original commit message from CVS:
patch by: Leandro Melo de Sales <leandroal@gmail.com>
* configure.ac:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-bad-plugins-docs.sgml:
* docs/plugins/gst-plugins-bad-plugins-sections.txt:
* docs/plugins/gst-plugins-bad-plugins.args:
* docs/plugins/gst-plugins-bad-plugins.hierarchy:
* docs/plugins/gst-plugins-bad-plugins.interfaces:
* docs/plugins/gst-plugins-bad-plugins.prerequisites:
* docs/plugins/gst-plugins-bad-plugins.signals:
* docs/plugins/inspect/plugin-dccp.xml:
* gst/dccp/Makefile.am:
* gst/dccp/gstdccp.c:
* gst/dccp/gstdccp.h:
* gst/dccp/gstdccpclientsink.c:
* gst/dccp/gstdccpclientsink.h:
* gst/dccp/gstdccpclientsrc.c:
* gst/dccp/gstdccpclientsrc.h:
* gst/dccp/gstdccpplugin.c:
* gst/dccp/gstdccpserversink.c:
* gst/dccp/gstdccpserversink.h:
* gst/dccp/gstdccpserversrc.c:
* gst/dccp/gstdccpserversrc.h:
* tests/icles/dccp/README:
* tests/icles/dccp/call/README:
* tests/icles/dccp/call/DCCPClient.c:
* tests/icles/dccp/call/DCCPServer.c:
* tests/icles/dccp/file/DCCPClientSaveFile.c:
* tests/icles/dccp/file/DCCPServerSendFile.c:
* tests/icles/dccp/mic/DCCPClientPlayMic.c:
* tests/icles/dccp/mic/DCCPServerMic.c:
* tests/icles/dccp/mp3/DCCPClientPlayMP3.c:
* tests/icles/dccp/mp3/DCCPServerSendMP3.c:
* tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c:
* tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c:
* tests/icles/dccp/mp3Stream/DCCPClientPlayMP3Stream.c:
* tests/icles/dccp/mp3Stream/DCCPServerSendMP3Stream.c:
Add dccp plugin. Fixes #542390.
Diffstat (limited to 'tests/icles/dccp/mp3Speex')
-rw-r--r-- | tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c | 120 | ||||
-rw-r--r-- | tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c | 128 |
2 files changed, 248 insertions, 0 deletions
diff --git a/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c b/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c new file mode 100644 index 00000000..d05b4198 --- /dev/null +++ b/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c @@ -0,0 +1,120 @@ +/* GStreamer + * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com> + * + * 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> + +static gboolean +bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + + GMainLoop *loop = (GMainLoop *) data; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS: + g_print ("End-of-stream\n"); + g_main_loop_quit (loop); + break; + case GST_MESSAGE_ERROR:{ + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + g_print ("Error: %s\n", err->message); + g_error_free (err); + + g_main_loop_quit (loop); + break; + } + default: + break; + } + + return TRUE; +} + + +int +main (int argc, char *argv[]) +{ + + GMainLoop *loop; + GstBus *bus; + GstElement *pipeline, *alsasink, *rtpspeexdepay, *speexdec, *dccpclientsrc; + GstCaps *caps; + + /* initialize GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* check input arguments */ + if (argc != 3) { + g_print ("%s\n", "see usage: serverHost serverPort"); + return -1; + } + + /* create elements */ + pipeline = gst_pipeline_new ("audio-sender"); + alsasink = gst_element_factory_make ("alsasink", "alsa-sink"); + rtpspeexdepay = gst_element_factory_make ("rtpspeexdepay", "rtpspeexdepay"); + speexdec = gst_element_factory_make ("speexdec", "speexdec"); + dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source"); + + if (!pipeline || !alsasink || !rtpspeexdepay || !speexdec || !dccpclientsrc) { + g_print ("One element could not be created\n"); + return -1; + } + + caps = + gst_caps_from_string + ("application/x-rtp, media=(string)audio, payload=(int)110, clock-rate=(int)44100, encoding-name=(string)SPEEX, ssrc=(guint)152981653, clock-base=(guint)1553719649, seqnum-base=(guint)3680, encoding-params=(string)1"); + g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL); + gst_object_unref (caps); + + g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL); + g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL); + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, bus_call, loop); + gst_object_unref (bus); + + /* put all elements in a bin */ + gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, rtpspeexdepay, speexdec, + alsasink, NULL); + + gst_element_link_many (dccpclientsrc, rtpspeexdepay, speexdec, alsasink, + NULL); + + /* Now set to playing and iterate. */ + g_print ("Setting to PLAYING\n"); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_print ("Running\n"); + g_main_loop_run (loop); + + /* clean up nicely */ + g_print ("Returned, stopping playback\n"); + gst_element_set_state (pipeline, GST_STATE_NULL); + g_print ("Deleting pipeline\n"); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} diff --git a/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c b/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c new file mode 100644 index 00000000..58166dd1 --- /dev/null +++ b/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c @@ -0,0 +1,128 @@ +/* GStreamer + * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com> + * + * 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gst/gst.h> + +static gboolean +bus_call (GstBus * bus, GstMessage * msg, gpointer data) +{ + + GMainLoop *loop = (GMainLoop *) data; + + switch (GST_MESSAGE_TYPE (msg)) { + case GST_MESSAGE_EOS: + g_print ("End-of-stream\n"); + g_main_loop_quit (loop); + break; + case GST_MESSAGE_ERROR:{ + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + g_print ("Error: %s\n", err->message); + g_error_free (err); + + g_main_loop_quit (loop); + break; + } + default: + break; + } + + return TRUE; +} + + +int +main (int argc, char *argv[]) +{ + + GMainLoop *loop; + GstBus *bus; + GstElement *pipeline, *filesrc, *mad, *audioconvert, *capsfilter, *speexenc, + *rtpspeexpay, *dccpserversink; + GstCaps *caps; + + /* initialize GStreamer */ + gst_init (&argc, &argv); + loop = g_main_loop_new (NULL, FALSE); + + /* check input arguments */ + if (argc != 3) { + g_print ("%s\n", "see usage: port mp3Location"); + return -1; + } + + /* create elements */ + pipeline = gst_pipeline_new ("audio-sender"); + filesrc = gst_element_factory_make ("filesrc", "file-source"); + mad = gst_element_factory_make ("mad", "mad"); + audioconvert = gst_element_factory_make ("audioconvert", "audioconvert"); + capsfilter = gst_element_factory_make ("capsfilter", "capsfilter"); + speexenc = gst_element_factory_make ("speexenc", "speexenc"); + rtpspeexpay = gst_element_factory_make ("rtpspeexpay", "rtpspeexpay"); + dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink"); + + + if (!pipeline || !filesrc || !dccpserversink || !mad || !audioconvert + || !capsfilter || !speexenc || !rtpspeexpay) { + g_print ("One element could not be created\n"); + return -1; + } + + g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL); + g_object_set (G_OBJECT (filesrc), "location", argv[2], NULL); + + caps = + gst_caps_from_string + ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)1"); + g_object_set (G_OBJECT (capsfilter), "caps", caps, NULL); + gst_object_unref (caps); + + + bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); + gst_bus_add_watch (bus, bus_call, loop); + gst_object_unref (bus); + + /* put all elements in a bin */ + gst_bin_add_many (GST_BIN (pipeline), filesrc, mad, audioconvert, capsfilter, + speexenc, rtpspeexpay, dccpserversink, NULL); + + gst_element_link_many (filesrc, mad, audioconvert, capsfilter, speexenc, + rtpspeexpay, dccpserversink, NULL); + + + /* Now set to playing and iterate. */ + g_print ("Setting to PLAYING\n"); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_print ("Running\n"); + g_main_loop_run (loop); + + /* clean up nicely */ + g_print ("Returned, stopping playback\n"); + gst_element_set_state (pipeline, GST_STATE_NULL); + g_print ("Deleting pipeline\n"); + gst_object_unref (GST_OBJECT (pipeline)); + + return 0; +} |