summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-08-25 21:13:58 +0100
committerTim-Philipp Müller <tim@centricular.com>2017-08-25 21:13:58 +0100
commit53ec444963e273376c7a96865dd6b32e1e8fc65e (patch)
tree5b4570d922cf609ccf5377dc0a9248fa007e2437 /tests
parent97b58bd263f4f300017e7dec2fc556fc8152c7b4 (diff)
parent3169f86edd6099cce709d5cfdcaabd3ca7588ed4 (diff)
Moving lame mp3 encoder plugin from -ugly
https://bugzilla.gnome.org/show_bug.cgi?id=774252
Diffstat (limited to 'tests')
-rw-r--r--tests/check/pipelines/lame.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/tests/check/pipelines/lame.c b/tests/check/pipelines/lame.c
new file mode 100644
index 000000000..a69f58a9c
--- /dev/null
+++ b/tests/check/pipelines/lame.c
@@ -0,0 +1,127 @@
+/* GStreamer
+ *
+ * unit test for lame
+ *
+ * Copyright (C) 2007 Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/check/gstcheck.h>
+#include <gst/check/gstbufferstraw.h>
+
+#ifndef GST_DISABLE_PARSE
+
+GST_START_TEST (test_format)
+{
+ GstElement *bin;
+ GstPad *pad;
+ gchar *pipe_str;
+ GstBuffer *buffer;
+ GError *error = NULL;
+
+ pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
+ "! audio/x-raw, rate=22050, channels=1 "
+ "! lamemp3enc bitrate=24 ! audio/mpeg,rate=22050 ! fakesink");
+
+ bin = gst_parse_launch (pipe_str, &error);
+ fail_unless (bin != NULL, "Error parsing pipeline: %s",
+ error ? error->message : "(invalid error)");
+ g_free (pipe_str);
+
+ /* get the pad */
+ {
+ GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
+
+ fail_unless (sink != NULL, "Could not get fakesink out of bin");
+ pad = gst_element_get_static_pad (sink, "sink");
+ fail_unless (pad != NULL, "Could not get pad out of fakesink");
+ gst_object_unref (sink);
+ }
+
+ gst_buffer_straw_start_pipeline (bin, pad);
+
+ buffer = gst_buffer_straw_get_buffer (bin, pad);
+
+ gst_buffer_straw_stop_pipeline (bin, pad);
+
+ gst_buffer_unref (buffer);
+ gst_object_unref (pad);
+ gst_object_unref (bin);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_caps_proxy)
+{
+ GstElement *bin;
+ GstPad *pad;
+ gchar *pipe_str;
+ GstBuffer *buffer;
+ GError *error = NULL;
+
+ pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
+ "! audio/x-raw,rate=48000,channels=1 "
+ "! audioresample "
+ "! lamemp3enc ! audio/mpeg,rate=(int){22050,44100} ! fakesink");
+
+ bin = gst_parse_launch (pipe_str, &error);
+ fail_unless (bin != NULL, "Error parsing pipeline: %s",
+ error ? error->message : "(invalid error)");
+ g_free (pipe_str);
+
+ /* get the pad */
+ {
+ GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
+
+ fail_unless (sink != NULL, "Could not get fakesink out of bin");
+ pad = gst_element_get_static_pad (sink, "sink");
+ fail_unless (pad != NULL, "Could not get pad out of fakesink");
+ gst_object_unref (sink);
+ }
+
+ gst_buffer_straw_start_pipeline (bin, pad);
+
+ buffer = gst_buffer_straw_get_buffer (bin, pad);
+
+ gst_buffer_straw_stop_pipeline (bin, pad);
+
+ gst_buffer_unref (buffer);
+ gst_object_unref (pad);
+ gst_object_unref (bin);
+}
+
+GST_END_TEST;
+
+#endif /* #ifndef GST_DISABLE_PARSE */
+
+Suite *
+lame_suite (void)
+{
+ Suite *s = suite_create ("lame");
+ TCase *tc_chain = tcase_create ("general");
+
+ suite_add_tcase (s, tc_chain);
+
+#ifndef GST_DISABLE_PARSE
+ tcase_add_test (tc_chain, test_format);
+ tcase_add_test (tc_chain, test_caps_proxy);
+#endif
+
+ return s;
+}
+
+GST_CHECK_MAIN (lame);