<div dir="ltr"><div><div><div><div>Didn't find it before cause I was looking for libgstreamer1-..<br><br></div>thanks, it works, with this API I can even get fancy stuff like bitrate, which is cool.<br><br></div>For future users learning Gstreamer I wish GstElement's get duration method documentation would mention the discoverer API.<br>
<br></div>Since it's in C to me as a user it slightly sucks having to cast objects back and forth and mix and match different delete functions for each case like<br></div>g_object_unref<br>gst_discoverer_info_unref<br>
gst_discoverer_stream_info_list_free<br><div><div>etc.<br></div><div><div><br></div><div>Anyway, here's my final code which (to me) works correctly, thanks a lot!<br><br></div><div>//SOURCE START<br> for (int i=0; i<vec_size; i++) {<br>
mtl::io::QtFile *file = (*vec)[i];<br> <br> if (file->IsDir()) { // not a sound file<br> delete file;<br> continue;<br> }<br> <br> QString uri = "file://" + file->full_path();<br>
QByteArray arr = uri.toLocal8Bit();<br> const char *c_uri = arr.data();<br> <br> discov_info = gst_discoverer_discover_uri(discov, c_uri, NULL);<br> if (discov_info == NULL) {<br> MTL_WARN("discov_info = NULL");<br>
break;<br> }<br> <br> duration = (int64_t) gst_discoverer_info_get_duration(discov_info);<br> <br> GList *list = gst_discoverer_info_get_stream_list(discov_info);<br> if (list == NULL) {<br>
MTL_WARN("list = NULL");<br> break;<br> }<br> <br> auto *stream_info = (const GstDiscovererStreamInfo*)list->data;<br> if (stream_info == NULL) {<br> MTL_WARN("stream_info = NULL");<br>
break;<br> }<br> <br> auto *audio_info = (const GstDiscovererAudioInfo*)stream_info;<br> uint32_t bitrate = gst_discoverer_audio_info_get_bitrate(audio_info);<br> gst_discoverer_stream_info_list_free(list);<br>
gst_discoverer_info_unref(discov_info);<br> <br> file->duration_set(duration);<br> file->bitrate_set(bitrate);<br> song_tree->AddSong(file);<br> }<br> <br> g_object_unref(discov);<br>
</div><div>// SOURCE END<br></div><div><br></div><div><br><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 20, 2013 at 3:13 PM, Tim-Philipp Müller <span dir="ltr"><<a href="mailto:t.i.m@zen.co.uk" target="_blank">t.i.m@zen.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, 2013-08-20 at 06:27 +0300, Jiergir Ogoerg wrote:<br>
<br>
> Thanks, the GstDiscoverer seems just what I need, after like 20<br>
> minutes of searching the repos, googling etc<br>
><br>
> I can't figure out where it's stored and how to install it, looks like<br>
> Ubuntu doesn't support it.<br>
><br>
> Do you know what's the package (dev) name I have to install?<br>
><br>
><br>
> In particular, I got libgstreamer1-dev installed, there are no other<br>
> "-dev" packages related to gstreamer1.0 in Ubuntu.<br>
<br>
</div>libgstreamer-plugins-base1.0-dev<br>
<div class="im"><br>
> apt-cache search pbutils - yields nothing.<br>
<br>
</div>Something to take up with the packagers, I think.<br>
<div class="HOEnZb"><div class="h5"><br>
Cheers<br>
-Tim<br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br></div>