Re: GStreamermm - Unable to get Gst::TagList from stream



Thank you Jose! It worked!

2011/6/20 José Alburquerque <jaalburquerque cox net>
Resending a second time because the message didn't make it to the list.  Sorry.

On Mon, 2011-06-20 at 03:50 -0400, Phong Cao wrote:
> Hello everybody,
>
>
> I am trying to create a simple music manager software that can get and
> display tags from a stream using GStreamermm (without playing it). My
> plan was to open the media file, set its state to PAUSED and then read
> the Gst::TagList from the Gst::Bus of the stream. Here is how I did
> it:
>
>
> /* Create a "fakeplay" playbin2 */
>     Glib::RefPtr<Gst::PlayBin2> fakeplay =
> Gst::PlayBin2::create("fakeplay");
>
>
>     if (!fakeplay) {
>       std::cerr << "The playbin could not be created." << std::endl;
>     }
>
>
> /* Set an uri for the playbin and set playbin's state to PAUSED: */
>     fakeplay->property_uri() = fileuri;
>     fakeplay->set_state(Gst::STATE_PAUSED);
>
>
> /* Get a Gst::MessageTag (msgtag) from the Gst::Bus of the playbin
> ("fakeplay"). */
>     Glib::RefPtr<Gst::Message> tempmsg =
> fakeplay->get_bus()->pop(Gst::CLOCK_TIME_NONE, Gst::MESSAGE_TAG);
>
>     Gst::MessageTag msgtag;
>     msgtag.MessageTag(tempmsg);  //the error is here

You're probably trying to convert the Gst::Message to a Gst::MessageTag.
The correct way to do that would be:

Glib::RefPtr<Gst::MessageTag> msgtag =
Glib::RefPtr<Gst::MessageTag>::cast_static(tempmsg);

>
>
> /* Now parse() the msgtag to get a Gst::TagList */
>     Gst::TagList taglist = msgtag.parse();
>
>
> /* Insert tag on treeview using member function
> TopWin::insert_tag_on_mb_treeview() */
>     TopWin::insert_tag_on_mb_treeview(taglist, fileuri);
>
>
> However, after trying to compile this code I got an error:
> error: conversion from ‘Glib::RefPtr<Gst::Message>’ to non-scalar type
> ‘Gst::MessageTag’ requested
>
>
> And I think I know the reason for the error. In the 3rd step I was
> unable to retrieve a Gst::MessageTag. However, I really do not know
> how to retrieve it. I could not use Gst::Bus::add_watch to watch for
> Gst::MESSAGE_TAG since I just want to import the file, not running the
> MainLoop.
>
>
> I have been trying to solve this problem for several hours and could
> not find a better way to get the Gst::TagList WITHOUT PLAYING the
> stream.
>
>
> Do you guys here have any better idea to handle this situation? If so
> please share!
>
>
> Thank you for reading my message! I hope you guys have a good day!!
>
>
>
>
> Best regards,
>
>
>
>
> Phong Cao,
> phngcv gmail com
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

--
José






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]