Extracing data from samples
Réka Kósa
kosareka at gmail.com
Tue Dec 11 18:01:01 UTC 2018
Sorry, here is the link of the code: https://paste2.org/UpN5xtfO
krrr <kosareka at gmail.com> ezt írta (időpont: 2018. dec. 11., K, 18:57):
> I found this answer:
> http://gstreamer-devel.966125.n4.nabble.com/Convertion-of-GstBuffer-to-PCM-audio-data-td4676543.html
> , and this is very close to my question, however, I'm still wondering if
> the same applies to mp3 files. I have to calculate the Fourier transform of
> the songs, that's the reason for the need of getting the songs/samples as
> an array of numbers. I tried the get_buffer() method, mapped it into a
> MapInfoData object and saved the samples, and this time I got an array with
> length of 383*4608 for my 10 second mp3 file, where 383 is the number of
> samples and 4608 is the size of buffer. A saved each element for sample
> data to an 8-bit unsigned int for the test, but this
> <https://superuser.com/a/1173507> answer says that bit depth may alter
> for each sample in the case of mp3. Here are the relevant parts from my
> code: GstFlowReturn sample_arrived(GstAppSink *appsink, AudioStreamer
> *audio_streamer) { if (!gst_app_sink_is_eos(appsink)) { GstSample *sample =
> gst_app_sink_pull_sample(appsink); //assert(sample);
> audio_streamer->_samples.push(sample); GstBuffer *buffer =
> gst_sample_get_buffer(sample); GstMapInfo info; if (gst_buffer_map(buffer,
> &info, GST_MAP_READ)) { for ( guint i = 0; i < info.size; ++i)
> //g_print("%u\n", info.data[i]);
> audio_streamer->_tmp_samples.push(info.data[i]); //type of _tmp_samples:
> std::queue } gst_buffer_unmap (buffer, &info); gst_sample_unref(sample);
> } return GST_FLOW_OK; } Is this the right way for doing this?
> ------------------------------
> Sent from the GStreamer-devel mailing list archive
> <http://gstreamer-devel.966125.n4.nabble.com/> at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20181211/ed49d8e3/attachment.html>
More information about the gstreamer-devel
mailing list