Hi,
Sorry if it's the wrong place, What would be the C++ version of setting the "uri" of the Gst::Element: g_object_set(G_OBJECT(refElement->gobj()), "uri", "file:///path/to/file.mp3", NULL); _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
Are you using the C API or some sort of C++ bindings to GStreamer? Cedric On Sep 4, 2012, at 7:47 AM, Фамилия Имя <[hidden email]> wrote: > Hi, > Sorry if it's the wrong place, > What would be the C++ version of setting the "uri" of the Gst::Element: > g_object_set(G_OBJECT(refElement->gobj()), "uri", "file:///path/to/file.mp3", NULL); > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I'm using the (standard) C++ bindings available on Ubuntu (12.04) by installing libgstreamermm-0.10-dev
04.09.2012, 09:11, "Cedric Hombourger" <[hidden email]>: > Hi, > > Are you using the C API or some sort of C++ bindings to GStreamer? > > Cedric > > On Sep 4, 2012, at 7:47 AM, Фамилия Имя <[hidden email]> wrote: >> Hi, >> Sorry if it's the wrong place, >> What would be the C++ version of setting the "uri" of the Gst::Element: >> g_object_set(G_OBJECT(refElement->gobj()), "uri", "file:///path/to/file.mp3", NULL); >> >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
btw, refPlay is a playbin var created this way:
Glib::RefPtr<Gst::Element> refPlay = Gst::ElementFactory::create_element("playbin", "play"); 04.09.2012, 09:19, "Фамилия Имя" <[hidden email]>: > I'm using the (standard) C++ bindings available on Ubuntu (12.04) by installing libgstreamermm-0.10-dev > > 04.09.2012, 09:11, "Cedric Hombourger" <[hidden email]>: > >> Hi, >> >> Are you using the C API or some sort of C++ bindings to GStreamer? >> >> Cedric >> >> On Sep 4, 2012, at 7:47 AM, Фамилия Имя <[hidden email]> wrote: >>> Hi, >>> Sorry if it's the wrong place, >>> What would be the C++ version of setting the "uri" of the Gst::Element: >>> g_object_set(G_OBJECT(refElement->gobj()), "uri", "file:///path/to/file.mp3", NULL); >>> >>> _______________________________________________ >>> gstreamer-devel mailing list >>> [hidden email] >>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Please try the following: Glib::RefPtr<Gst::ElementInterfaced<Gst::URIHandler>> handler = Gst::Interface::cast<Gst::URIHandler>(refPlay); On Sep 4, 2012, at 8:21 AM, Фамилия Имя <[hidden email]> wrote: btw, refPlay is a playbin var created this way: _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks, unfortunately I get a segmentation fault, here's a snippet that compiles: #include <gstreamermm.h> #include <iostream> static Glib::RefPtr<Glib::MainLoop> refLoop; gint main(gint argc, gchar *argv[]) { if (!Glib::thread_supported()) { Glib::thread_init(); } Gst::init(argc, argv); if (argc != 2) { g_print("Usage: %s <URI>\n", argv[0]); return -1; } Glib::RefPtr<Gst::Element> refPlay = Gst::ElementFactory::create_element("playbin", "play"); //g_object_set(G_OBJECT(refPlay->gobj()), "uri", argv[1], NULL); Glib::RefPtr< Gst::ElementInterfaced<Gst::URIHandler> > handler = Gst::Interface::cast<Gst::URIHandler>(refPlay); Glib::ustring sURL(argv[1]); handler->set_uri(sURL); refPlay->set_state(Gst::STATE_PLAYING); refLoop = Glib::MainLoop::create(false); refLoop->run(); refPlay->set_state(Gst::STATE_NULL); return 0; } 04.09.2012, 09:27, "Cedric Hombourger" <[hidden email]>:
_______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Sorry I have this more complicated than it needs to be. Please do the following instead:
Glib::ustring sURL(argv[1]); refPlay->set_property("uri", sURL); Tested OK with your test program on Ubuntu. Cedric On Sep 4, 2012, at 8:36 AM, Фамилия Имя <[hidden email]> wrote:
_______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks a lot! It works! 04.09.2012, 10:50, "Cedric Hombourger" <[hidden email]>: Sorry I have this more complicated than it needs to be. Please do the following instead: _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |