Hi guys,

I am developing a small project called Dingo. It uses GStreamermm that lets
the users select a media file through Gtk::FileChooserDialog, get the
Gst::TagList using Gst::Discoverer, and then print out the metadata of the
media file. The project was compiled and I tried it with some of my music
files. All of the metadata could be read except for the
Gst::TAG_DURATION... It always returned the following error:

(main:3956): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE
(value)' failed

I went through the Gst::TagList reference and it is said that
Gst::TagList::get_value(Gst::TAG_DURATION, Glib::ValueBase& value) required
the variable "value" to be unsigned 64 bit integer (
http://developer.gnome.org/gstreamermm/0.10/namespaceGst.html#ad14290dfbf163092d7a5c64b1cd76aee).
So this is part of what I tried:

#include <gstreamermm.h>

namespace Dingo {
  class TagReader {
    public:
      TagReader();
      virtual ~TagReader();

      void read(Glib::ustring fileuri);
      unsigned long long getDuration();

      void print();

    private:
      Gst::TagList d_taglist;
  };
}

Dingo::TagReader::read(Glib::ustring fileuri) {
  //get the Gst::TagList of fileuri & store into d_taglist using
Gst::Discoverer
}

unsigned long long Dingo::TagReader::getDuration() {
  Glib::Value<unsigned long long> temp_duration;

  if (d_taglist.get_value(Gst::TAG_DURATION, temp_duration)) {
    return temp_duration.get();
  }

  else {
    return 0;
  }
}

void Dingo::TagReader::print() {
  std::cout << "Duration: " << getDuration() << std::endl;
  //Error: print out 0 & the above error message!
}

However, the getDuration() function ALWAYS returns 0 with the above error
message and I dont understand if the problem lays on the way I use
"unsigned long long" as unsigned 64-bit integer value. I tried to change it
to "guint64" but the problem stays the same.

Therefore, I wonder if anybody here can spot the problem in my code. I cant
get the reason why Gst::TagList would not read Gst::TAG_DURATION of my
media file.

Here is the complete source code of the program if anybody wants:
http://www.mediafire.com/?aq3yiq3n291g7rw. Just download, unzip and run
"make" to compile.

Thank you for reading my message! Have a good day guys!

-- 
Phong V. Cao
[email protected]
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to