static void setup_cmmlenc (void) { guint64 granulerate_n, granulerate_d; GST_DEBUG ("setup_cmmlenc"); cmmlenc = gst_check_setup_element ("cmmlenc"); srcpad = gst_check_setup_src_pad (cmmlenc, &srctemplate, NULL); sinkpad = gst_check_setup_sink_pad (cmmlenc, &sinktemplate, NULL); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); bus = gst_bus_new (); gst_element_set_bus (cmmlenc, bus); fail_unless (gst_element_set_state (cmmlenc, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); g_object_get (cmmlenc, "granule-rate-numerator", &granulerate_n, "granule-rate-denominator", &granulerate_d, "granule-shift", &granuleshift, NULL); granulerate = GST_SECOND * granulerate_d / granulerate_n; }
static GstElement * setup_mpeg1layer3dec (void) { GstElement *mpg123audiodec; GstSegment seg; GstCaps *caps; GST_DEBUG ("setup_mpeg1layer3dec"); mpg123audiodec = gst_check_setup_element ("mpg123audiodec"); mysrcpad = gst_check_setup_src_pad (mpg123audiodec, &layer3_srctemplate); mysinkpad = gst_check_setup_sink_pad (mpg123audiodec, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); gst_segment_init (&seg, GST_FORMAT_TIME); gst_pad_push_event (mysrcpad, gst_event_new_segment (&seg)); /* This is necessary to trigger a set_format call in the decoder; * fixed caps don't trigger it */ caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 1, "parsed", G_TYPE_BOOLEAN, TRUE, NULL); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); return mpg123audiodec; }
static GstElement * setup_element (const gchar * factory, GstStaticPadTemplate * sink_template, GstCaps * sink_caps, GstStaticPadTemplate * src_template, GstCaps * src_caps) { GstElement *element; GstBus *bus; gchar *caps_str = NULL; element = gst_check_setup_element (factory); srcpad = gst_check_setup_src_pad (element, src_template); if (sink_caps) { caps_str = gst_caps_to_string (sink_caps); sink_template->static_caps.string = caps_str; } sinkpad = gst_check_setup_sink_pad (element, sink_template); gst_pad_set_active (srcpad, TRUE); gst_check_setup_events (srcpad, element, src_caps, GST_FORMAT_BYTES); gst_pad_set_active (sinkpad, TRUE); bus = gst_bus_new (); gst_element_set_bus (element, bus); fail_unless (gst_element_set_state (element, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); ts_counter = offset_counter = buffer_counter = 0; buffers = NULL; g_free (caps_str); return element; }
static GstElement * setup_vp8dec (const gchar * src_caps_str) { GstElement *bin; GstElement *vp8enc, *vp8dec; GstCaps *srccaps = NULL; GstBus *bus; GstPad *ghostpad, *targetpad; if (src_caps_str) { srccaps = gst_caps_from_string (src_caps_str); fail_unless (srccaps != NULL); } bin = gst_bin_new ("bin"); vp8enc = gst_check_setup_element ("vp8enc"); fail_unless (vp8enc != NULL); vp8dec = gst_check_setup_element ("vp8dec"); fail_unless (vp8dec != NULL); g_object_set (vp8enc, "name", "encoder", NULL); g_object_set (vp8dec, "name", "decoder", NULL); gst_bin_add_many (GST_BIN (bin), vp8enc, vp8dec, NULL); fail_unless (gst_element_link_pads (vp8enc, "src", vp8dec, "sink")); targetpad = gst_element_get_static_pad (vp8enc, "sink"); fail_unless (targetpad != NULL); ghostpad = gst_ghost_pad_new ("sink", targetpad); fail_unless (ghostpad != NULL); gst_element_add_pad (bin, ghostpad); gst_object_unref (targetpad); targetpad = gst_element_get_static_pad (vp8dec, "src"); fail_unless (targetpad != NULL); ghostpad = gst_ghost_pad_new ("src", targetpad); fail_unless (ghostpad != NULL); gst_element_add_pad (bin, ghostpad); gst_object_unref (targetpad); srcpad = gst_check_setup_src_pad (bin, &srctemplate); sinkpad = gst_check_setup_sink_pad (bin, &sinktemplate); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); gst_check_setup_events (srcpad, bin, srccaps, GST_FORMAT_TIME); bus = gst_bus_new (); gst_element_set_bus (bin, bus); fail_unless (gst_element_set_state (bin, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); if (srccaps) gst_caps_unref (srccaps); buffers = NULL; return bin; }
/* Create output-selector with given number of src pads and switch given number of input buffers to each src pad. */ static void run_output_selector_buffer_count (gint num_output_pads, gint num_buffers_per_output) { /* setup input_pad ! selector ! output_pads */ gint i = 0; GList *output_pads = NULL, *input_pads = NULL; GstElement *sel = gst_check_setup_element ("output-selector"); GstPad *input_pad = gst_check_setup_src_pad (sel, &srctemplate); input_pads = g_list_append (input_pads, input_pad); gst_pad_set_active (input_pad, TRUE); for (i = 0; i < num_output_pads; i++) { output_pads = g_list_append (output_pads, setup_output_pad (sel, NULL)); } /* run the test */ fail_unless (gst_element_set_state (sel, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); push_newsegment_events (input_pads); push_switched_buffers (input_pads, sel, output_pads, num_buffers_per_output); count_output_buffers (output_pads, num_buffers_per_output); fail_unless (gst_element_set_state (sel, GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); /* cleanup input_pad, selector and output_pads */ gst_pad_set_active (input_pad, FALSE); gst_check_teardown_src_pad (sel); g_list_foreach (output_pads, (GFunc) cleanup_pad, sel); g_list_free (output_pads); g_list_free (input_pads); gst_check_teardown_element (sel); }
static GstElement * setup_amrnbenc (void) { GstElement *amrnbenc; GstCaps *caps; GstBus *bus; GST_DEBUG ("setup_amrnbenc"); amrnbenc = gst_check_setup_element ("amrnbenc"); srcpad = gst_check_setup_src_pad (amrnbenc, &srctemplate); sinkpad = gst_check_setup_sink_pad (amrnbenc, &sinktemplate); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); bus = gst_bus_new (); gst_element_set_bus (amrnbenc, bus); fail_unless (gst_element_set_state (amrnbenc, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); caps = gst_caps_from_string (SRC_CAPS); gst_check_setup_events (srcpad, amrnbenc, caps, GST_FORMAT_TIME); gst_caps_unref (caps); buffers = NULL; return amrnbenc; }
static GstElement * setup_aacparse (const gchar * src_caps_str) { GstElement *aacparse; GstCaps *srccaps = NULL; GstBus *bus; if (src_caps_str) { srccaps = gst_caps_from_string (src_caps_str); fail_unless (srccaps != NULL); } aacparse = gst_check_setup_element ("aacparse"); srcpad = gst_check_setup_src_pad (aacparse, &srctemplate, srccaps); sinkpad = gst_check_setup_sink_pad (aacparse, &sinktemplate, NULL); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); bus = gst_bus_new (); gst_element_set_bus (aacparse, bus); fail_unless (gst_element_set_state (aacparse, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); if (srccaps) { gst_caps_unref (srccaps); } ts_counter = offset_counter = buffer_counter = 0; buffers = NULL; return aacparse; }
static GstElement * setup_element (const gchar * factory, GstStaticPadTemplate * sink_template, GstCaps * sink_caps, GstStaticPadTemplate * src_template, GstCaps * src_caps) { GstElement *element; GstBus *bus; element = gst_check_setup_element (factory); srcpad = gst_check_setup_src_pad (element, src_template, src_caps); sinkpad = gst_check_setup_sink_pad (element, sink_template, sink_caps); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); bus = gst_bus_new (); gst_element_set_bus (element, bus); fail_unless (gst_element_set_state (element, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); ts_counter = offset_counter = buffer_counter = 0; buffers = NULL; return element; }
static GstElement * setup_vp8enc (const gchar * src_caps_str) { GstElement *vp8enc; GstCaps *srccaps = NULL; GstBus *bus; if (src_caps_str) { srccaps = gst_caps_from_string (src_caps_str); fail_unless (srccaps != NULL); } vp8enc = gst_check_setup_element ("vp8enc"); fail_unless (vp8enc != NULL); srcpad = gst_check_setup_src_pad (vp8enc, &srctemplate); sinkpad = gst_check_setup_sink_pad (vp8enc, &sinktemplate); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); gst_check_setup_events (srcpad, vp8enc, srccaps, GST_FORMAT_TIME); bus = gst_bus_new (); gst_element_set_bus (vp8enc, bus); fail_unless (gst_element_set_state (vp8enc, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); if (srccaps) gst_caps_unref (srccaps); buffers = NULL; return vp8enc; }
static GstElement * setup_curlsmtpsink (void) { GST_DEBUG ("setup_curlsmtpsink"); sink = gst_check_setup_element ("curlsmtpsink"); srcpad = gst_check_setup_src_pad (sink, &srctemplate); fail_unless (gst_pad_set_active (srcpad, TRUE)); return sink; }
static GstElement * setup_curlfilesink (void) { GST_DEBUG ("setup_curlfielsink"); sink = gst_check_setup_element ("curlfilesink"); srcpad = gst_check_setup_src_pad (sink, &srctemplate); gst_pad_set_active (srcpad, TRUE); return sink; }
static GstElement * setup_filesink (void) { GstElement *filesink; GST_DEBUG ("setup_filesink"); filesink = gst_check_setup_element ("filesink"); mysrcpad = gst_check_setup_src_pad (filesink, &srctemplate); gst_pad_set_active (mysrcpad, TRUE); return filesink; }
static GstElement * setup_multifdsink (void) { GstElement *multifdsink; GST_DEBUG ("setup_multifdsink"); multifdsink = gst_check_setup_element ("multifdsink"); mysrcpad = gst_check_setup_src_pad (multifdsink, &srctemplate, NULL); return multifdsink; }
static void setup (void) { element = gst_check_setup_element ("rtponviftimestamp"); mysinkpad = gst_check_setup_sink_pad (element, &sinktemplate); gst_pad_set_active (mysinkpad, TRUE); mysrcpad = gst_check_setup_src_pad (element, &srctemplate); gst_pad_set_active (mysrcpad, TRUE); }
static GstElement * setup_gnomevfssink (void) { GstElement *gnomevfssink; GST_DEBUG ("setup_gnomevfssink"); gnomevfssink = gst_check_setup_element ("gnomevfssink"); mysrcpad = gst_check_setup_src_pad (gnomevfssink, &srctemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); return gnomevfssink; }
static GstElement * setup_audioresample (int channels, int inrate, int outrate, int width, gboolean fp) { GstElement *audioresample; GstCaps *caps; GstStructure *structure; GST_DEBUG ("setup_audioresample"); audioresample = gst_check_setup_element ("audioresample"); if (fp) caps = gst_caps_from_string (RESAMPLE_CAPS_FLOAT); else caps = gst_caps_from_string (RESAMPLE_CAPS_INT); structure = gst_caps_get_structure (caps, 0); gst_structure_set (structure, "channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, inrate, "width", G_TYPE_INT, width, NULL); if (!fp) gst_structure_set (structure, "depth", G_TYPE_INT, width, NULL); fail_unless (gst_caps_is_fixed (caps)); fail_unless (gst_element_set_state (audioresample, GST_STATE_PAUSED) == GST_STATE_CHANGE_SUCCESS, "could not set to paused"); mysrcpad = gst_check_setup_src_pad (audioresample, &srctemplate, caps); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); if (fp) caps = gst_caps_from_string (RESAMPLE_CAPS_FLOAT); else caps = gst_caps_from_string (RESAMPLE_CAPS_INT); structure = gst_caps_get_structure (caps, 0); gst_structure_set (structure, "channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, outrate, "width", G_TYPE_INT, width, NULL); if (!fp) gst_structure_set (structure, "depth", G_TYPE_INT, width, NULL); fail_unless (gst_caps_is_fixed (caps)); mysinkpad = gst_check_setup_sink_pad (audioresample, &sinktemplate, caps); /* this installs a getcaps func that will always return the caps we set * later */ gst_pad_set_caps (mysinkpad, caps); gst_pad_use_fixed_caps (mysinkpad); gst_pad_set_active (mysinkpad, TRUE); gst_pad_set_active (mysrcpad, TRUE); gst_caps_unref (caps); return audioresample; }
static GstElement * setup_multisocketsink (void) { GstElement *multisocketsink; GST_DEBUG ("setup_multisocketsink"); multisocketsink = gst_check_setup_element ("multisocketsink"); mysrcpad = gst_check_setup_src_pad (multisocketsink, &srctemplate); gst_pad_set_active (mysrcpad, TRUE); return multisocketsink; }
static void setup_output_selector (void) { sel = gst_check_setup_element ("output-selector"); input_pad = gst_check_setup_src_pad (sel, &srctemplate); gst_pad_set_active (input_pad, TRUE); output_pads = g_list_append (output_pads, setup_output_pad (sel, &sinktmpl_nego_a)); output_pads = g_list_append (output_pads, setup_output_pad (sel, &sinktmpl_nego_b)); }
static GstElement * setup_invert (void) { GstElement *invert; GST_DEBUG ("setup_invert"); invert = gst_check_setup_element ("audioinvert"); mysrcpad = gst_check_setup_src_pad (invert, &srctemplate); mysinkpad = gst_check_setup_sink_pad (invert, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return invert; }
static GstElement * setup_gdpdepay_streamheader (void) { GstElement *gdpdepay; GST_DEBUG ("setup_gdpdepay"); gdpdepay = gst_check_setup_element ("gdpdepay"); mysrcpad = gst_check_setup_src_pad (gdpdepay, &srctemplate, NULL); myshsinkpad = gst_check_setup_sink_pad (gdpdepay, &shsinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (myshsinkpad, TRUE); return gdpdepay; }
static GstElement * setup_jpegenc (GstStaticPadTemplate * sinktemplate) { GstElement *jpegenc; GST_DEBUG ("setup_jpegenc"); jpegenc = gst_check_setup_element ("jpegenc"); mysinkpad = gst_check_setup_sink_pad (jpegenc, sinktemplate, NULL); mysrcpad = gst_check_setup_src_pad (jpegenc, &any_srctemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return jpegenc; }
static GstElement * setup_vorbistag (void) { GstElement *vorbistag; GST_DEBUG ("setup_vorbistag"); vorbistag = gst_check_setup_element ("vorbistag"); mysrcpad = gst_check_setup_src_pad (vorbistag, &srctemplate); mysinkpad = gst_check_setup_sink_pad (vorbistag, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return vorbistag; }
/* takes over reference for outcaps */ static GstElement * setup_gdppay (void) { GstElement *gdppay; GST_DEBUG ("setup_gdppay"); gdppay = gst_check_setup_element ("gdppay"); mysrcpad = gst_check_setup_src_pad (gdppay, &srctemplate); mysinkpad = gst_check_setup_sink_pad (gdppay, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return gdppay; }
static GstElement * setup_opusenc (void) { GstElement *opusenc; GST_DEBUG ("setup_opusenc"); opusenc = gst_check_setup_element ("opusenc"); myencsrcpad = gst_check_setup_src_pad (opusenc, &srctemplate); myencsinkpad = gst_check_setup_sink_pad (opusenc, &sinktemplate); gst_pad_set_active (myencsrcpad, TRUE); gst_pad_set_active (myencsinkpad, TRUE); return opusenc; }
/* takes over reference for outcaps */ GstElement * setup_spectrum () { GstElement *spectrum; GST_DEBUG ("setup_spectrum"); spectrum = gst_check_setup_element ("spectrum"); mysrcpad = gst_check_setup_src_pad (spectrum, &srctemplate, NULL); mysinkpad = gst_check_setup_sink_pad (spectrum, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return spectrum; }
GstElement * setup_x264enc () { GstElement *x264enc; GST_DEBUG ("setup_x264enc"); x264enc = gst_check_setup_element ("x264enc"); mysrcpad = gst_check_setup_src_pad (x264enc, &srctemplate, NULL); mysinkpad = gst_check_setup_sink_pad (x264enc, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return x264enc; }
static void setup_subparse (void) { subparse = gst_check_setup_element ("subparse"); mysrcpad = gst_check_setup_src_pad (subparse, &srctemplate); mysinkpad = gst_check_setup_sink_pad (subparse, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); fail_unless_equals_int (gst_element_set_state (subparse, GST_STATE_PLAYING), GST_STATE_CHANGE_SUCCESS); }
GstElement * setup_dynamic () { GstElement *dynamic; GST_DEBUG ("setup_dynamic"); dynamic = gst_check_setup_element ("audiodynamic"); mysrcpad = gst_check_setup_src_pad (dynamic, &srctemplate, NULL); mysinkpad = gst_check_setup_sink_pad (dynamic, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return dynamic; }
void test_large_discont() { GstElement *audiorate; GstCaps *caps; GstPad *srcpad, *sinkpad; GstBuffer *buf; //xmlfile = "test_large_discont"; std_log(LOG_FILENAME_LINE, "Test Started test_large_discont"); audiorate = gst_check_setup_element ("audiorate"); caps = gst_caps_new_simple ("audio/x-raw-float", "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 44100, "width", G_TYPE_INT, 32, NULL); srcpad = gst_check_setup_src_pad (audiorate, &srctemplate, caps); sinkpad = gst_check_setup_sink_pad (audiorate, &sinktemplate, caps); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); fail_unless (gst_element_set_state (audiorate, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "failed to set audiorate playing"); buf = gst_buffer_new_and_alloc (4); gst_buffer_set_caps (buf, caps); GST_BUFFER_TIMESTAMP (buf) = 0; gst_pad_push (srcpad, buf); fail_unless_equals_int (g_list_length (buffers), 1); buf = gst_buffer_new_and_alloc (4); gst_buffer_set_caps (buf, caps); GST_BUFFER_TIMESTAMP (buf) = 2 * GST_SECOND; gst_pad_push (srcpad, buf); /* Now we should have 3 more buffers: the one we injected, plus _two_ filler * buffers, because the gap is > 1 second (but less than 2 seconds) */ fail_unless_equals_int (g_list_length (buffers), 4); gst_element_set_state (audiorate, GST_STATE_NULL); gst_caps_unref (caps); gst_check_teardown_sink_pad (audiorate); gst_check_teardown_src_pad (audiorate); gst_object_unref (audiorate); std_log(LOG_FILENAME_LINE, "Test Successful"); create_xml(0); }
static GstElement * setup_echo (void) { GstElement *echo; GST_DEBUG ("setup_echo"); echo = gst_check_setup_element ("audioecho"); mysrcpad = gst_check_setup_src_pad (echo, &srctemplate); mysinkpad = gst_check_setup_sink_pad (echo, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); return echo; }