#257 OPAL - MPEG4 plugin fix for MacOS X and other non-GCC compli

Bug Fix
closed-invalid
OPAL (138)
5
2007-10-23
2007-09-05
RM Fleming
No

Hi all,

I have not make a patch file since it so simple.

File: opal/plugins/video/MPEG4-ffmpeg/mpeg4.cxx:

- Fix for support for Mac OS X PPC (non-intel support) and other non GCC compilers,

I added around WITH_ALIGNED_STACK.

Note: I have not tested the resulting plugin for byte swapping issues and/or alignment issue yet.

ie.

#if #defined(__GNUC__) && defined(__i386__)
...
and#endif
#ifndef WITH_ALIGNED_STACK
#define WITH_ALIGNED_STACK(what) what
#endif

File: mpeg4.cxx

/*
* Some combination of gcc 3.3.5, glibc 2.3.5 and PWLib 1.11.3 is throwing
* off stack alignment for ffmpeg when it is dynamically loaded by PWLib.
* Wrapping all ffmpeg calls in this macro should ensure the stack is aligned
* when it reaches ffmpeg. ffmpeg still needs to be compiled with a more
* recent gcc (we used 4.1.1) to ensure it preserves stack boundaries
* internally.
*
* This macro comes from FFTW 3.1.2, kernel/ifft.h. See:
* http://www.fftw.org/fftw3_doc/Stack-alignment-on-x86.html
* Used with permission.
*/
#if defined(__GNUC__) && defined(__i386__)
#define WITH_ALIGNED_STACK(what) \ { \ /* \ * Use alloca to allocate some memory on the stack. \ * This alerts gcc that something funny is going \ * on, so that it does not omit the frame pointer \ * etc. \ */ \ (void)__builtin_alloca(16); \ \ /* \ * Now align the stack pointer \ */ \ __asm__ __volatile__ ("andl $-16, %esp"); \ \ what \ }
#endif
#ifndef WITH_ALIGNED_STACK
#define WITH_ALIGNED_STACK(what) what
#endif

Discussion

    • assigned_to: nobody --> csoutheren
    • status: open --> pending-postponed
     
  • Logged In: YES
    user_id=774109
    Originator: NO

    I can see that this defines an interesting macro, but what uses it?

     
  • RM Fleming
    RM Fleming
    2007-09-05

    Logged In: YES
    user_id=221346
    Originator: YES

    It is used for by MPEG4 plugin and the define does some stack pointer alignment. My patch just disable the macro on PPC computers and non-intel compilers. Since it using intel assemble.

    Don't know if it is still needed with later compilers on intel or not.

    only detail about it are:

    * This macro comes from FFTW 3.1.2, kernel/ifft.h. See:
    * http://www.fftw.org/fftw3_doc/Stack-alignment-on-x86.html
    * Used with permission.

     
  • RM Fleming
    RM Fleming
    2007-09-05

    • status: pending-postponed --> open-postponed
     
    • status: open-postponed --> closed-invalid
     
  • Logged In: YES
    user_id=774817
    Originator: NO

    I think this has been overtaken by other patches. Can you please check the current code base for if the problem stille exists for you.