• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2009 Jan Schmidt <thaytan@noraisin.net>
3  *
4  * Test that the FFmpeg plugin is loadable, and not broken in some stupid
5  * way.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 
24 #include <gst/check/gstcheck.h>
25 #include <stdlib.h>
26 
GST_START_TEST(test_libav_plugin)27 GST_START_TEST (test_libav_plugin)
28 {
29   GstPlugin *plugin = gst_plugin_load_by_name ("libav");
30 
31   fail_if (plugin == NULL, "Could not load FFmpeg plugin");
32 
33   gst_object_unref (plugin);
34 
35 }
36 
37 GST_END_TEST;
38 
GST_START_TEST(test_libav_update_reg)39 GST_START_TEST (test_libav_update_reg)
40 {
41   GstElement *encoder, *muxer, *decoder;
42 
43   /* Ask for elements the first time */
44   encoder = gst_element_factory_make ("avenc_mpeg2video", "sink");
45   GST_DEBUG ("Creating element avenc_mpeg2video %p", encoder);
46   fail_unless (encoder != NULL);
47 
48   decoder = gst_element_factory_make ("avdec_mpeg2video", "sink");
49   GST_DEBUG ("Creating element avdec_mpeg2video %p", decoder);
50   fail_unless (decoder != NULL);
51 
52   muxer = gst_element_factory_make ("avmux_dvd", "sink");
53   GST_DEBUG ("Creating element avmux_dvd %p", muxer);
54   fail_unless (muxer != NULL);
55 
56   gst_object_unref (encoder);
57   gst_object_unref (decoder);
58   gst_object_unref (muxer);
59 
60   GST_DEBUG ("calls gst_update_registry");
61   gst_update_registry ();
62 
63   /* Ask for elements the second time */
64 
65   encoder = gst_element_factory_make ("avenc_mpeg2video", "sink");
66   GST_DEBUG ("Creating element avenc_mpeg2video %p", encoder);
67   fail_unless (encoder != NULL);
68 
69   decoder = gst_element_factory_make ("avdec_mpeg2video", "sink");
70   GST_DEBUG ("Creating element avdec_mpeg2video %p", decoder);
71   fail_unless (decoder != NULL);
72 
73   muxer = gst_element_factory_make ("avmux_dvd", "sink");
74   GST_DEBUG ("Creating element avmux_dvd %p", muxer);
75   fail_unless (muxer != NULL);
76 
77   gst_object_unref (encoder);
78   gst_object_unref (decoder);
79   gst_object_unref (muxer);
80 }
81 
82 GST_END_TEST;
83 
84 static Suite *
plugin_test_suite(void)85 plugin_test_suite (void)
86 {
87   Suite *s = suite_create ("Plugin");
88   TCase *tc_chain = tcase_create ("existence");
89 
90   suite_add_tcase (s, tc_chain);
91 
92   tcase_add_test (tc_chain, test_libav_plugin);
93   tcase_add_test (tc_chain, test_libav_update_reg);
94 
95   return s;
96 }
97 
98 GST_CHECK_MAIN (plugin_test);
99