[Libav-user] Decoding mp3 bitstream from memory

Igor R boost.lists at gmail.com
Mon Apr 4 18:30:20 CEST 2011


Hello,

I try to accomplish the subj.
For this purpose I implemented "memory" protocol, similar to what I found here:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-May/028489.html

To test it, I just load a small playable mp3 to a memory and then "open" it:
I use it like this:
        AVFormatContext *ic;
        int err = av_open_input_file(&ic, myUrl, NULL, 0, NULL);


As a result, mem_open() is called, and then mem_read() is called
multiple times - until my buffer is empty.
Then mem_read is called again several times (each time with larger
buffer), and finally it gives up, and calls mem_close.
The bottom line: av_open_input_file returns -22 (invalid data).

According to these symptoms, what's wrong with the above approach?

Thanks.


P.S. if I try to "parse" this mp3 on my own, by searching "FFF" marks,
and submitting the data directly to avcodec_decode_audio3(), it's
decoded well, more or less.


More information about the Libav-user mailing list