GStreamermm - Unable to get Gst::TagList from stream



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

/* 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



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