5 * Copyright (C) 2007 Thomas Vander Stichele <thomas at apestaart dot org>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include <gst/check/gstcheck.h>
24 #include <gst/check/gstbufferstraw.h>
26 #ifndef GST_DISABLE_PARSE
28 GST_START_TEST (test_format)
36 pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
37 "! audio/x-raw-int, rate=22050, channels=1 "
38 "! lame bitrate=24 mode=3 " "! audio/mpeg,rate=22050 ! fakesink");
40 bin = gst_parse_launch (pipe_str, &error);
41 fail_unless (bin != NULL, "Error parsing pipeline: %s",
42 error ? error->message : "(invalid error)");
47 GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
49 fail_unless (sink != NULL, "Could not get fakesink out of bin");
50 pad = gst_element_get_static_pad (sink, "sink");
51 fail_unless (pad != NULL, "Could not get pad out of fakesink");
52 gst_object_unref (sink);
55 gst_buffer_straw_start_pipeline (bin, pad);
57 buffer = gst_buffer_straw_get_buffer (bin, pad);
59 gst_buffer_straw_stop_pipeline (bin, pad);
61 gst_buffer_unref (buffer);
62 gst_object_unref (pad);
63 gst_object_unref (bin);
68 GST_START_TEST (test_caps_proxy)
76 pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
77 "! audio/x-raw-int,rate=48000,channels=1 "
79 "! lamemp3enc ! audio/mpeg,rate=(int){22050,44100} ! fakesink");
81 bin = gst_parse_launch (pipe_str, &error);
82 fail_unless (bin != NULL, "Error parsing pipeline: %s",
83 error ? error->message : "(invalid error)");
88 GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
90 fail_unless (sink != NULL, "Could not get fakesink out of bin");
91 pad = gst_element_get_static_pad (sink, "sink");
92 fail_unless (pad != NULL, "Could not get pad out of fakesink");
93 gst_object_unref (sink);
96 gst_buffer_straw_start_pipeline (bin, pad);
98 buffer = gst_buffer_straw_get_buffer (bin, pad);
100 gst_buffer_straw_stop_pipeline (bin, pad);
102 gst_buffer_unref (buffer);
103 gst_object_unref (pad);
104 gst_object_unref (bin);
109 #endif /* #ifndef GST_DISABLE_PARSE */
114 Suite *s = suite_create ("lame");
115 TCase *tc_chain = tcase_create ("general");
117 suite_add_tcase (s, tc_chain);
119 #ifndef GST_DISABLE_PARSE
120 tcase_add_test (tc_chain, test_format);
121 tcase_add_test (tc_chain, test_caps_proxy);
128 main (int argc, char **argv)
132 Suite *s = lame_suite ();
133 SRunner *sr = srunner_create (s);
135 gst_check_init (&argc, &argv);
137 srunner_run_all (sr, CK_NORMAL);
138 nf = srunner_ntests_failed (sr);