/* * Test if parser drains its buffers properly. Even one single frame * should be drained and pushed forward when EOS occurs. This single frame * case is special, since normally the parser needs more data to be sure * about stream format. But it should still push the frame forward in EOS. */ void gst_parser_test_drain_single (guint8 * data, guint size) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 1); gst_parser_test_run (&ptest, NULL); }
/* * Test if the parser pushes clean data properly. */ void gst_parser_test_normal (guint8 * data, guint size) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 10); gst_parser_test_run (&ptest, NULL); }
/* * Test if parser splits a buffer that contains two frames into two * separate buffers properly. */ void gst_parser_test_split (guint8 * data, guint size) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 10); ptest.series[0].fpb = 2; gst_parser_test_run (&ptest, NULL); }
/* * Make sure that parser does not drain garbage when EOS occurs. */ void gst_parser_test_drain_garbage (guint8 * data, guint size, guint8 * garbage, guint gsize) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 1); ptest.series[1].data = garbage; ptest.series[1].size = gsize; ptest.series[1].num = 1; gst_parser_test_run (&ptest, NULL); }
/* * Make sure that parser does not drain garbage when EOS occurs. */ void gst_parser_test_drain_garbage (guint8 * data, guint size, guint8 * garbage, guint gsize) { GstParserTest ptest; /* provide enough initial frames since it may take some parsers some * time to be convinced of proper sync */ gst_parser_test_init (&ptest, data, size, 10); ptest.series[1].data = garbage; ptest.series[1].size = gsize; ptest.series[1].num = 1; gst_parser_test_run (&ptest, NULL); }
/* * Test if the parser skips garbage between frames properly. */ void gst_parser_test_skip_garbage (guint8 * data, guint size, guint8 * garbage, guint gsize) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 10); ptest.series[1].data = garbage; ptest.series[1].size = gsize; ptest.series[1].num = 1; ptest.series[2].data = data; ptest.series[2].size = size; ptest.series[2].num = 10; gst_parser_test_run (&ptest, NULL); }
/* * Test if the src caps are set according to stream format. */ GstCaps * gst_parser_test_get_output_caps (guint8 * data, guint size, const gchar * input_caps) { GstParserTest ptest; GstCaps *out_caps; gst_parser_test_init (&ptest, data, size, 10); if (input_caps) { ptest.src_caps = gst_caps_from_string (input_caps); fail_unless (ptest.src_caps != NULL); } gst_parser_test_run (&ptest, &out_caps); if (ptest.src_caps) gst_caps_unref (ptest.src_caps); return out_caps; }
/* * Test if the src caps are set according to stream format. */ void gst_parser_test_output_caps (guint8 * data, guint size, const gchar * input_caps, const gchar * output_caps) { GstParserTest ptest; gst_parser_test_init (&ptest, data, size, 10); if (input_caps) { ptest.src_caps = gst_caps_from_string (input_caps); fail_unless (ptest.src_caps != NULL); } if (output_caps) { ptest.sink_caps = gst_caps_from_string (output_caps); fail_unless (ptest.sink_caps != NULL); } gst_parser_test_run (&ptest, NULL); if (ptest.sink_caps) gst_caps_unref (ptest.sink_caps); if (ptest.src_caps) gst_caps_unref (ptest.src_caps); }