[FFmpeg-devel] ByteIOContext probe + img2 patch
michaelni at gmx.at
Mon Sep 5 19:47:54 CEST 2011
On Sun, Sep 04, 2011 at 11:12:33PM -0700, Justin Foutts wrote:
> I found that if you create a test to read a .png via a custom AVIOContext wrapper around normal read, write, seek, it will fail. This patch will make this test succeed on OSX or Linux.
> The utils.c changes init_input() to use filename information with av_probe_input_format() first, then fall back to av_probe_input_buffer(), because av_probe_input_buffer() alone will fail to identify .png from its filedata. (An alternative is to swap the fallback order)
> The img2.c changes are because the !s->is_pipe logic will always make filesystem calls. I tried changing the NOFILE logic and my .png's appeared! However only .png's under 4096 bytes. In img2.c I tried changing the 4096 constant to the avio_size() of the recently assigned f. This happened to result in the rest of the images loading.
> I must admit I don't know what I'm doing! Some lucky guesses happened to work. I hope that someone who better understands this code will use this patch to increase the testing and support for custom AVIOContext's and img2's relation to same. Thanks!
well the problem with avio_size() there is two fold
1. if its a real pipe theres no size and this will fail one way or
2. if someone feed 5gb of concatenated jpegs this would attempt to
load all of that at once.
to make png work with 4096 you need a png AVParser
some of the other changes might be avoidable if you use image2pipe
instead of img2
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel