[Ffmpeg-devel] [PATCH] Cygwin vhook, always static avformat

Víctor Paesa wzrlpy
Tue Aug 22 12:38:18 CEST 2006


Hi,
>>> On Mon, Aug 07, 2006 at 04:37:10PM +0200, V?ctor Paesa wrote:
>>>>
>>>> > But it has the downsize of creating huge vhooks.  This is not
>>>> > acceptable.  I'm confident that this is just a matter of finding the
>>>> > right linker incantation ...
>>>>
>>>> Using (a) there would be huge vhooks only for static builds.
>>>> The linker docs mentions undefined sysmbols as one limitation of Win32
>>>> loader, I have not been able to find the proper linker spell ...
>>>>
>>>> I tried other ways to circumvent this.
>>>>
>>>> e) Extract symbol list from .EXE to create a .def, that will be used
>>>> to
>>>> create an import library
>>>> (see section "Building and Using DLLs" in Cygwin's User Guide)
>>>>
>>>> [...]
>>>>
>>>> Let's run it:
>>>> $ ../ffmpeg -i ~/SmallConcert.avi -vhook './null.dll' output.avi
>>>> FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
>>>>   configuration:  --enable-static --disable-shared
>>>>   libavutil version: 49.0.0
>>>>   libavcodec version: 51.11.0
>>>>   libavformat version: 50.5.0
>>>>   built on Aug  7 2006 12:55:21, gcc: 3.4.4 (cygming special)
>>>> (gdc 0.12, using dmd 0.125)
>>>> Input #0, avi, from '/home/wzrlpy/SmallConcert.avi':
>>>>   Duration: 00:00:20.2, start: 0.000000, bitrate: 30349 kb/s
>>>>   Stream #0.0: Video: dvvideo, yuv420p, 720x576, 25.00 fps(r)
>>>>   Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
>>>> Permission denied
>>>> Failed to add video hook function: ./null.dll
>>>>
>>>> No idea why I got that "Permission denied", ffmpeg_g.exe shows
>>>> appropiate
>>>> permissions:
>>>>
>>>> $ ls -l ffmpeg_g*
>>>> -rw-r--r-- 1 wzrlpy Users   536888 Aug  7 15:38 ffmpeg_g.a
>>>> -rw-r--r-- 1 wzrlpy Users    11888 Aug  7 15:38 ffmpeg_g.def
>>>> -rwxr-xr-x 1 wzrlpy Users 10016527 Aug  7 15:28 ffmpeg_g.exe
>>>>
>>>> So way (e) does not work.
>>>
>>> Hmmm, I'm sure you just haven't found the reason for the problem here.
>>> I believe you should try to investigate further.
>>>
>> Further reading on Win32 DLLs make me believe this "Permission denied"
>> message could be related to this flag in Win32 function LoadLibraryEx:
>>
>> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibraryex.asp)
>>
>> "LOAD_IGNORE_CODE_AUTHZ_LEVEL
>> 0x00000010 	If this value is used, the system does not perform
>> automatic trust comparisons on the DLL or its dependents when they are
>> loaded.
>> Windows 2000/NT and Windows Me/98/95:  This value is not supported."
>>
>> Probably, the code generated by linker is not setting that flag, or is
>> using function LoadLibrary, that doesn't have that flag.
>> My previous tests were on WinXP with SP2, and trust comparations are
>> probably on.
>> I don't know how to disable them, I'll try to resurrect a Win98 computer
>> I
>> own, install Cygwin runtime, ffmpeg, and see the message there.
>> (just to check hypothesis)
>>
>
> No way, running under Win98 SE it reports the same "Permission denied"
> message.

I investigated a couple of obscure flags (--just-symbols,
--unresolved-symbols) more, but I had no success.
So I give up, the patch attached disables vhook for static Cygwin builds
(and enables it for shared builds).

For curiosity, since the only benefit of static builds is superior speed
(well, also less buggy chaintools) I run a small benchmark,
and the advantage in my system is a rather scarce 0.2%.

I won't cry too much for avoiding static builds ...

Regards,
V?ctor

P.S. The rather informal test follows (YMMV):

./ffmpeg -benchmark -threads 1 -i ~/src/60.avi -target pal-dvd -y out.vob
FFmpeg version SVN-r6027, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-static --disable-shared --enable-mp3lame
--enable-a52 --enable-pthreads --enable-avisynth --enable-gpl
  libavutil version: 49.0.0
  libavcodec version: 51.11.0
  libavformat version: 50.5.0
  built on Aug 20 2006 02:25:32, gcc: 3.4.4 (cygming special) (gdc 0.12,
using dmd 0.125)
Input #0, avi, from '/home/Inma/src/60.avi':
  Duration: 00:01:00.3, start: 0.000000, bitrate: 2155 kb/s
  Stream #0.0: Video: mpeg4, yuv420p, 720x576, 25.00 fps(r)
  Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
Output #0, dvd, to 'out2.vob':
  Stream #0.0: Video: mpeg2video, yuv420p, 720x576, q=2-31, 6000 kb/s,
25.00 fps(c)
  Stream #0.1: Audio: ac3, 48000 Hz, stereo, 448 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1509 q=2.0 Lsize=   37178kB time=60.1 bitrate=5067.9kbits/s
video:33133kB audio:3286kB global headers:0kB muxing overhead 2.083932%
bench: utime=21.688s

$ ./ffmpeg -benchmark -threads 1 -i ~/src/60.avi -target pal-dvd -y out.vob
FFmpeg version SVN-r6027, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --disable-static --enable-shared --enable-mp3lame
--enable-a52 --enable-pthreads --enable-avisynth --enable-gpl
  libavutil version: 49.0.0
  libavcodec version: 51.11.0
  libavformat version: 50.5.0
  built on Aug 22 2006 10:39:51, gcc: 3.4.4 (cygming special) (gdc 0.12,
using dmd 0.125)
Input #0, avi, from '/home/Inma/src/60.avi':
  Duration: 00:01:00.3, start: 0.000000, bitrate: 2155 kb/s
  Stream #0.0: Video: mpeg4, yuv420p, 720x576, 25.00 fps(r)
  Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
Output #0, dvd, to 'out.vob':
  Stream #0.0: Video: mpeg2video, yuv420p, 720x576, q=2-31, 6000 kb/s,
25.00 fps(c)
  Stream #0.1: Audio: ac3, 48000 Hz, stereo, 448 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1509 q=2.0 Lsize=   37178kB time=60.1 bitrate=5067.9kbits/s
video:33133kB audio:3286kB global headers:0kB muxing overhead 2.083932%
bench: utime=21.750s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg.cygwin.vhook.7.patch
Type: application/octet-stream
Size: 2079 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060822/0fd520c5/attachment.obj>



More information about the ffmpeg-devel mailing list