[Ffmpeg-devel] [C API] Add suport for ifstreams

Michael Niedermayer michaelni
Mon Sep 4 23:02:00 CEST 2006


Hi

On Mon, Sep 04, 2006 at 09:39:16PM +0200, Jaime wrote:
> Hi,
> i need to open istreams to decode some files.
> im using FFmpeg on WinXP and C++.
> i hope somebody can help me on this.
> 
> By reading the FAQ
> http://ffmpeg.mplayerhq.hu/faq.html#SEC31
> *********************
> 2.12 I have a file in memory / a API different from *open/*read/ libc
> how do i use it with libavformat ?
> 
> You have to implement a URLProtocol, see libavformat/file.c in FFmpeg
> and libmpdemux/demux_lavf.c in MPlayer sources.
> *********************
> 
> the file.c contains URLProtocols for files(using C file handles) and pipes.
> 
> i'd like to add the istream handling(actually thats all i use) but dont
> know exactly how to do it best.
> 
> It seems the only paramter  i can really pass is a char*. which is
> parsed afterwards.
> 
> so theres my problem.
> adding the istream URLProtocol is not the problem but using it!
> 
> if at least i could save the istream handle in the "privateData" variable...
> 
> hoping for help...

lets assume you have a pointer to the istream struct ehm i mean object ...
just convert that to a bunch of chars with sprintf(buf, "%p", ptr_to_istream);
or your favorite object oriented equivalent and then just convert it
back inside your istream URLProtocol with sscanf()

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list