Esempio n. 1
0
static GstParseContext *
gst_parse_context_copy (const GstParseContext * context)
{
  GstParseContext *ret = NULL;
#ifndef GST_DISABLE_PARSE

  ret = gst_parse_context_new ();
  if (context) {
    g_list_foreach (context->missing_elements, (GFunc) _prepend_missing_element,
        &ret->missing_elements);
    ret->missing_elements = g_list_reverse (ret->missing_elements);
  }
#endif
  return ret;
}
Esempio n. 2
0
static GstParseContext *
gst_parse_context_copy (const GstParseContext * context)
{
  GstParseContext *ret = NULL;
#ifndef GST_DISABLE_PARSE

  ret = gst_parse_context_new ();
  if (context) {
    GQueue missing_copy = G_QUEUE_INIT;
    GList *l;

    for (l = context->missing_elements; l != NULL; l = l->next)
      g_queue_push_tail (&missing_copy, g_strdup ((const gchar *) l->data));

    ret->missing_elements = missing_copy.head;
  }
#endif
  return ret;
}
Esempio n. 3
0
void test_missing_elements()
{
  GstParseContext *ctx;
  GstElement *element;
  GError *err = NULL;
  gchar **arr;

  xmlfile = "test_missing_elements";
    std_log(LOG_FILENAME_LINE, "Test Started test_missing_elements");
  /* avoid misleading 'no such element' error debug messages when using cvs */
  if (!g_getenv ("GST_DEBUG"))
    gst_debug_set_default_threshold (GST_LEVEL_NONE);

  /* one missing element */
  ctx = gst_parse_context_new ();
  element = gst_parse_launch_full ("fakesrc ! coffeesink", ctx,
      GST_PARSE_FLAG_FATAL_ERRORS, &err);
  fail_unless (err != NULL, "expected error");
  fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT);
  fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
  arr = gst_parse_context_get_missing_elements (ctx);
  fail_unless (arr != NULL, "expected missing elements");
  fail_unless_equals_string (arr[0], "coffeesink");
  fail_unless (arr[1] == NULL);
  g_strfreev (arr);
  gst_parse_context_free (ctx);
  g_error_free (err);
  err = NULL;

  /* multiple missing elements */
  ctx = gst_parse_context_new ();
  element = gst_parse_launch_full ("fakesrc ! bogusenc ! identity ! goomux ! "
      "fakesink", ctx, GST_PARSE_FLAG_FATAL_ERRORS, &err);
  fail_unless (err != NULL, "expected error");
  fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT);
  fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
  arr = gst_parse_context_get_missing_elements (ctx);
  fail_unless (arr != NULL, "expected missing elements");
  fail_unless_equals_string (arr[0], "bogusenc");
  fail_unless_equals_string (arr[1], "goomux");
  fail_unless (arr[2] == NULL);
  g_strfreev (arr);
  gst_parse_context_free (ctx);
  g_error_free (err);
  err = NULL;

  /* multiple missing elements, different link pattern */
  ctx = gst_parse_context_new ();
  element = gst_parse_launch_full ("fakesrc ! bogusenc ! mux.sink "
      "blahsrc ! goomux name=mux ! fakesink   fakesrc ! goosink", ctx,
      GST_PARSE_FLAG_FATAL_ERRORS, &err);
  fail_unless (err != NULL, "expected error");
  fail_unless_equals_int (err->code, GST_PARSE_ERROR_NO_SUCH_ELEMENT);
  fail_unless (element == NULL, "expected NULL return with FATAL_ERRORS");
  arr = gst_parse_context_get_missing_elements (ctx);
  fail_unless (arr != NULL, "expected missing elements");
  fail_unless_equals_string (arr[0], "bogusenc");
  fail_unless_equals_string (arr[1], "blahsrc");
  fail_unless_equals_string (arr[2], "goomux");
  fail_unless_equals_string (arr[3], "goosink");
  fail_unless (arr[4] == NULL);
  g_strfreev (arr);
  gst_parse_context_free (ctx);
  g_error_free (err);
  err = NULL;
  
  std_log(LOG_FILENAME_LINE, "Test Successful");
   create_xml(0);
}