AVbin memory/custom loader playback support

8 views
Skip to first unread message

Enerccio

unread,
Dec 14, 2011, 12:19:53 PM12/14/11
to avbin
Is there any plans for that? Because it looks like the default
avcodecs can play from memory/custom io.

Nathan

unread,
Dec 14, 2011, 1:43:40 PM12/14/11
to av...@googlegroups.com
On Wed, Dec 14, 2011 at 10:19 AM, Enerccio <ener...@gmail.com> wrote:
> Is there any plans for that? Because it looks like the default
> avcodecs can play from memory/custom io.

Never thought about it. So that would include things like streaming
from a URL, right?

I think that concept is referred to as "protocols" under FFmpeg/Libav.
Currently AVbin disables all protocols, and then enables the file
protocol.

~ Nathan

Peter Enerccio

unread,
Dec 14, 2011, 2:01:34 PM12/14/11
to av...@googlegroups.com
I was more thinking about custom io loader. Something that would be passed to avbin and avbin would use it load the data from the source instead of the normal file. And yes, it would be very useful for streaming and/or playing from zip/blob or directly from memory.

2011/12/14 Nathan <nathan...@gmail.com>

Nathan

unread,
Dec 14, 2011, 2:05:49 PM12/14/11
to av...@googlegroups.com
On Wed, Dec 14, 2011 at 12:01 PM, Peter Enerccio <ener...@gmail.com> wrote:
> I was more thinking about custom io loader. Something that would be passed
> to avbin and avbin would use it load the data from the source instead of the
> normal file. And yes, it would be very useful for streaming and/or playing
> from zip/blob or directly from memory.

I have no plans for that, but I think I will add an "Interesting ideas
to consider" list to the web site to store ideas like this.

If you decide to implement it yourself, I would be interested to see
how it turns out.

~ Nathan

anatoly techtonik

unread,
Dec 14, 2011, 3:24:11 PM12/14/11
to av...@googlegroups.com
 avbin_open_stream() takes Opaque open file handle. Can this opaque file handle refer to memory object or zip/blob wrapper?

Nathan

unread,
Dec 14, 2011, 4:28:57 PM12/14/11
to av...@googlegroups.com
On Wed, Dec 14, 2011 at 1:24 PM, anatoly techtonik <tech...@gmail.com> wrote:
>  avbin_open_stream() takes Opaque open file handle. Can this opaque file
> handle refer to memory object or zip/blob wrapper?

I don't know.

~ Nathan

Jan Bölsche

unread,
Dec 14, 2011, 7:24:48 PM12/14/11
to av...@googlegroups.com
On 14.12.2011, at 20:01, Peter Enerccio wrote:

> I was more thinking about custom io loader. Something that would be passed to avbin and avbin would use it load the data from the source instead of the normal file. And yes, it would be very useful for streaming and/or playing from zip/blob or directly from memory.


Hi Peter,

I did that once using ffmpeg directly. Just to point you in the right direction:
You first create an implementation of URProtocol (grep for it in the ffmpeg sources), providing pointers to a set of functions you implement for opening, closing, reading etc. in/from your custom data source:

extern "C" URLProtocol myProtocol = {
"myScheme", // name of the custom protocol as used in URLs
g4s_open,
g4s_read,
g4s_write,
g4s_seek,
g4s_close,
};

then you register your protocol with ffmpeg like this:

av_register_all();
register_protocol(&myProtocol);

If you now call

av_open_input_file(&_pFormatCtx, "myScheme:something", NULL, 0, NULL)!=0);

your functions (in this case "g4s_open", "g4s_read" etc.) will be called by ffmpeg as needed. In this example, you would get the string "something" as a filename. In my implementation of a generic datasource, I used the filename to get the address of a data source object (zip file reader, memory buffer, whatever) into the callback functions by using urls like "myProtocol:0fea1234" (not 64bit safe:)

Good luck, I too would like to see that feature in avbin!
Jan

Reply all
Reply to author
Forward
0 new messages