Debian Codegraph @

tests/test-urihandler.cc

raw symbols SCIP
1 /*
2 * test-urihandler.cc
3 *
4 * Created on: May 16, 2014
5 * Author: m.kolny
6 */
7 #include "mmtest.h"
8 #include <gstreamermm.h>
9 #include <gstreamermm/private/element_p.h>
10
11 using namespace Gst;
12
13 class UriTestElement: public URIHandler, public Gst::Element {
14 public:
15 typedef Gst::Element::BaseClassType BaseClassType;
16 typedef Gst::Element::BaseObjectType BaseObjectType;
17 typedef Gst::Element::CppClassType CppClassType;
18
19 public:
20 static GType get_base_type() G_GNUC_CONST
21 {
22 return Element::get_base_type();
23 }
24
25 static void class_init(Gst::ElementClass<UriTestElement> *klass)
26 {
27 klass->set_metadata("uri_longname", "uri_classification",
28 "uri_detail_description", "uri_detail_author");
29 }
30
31 explicit UriTestElement(GstElement *gobj)
32 : Glib::ObjectBase(typeid(UriTestElement)),
33 Gst::Element(gobj)
34 {
35 }
36
37 bool set_uri_vfunc(const Glib::ustring& /* uri */, GError** /* error */)
38 {
39 return true;
40 }
41
42 const gchar * const * get_protocols_vfunc() const
43 {
44 static const gchar* vect[] = { "dummyprotocol", NULL };
45
46 return vect;
47 }
48
49 URIType get_type_vfunc() override
50 {
51 return URI_SINK;
52 }
53
54 static bool register_uritestelement(Glib::RefPtr<Gst::Plugin> plugin)
55 {
56 auto t = Gst::register_mm_type<UriTestElement>("uritestelement");
57 add_interface(t);
58
59 return Gst::ElementFactory::register_element(plugin, "uritestelement", 10, t);
60 }
61 };
62
63 TEST(URIHandlerTest, CheckURIType)
64 {
65 Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR, "uritestelement", "uritestelement is example of C++ element",
66 sigc::ptr_fun(&UriTestElement::register_uritestelement), "0.123", "LGPL", "source?", "package?",
67 "http://example.com");
68
69 Glib::ustring factory_name =
70 URIHandler::make_element_from_uri(URI_SINK, "dummyprotocol:some/path", "dummy_name")->get_factory()->get_name();
71
72 ASSERT_STREQ("uritestelement", factory_name.c_str());
73 }