~ubuntu-branches/ubuntu/quantal/gst-plugins-bad-multiverse0.10/quantal

« back to all changes in this revision

Viewing changes to tests/check/pipelines/mimic.c

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2009-12-07 08:54:28 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20091207085428-ml6aaukf0p2ph34d
Tags: 0.10.17-0ubuntu1
* New upstream release.
* Add myself to maintainer.
* Fix misc lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GStreamer
 
2
 *
 
3
 * unit test for mimic
 
4
 *
 
5
 * Copyright 2009 Collabora Ltd.
 
6
 *  @author: Olivier Crete <olivier.crete@collabora.co.uk>
 
7
 * Copyright 2009 Nokia Corp.
 
8
 *
 
9
 * This library is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU Library General Public
 
11
 * License as published by the Free Software Foundation; either
 
12
 * version 2 of the License, or (at your option) any later version.
 
13
 *
 
14
 * This library is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
 * Library General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU Library General Public
 
20
 * License along with this library; if not, write to the
 
21
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
22
 * Boston, MA 02111-1307, USA.
 
23
 */
 
24
 
 
25
#include <gst/check/gstcheck.h>
 
26
 
 
27
static GMainLoop *loop;
 
28
 
 
29
static void
 
30
eos_message_cb (GstBus * bus, GstMessage * message, gpointer user_data)
 
31
{
 
32
  GST_DEBUG ("Received eos");
 
33
  g_main_loop_quit (loop);
 
34
}
 
35
 
 
36
GST_START_TEST (test_mimic_pipeline)
 
37
{
 
38
  GstElement *pipeline;
 
39
  GError *error = NULL;
 
40
  GstBus *bus;
 
41
  const gchar *bin_str = "videotestsrc num-buffers=10 ! mimenc ! "
 
42
      "mimdec ! fakesink";
 
43
 
 
44
  pipeline = gst_parse_launch (bin_str, &error);
 
45
  fail_unless (pipeline != NULL, "Error parsing pipeline: %s", bin_str,
 
46
      error ? error->message : "(invalid error)");
 
47
 
 
48
  loop = g_main_loop_new (NULL, FALSE);
 
49
  bus = gst_element_get_bus (pipeline);
 
50
  gst_bus_add_signal_watch (bus);
 
51
  g_signal_connect (bus, "message::eos", (GCallback) eos_message_cb, NULL);
 
52
  gst_object_unref (bus);
 
53
 
 
54
  fail_unless (gst_element_set_state (pipeline, GST_STATE_PLAYING)
 
55
      != GST_STATE_CHANGE_FAILURE);
 
56
 
 
57
  g_main_loop_run (loop);
 
58
  g_main_loop_unref (loop);
 
59
 
 
60
  gst_element_set_state (pipeline, GST_STATE_NULL);
 
61
  gst_object_unref (pipeline);
 
62
}
 
63
 
 
64
GST_END_TEST;
 
65
 
 
66
static Suite *
 
67
mimic_suite (void)
 
68
{
 
69
  Suite *s = suite_create ("mimic");
 
70
  TCase *tc_chain;
 
71
 
 
72
  tc_chain = tcase_create ("mimic_pipeline");
 
73
  tcase_add_test (tc_chain, test_mimic_pipeline);
 
74
  suite_add_tcase (s, tc_chain);
 
75
 
 
76
  return s;
 
77
}
 
78
 
 
79
GST_CHECK_MAIN (mimic)