Gcc4.5.0 compilation of the new FFMPEG version in mingw

Source: Internet
Author: User

After downloading the FFMPEG source code in July, compile it in mingw. FFmpeg warned that the GCC version is too old, resulting in non-alignment of stacks and possible problems. We recommend that you use gcc4.2 or later. So we downloaded the latest stable version gcc4.5.0 for compilation. However, a compilation error occurs: The strcasecmp statement is inaccurate.
Define in the header file (libavutil/avstring. h) # define strcasecmp stricmp
The problem persists.
So I implemented two functions myself.
Static inline char _ hack_charget (char C)
{
If (C> = 'A' & C <= 'Z ')
C + = 'a'-'A ';
Return C;
}

Static inline int hack_strcasecmp (char const * a, char const * B)
{
Char AC, BC;
Int R;
For (;;){
AC = _ hack_charget (* A ++ );
BC = _ hack_charget (* B ++ );
R = (INT) Ac-(INT) BC;
If (r)
Return R;

If (! AC)
Return 0;
}
}

Static inline int hack_strncasecmp (char const * a, char const * B, int N)
{
Char AC, BC;
Int R, I;

For (I = 0; I <n; ++ I ){
AC = _ hack_charget (* A ++ );
BC = _ hack_charget (* B ++ );
R = (INT) Ac-(INT) BC;
If (r)
Return R;

If (! AC)
Return 0;
}
Return 0;
}

# Define strcasecmp hack_strcasecmp
# Define strncasecmp hack_strncasecmp

Include this file in avstring. h and metadata. h. The problem is solved. The test results are correct.

I Google this question. Some foreigners are stuck here and are asking around.

Summary:
Even the published GCC and FFMPEG have such low-level problems. After all, the source code is available and you can solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.