How to convert g_object_set uri to C++

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to convert g_object_set uri to C++

Фамилия Имя
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Cedric Hombourger
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Фамилия Имя
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Фамилия Имя
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Cedric Hombourger

Please try the following:

Glib::RefPtr<Gst::ElementInterfaced<Gst::URIHandler>> handler = Gst::Interface::cast<Gst::URIHandler>(refPlay);
handler->set_uri("file:///path/to/file.mp3");

On Sep 4, 2012, at 8:21 AM, Фамилия Имя <[hidden email]> wrote:

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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Фамилия Имя
 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]>:
Please try the following:
Glib::RefPtr<Gst::ElementInterfaced<Gst::URIHandler>
> handler = Gst::Interface::cast<Gst::URIHandler>(refPlay);
handler->set_uri("file:///path/to/file.mp3");
On Sep 4, 2012, at 8:21 AM, Фамилия Имя <[hidden email]> wrote:

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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Cedric Hombourger
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:

 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]>:
Please try the following:
Glib::RefPtr<Gst::ElementInterfaced<Gst::URIHandler>
> handler = Gst::Interface::cast<Gst::URIHandler>(refPlay);
handler->set_uri("file:///path/to/file.mp3");
On Sep 4, 2012, at 8:21 AM, Фамилия Имя <[hidden email]> wrote:

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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to convert g_object_set uri to C++

Фамилия Имя
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:
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:

 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]>:
Please try the following:
Glib::RefPtr<Gst::ElementInterfaced<Gst::URIHandler>
> handler = Gst::Interface::cast<Gst::URIHandler>(refPlay);
handler->set_uri("file:///path/to/file.mp3");
On Sep 4, 2012, at 8:21 AM, Фамилия Имя <[hidden email]> wrote:

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

_______________________________________________
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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel