--- a/gst_plugins_base/tsrc/check/elements/volume/src/volume.c Fri Mar 19 09:35:09 2010 +0200
+++ b/gst_plugins_base/tsrc/check/elements/volume/src/volume.c Fri Apr 16 15:15:52 2010 +0300
@@ -51,11 +51,20 @@
void create_xml(int result)
{
+
if(result)
+ {
assert_failed = 1;
-
+ }
+
testResultXml(xmlfile);
close_log_file();
+
+ if(result)
+ {
+ exit (-1);
+ }
+
}
#define VOLUME_CAPS_TEMPLATE_STRING \
@@ -1482,8 +1491,8 @@
volume = setup_volume ();
- g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
- gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (volume), TRUE);
+ g_object_set (G_OBJECT (volume), "volume", 1.0, NULL);
+
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
@@ -1554,6 +1563,59 @@
create_xml(0);
}
+void test_controller_processing()
+{
+ GstInterpolationControlSource *csource;
+ GstController *c;
+ GstElement *volume;
+ GstBuffer *inbuffer, *outbuffer;
+ GstCaps *caps;
+ gint16 in[2] = { 16384, -256 };
+ gint16 *res;
+
+ std_log(LOG_FILENAME_LINE, "Test Started test_controller_processing");
+ volume = setup_volume ();
+
+ c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
+
+ fail_unless (GST_IS_CONTROLLER (c));
+
+ csource = gst_interpolation_control_source_new ();
+ gst_interpolation_control_source_set_interpolation_mode (csource,
+ GST_INTERPOLATE_CUBIC);
+ gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
+ g_object_unref (csource);
+
+ fail_unless (gst_element_set_state (volume,
+ GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
+ "could not set to playing");
+
+ inbuffer = gst_buffer_new_and_alloc (4);
+ memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
+ caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
+ gst_buffer_set_caps (inbuffer, caps);
+ GST_BUFFER_TIMESTAMP (inbuffer) = 0;
+ gst_caps_unref (caps);
+ ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+
+ /* pushing gives away my reference ... */
+ fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
+ /* ... but it ends up being collected on the global buffer list */
+ ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
+ fail_unless_equals_int (g_list_length (buffers), 1);
+ fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
+ fail_unless (inbuffer == outbuffer);
+ res = (gint16 *) GST_BUFFER_DATA (outbuffer);
+ GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
+ fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
+
+ g_object_unref (c);
+
+ cleanup_volume (volume);
+
+ std_log(LOG_FILENAME_LINE, "Test Successful");
+ create_xml(0);
+}
//static Suite *
@@ -1594,7 +1656,7 @@
// return s;
//}
-void (*fn[27]) (void) = {
+void (*fn[]) (void) = {
test_unity_s8,
test_half_s8,
test_double_s8,
@@ -1621,7 +1683,8 @@
test_mute_f64,
test_wrong_caps,
test_passthrough,
- test_controller_usability
+ test_controller_usability,
+ test_controller_processing
};
char *args[] = {
@@ -1651,7 +1714,8 @@
"test_mute_f64",
"test_wrong_caps",
"test_passthrough",
- "test_controller_usability"
+ "test_controller_usability",
+ "test_controller_processing"
};
GST_CHECK_MAIN (volume)