[FFmpeg-devel] [PATCH][RFC] ffmpeg: remove access to private FILE struct members on Windows

Michael Niedermayer michael at niedermayer.cc
Mon Aug 3 21:20:26 CEST 2015


On Mon, Aug 03, 2015 at 07:26:30PM +0200, Michael Niedermayer wrote:
> On Mon, Aug 03, 2015 at 05:21:58PM +0200, Nicolas George wrote:
> > Le sextidi 16 thermidor, an CCXXIII, Hendrik Leppkes a écrit :
> > > The FILE struct is opaque in MSVC 2015, and the members of this struct
> > > were never meant to be accessed in any case.
> > > 
> > > No conditions are known where this check was needed to get characters
> > > from stdin.
> > > ---
> > > 
> > > If someone does know which particular purpose this check serves, please
> > > do let me know, and I'll be more than willing to find a solution which
> > > does not involve accessing private/undocumented APIs.
> > 
> > The offending commit is this one:
> > 
> > http://git.videolan.org/?p=ffmpeg.git;a=commit;h=ca4d71b149ebe32aeaf617ffccf362624b9aafb1
> > 
> > It says "Based on code by Rolf Siegrist".
> > 
> > My guess is: the test serves if other parts of the program already did read
> > from stdin using the stdio API: peek in the sdtdio buffer before reading
> > from the actual file descriptor.
> > 
> > Since in FFmpeg nothing else reads from stdin, this should not be needed.
> > 
> > Knowing where Rolf Siegrist's code was taken from exactly would help to make
> > sure.
> 
> i looked in my inbox and i found the patch but not the corresponding
> prior communication that it seems to refer to ...
> 
> This seems to have been related to some usecase like this:
> 
> echo  'Call 5 reinit fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:text=HalloWold:fontcolor=white' |./ffmpeg -vf drawtext='fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:text=TEst:fontcolor=white' -i matrixbench_mpeg2.mpg -y out2999.avi
> 
> does this help ?

i also found this comment in a patch in my inbox:

+  /* When using Standard C input functions, also check if there
+   is anything in the buffer. After a call to such functions,
+   the input waiting in the pipe will be copied to the buffer,
+   and the call to PeekNamedPipe can indicate no input available.
+   Setting stdin to unbuffered was not enough, IIRC */
+  if (stdin->_cnt > 0)
+  {
+    char ch;
+    //Read it
+    read(0, &ch, 1);
+    return ch;
+  }

This seems to explain what the code was intended to do

[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150803/c357d27d/attachment.sig>


More information about the ffmpeg-devel mailing list