Giter VIP home page Giter VIP logo

c99-to-c89's Introduction

Libav

Build Status

Libav is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libavresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • avconv is a command line toolbox to manipulate, convert and stream multimedia content.
  • avplay is a minimalistic multimedia player.
  • avprobe is a simple analisys tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Conding examples are available in the doc/example directory.

License

Libav codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

c99-to-c89's People

Contributors

dwbuiten avatar lieff avatar lu-zero avatar mstorsjo avatar nevcairiel avatar rbultje avatar theryuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c99-to-c89's Issues

Nested loops are mangled

void test()
{
    for(int j=0; j < 10; j++) {
        for(int i=0; i < 20; i++) {
        }
    }
}

is converted to

void test()
{
    { int j=0; for( ; i < 20; i++) {
        }
    } }
}

Mangled else if construct when converting inline structs

Converting following code causes the converter to mangle the else if, producing "elseif" (one word) in the output, obviously breaking compilation:

typedef struct AVRational{
    int num; ///< numerator
    int den; ///< denominator
} AVRational;

int av_rescale_q(int a, AVRational bq, AVRational cq);

int main()
{
    AVRational framerate = {1,25};
    if (1) {
        int next_dts = av_rescale_q(1,  (AVRational){1, 1000000}, framerate);
    } else if (2) {
        // nada!
    }
    return 0;
}

The issue does not seem to appear if the inline struct is the third function parameter, in this case anyway.

fails to handle __declspec(dllimport) properly

When trying to compile ffmpeg with --enable-shared, the conversion fails.

This can be traced to this define
define av_export __declspec(dllimport)

And for example in libavformat/asfenc.c

It fails due to this line getting included from riff.h
extern av_export const AVCodecTag ff_codec_bmp_tags[];

Which creates in the converted c89 file for asfenc.c
extern __declspec(dllimport) const AVCodecTag ff_codec_bmp_tags[];

causing this line to have a compile error (in asfenc.c)
static const AVCodecTag * const tmp__1[] = {
codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
};

--> error C2099: Initializer is not a constant

Maybe this isn't fixable though? Not sure

Preprocessor directives can be corrupted by newly generated scopes

Figure braces are inserted without regard of the preprocessor directives.
Example:

void main()
{
int a;
a = 0;
int b;

line 1 "D:\qwe.c"

}

is converted to:

void main()
{
int a;
a = 0;
{ int b;

line 1 "D:\qwe.c" }

}

Th closing "}" brace breaks the #line directive.

conceals failures from cl

Would be nice if it output to the screen failures from its sub process (ex: cl).
at least it didn't for me just now, FWIW (msys).

$ c99wrap cl ...   -c -o libavdevice/alldevices.o libavdevice/alldevices.c

rdp@roger-win10 MSYS /c/dev/ffmpeg/ffmpeg_git_msvc
$ echo $?
1

rdp@roger-win10 MSYS /c/dev/ffmpeg/ffmpeg_git_msvc
$ cl...   -c -o libavdevice/alldevices.o libavdevice/alldevices.c
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
alldevices.c
c:\dev\ffmpeg\ffmpeg_git_msvc\libavutil\common.h(34) : fatal error C1083: Cannot open include file: 'inttypes.h': No such file or directory

(the latter said what the error was)

For loops with variable declaration messes up token input/output positions

This input gets converted incorrectly
int main () { for( int i = 0; i < 9; i++ ); return 0; }
into this:
int main () { { int i = 0; for( ; i < 9; i++ ); }return0; }

The token input/output positions need to be updated correctly.. somewhere.., so we produce enough whitespace between "return0;". I added a test case for it in a branch in my repo as well: mstorsjo@for-loop-test

This exact piece of code is used in x264's configure script for testing for the C99 features.

The wrapper identifies the output file as the input source file

Hello,
this project is incredibly interesting for homebrew development for the Nokia N-Gage, as we are currently tied to a very early version of GCC. However, the wrapper does not seem to work as long as an output file is specified via CMake:

... -DRENDERER_SOFTWARE -w -O3 -o CMakeFiles\game.dir\src\wipeout\camera.c.obj -c C:\Development\Projects\ngage-toolchain\projects\wipeout\src\wipeout\camera.c

This throws the following error message:
CMakeFiles\game.dir\src\wipeout\camera.c.obj_preprocessed.c: No such file or directory

I can reproduce the problem on the command line. If I write the entire command there without the source file in quotes, the wrapper works perfectly. Unfortunately, I have not yet been able to get CMake to adjust the generated prompt accordingly.

Is this project still supported? Do you have a tip how I can fix the problem to use the wrapper together with a quite old version of GCC?

Best regards,
Michael

#define causes c99conv to crash

Hi
I've build c99conv and test it on unit.c test file.
When I commented out all #defines in unit.c it works fine.
But when converter faced with #defines, it crashes.
Also, I've found precompiled binaries in download section.
It crashes too.

Can you give me any advice?

Support for variable length arrays

str1 = whatever;
if (strlen(str1) == 0) return whatever;
char str2[strlen(str1)+ 1];
strcpy(str2, str1);
whatever

becomes something like

str1 = whatever;
if (strlen(str1) == 0) return whatever;
{ char str2[strlen(str1)+ 1];
strcpy(str2, str1);
whatever
}

It could be done near-properly by using alloca, i.e. _alloca (for MSVC):

str1 = whatever;
if (strlen(str1) == 0) return whatever;
{ char* str2 = _alloca(strlen(str1) + 1);
strcpy(str2, str1);
whatever
}

In case it was a concious decision not to Support VLA, then this should be mentioned in the readme.
In general it would be helpful if known limits of c99-to-c89 were documented, at least roughly.

That said, it is still a more than helpful tool. Thanks for creating it!

Compilation with dynamic runtime libraries (--extra-cflags="-MD") causes unresolved external

I try to compile ffmpeg with dinamic runtime libraries, but at end of building process I have errors:

LD      ffmpeg_g.exe
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; us
e /NODEFAULTLIB:library
libavutil.a(opt.o) : error LNK2001: unresolved external symbol __imp__avpriv_snp
rintf
libavutil.a(pixdesc.o) : error LNK2001: unresolved external symbol __imp__avpriv
_snprintf
libavutil.a(samplefmt.o) : error LNK2001: unresolved external symbol __imp__avpr
iv_snprintf

...

ffmpeg.o : error LNK2019: unresolved external symbol __imp__avpriv_vsnprintf ref
erenced in function _update_benchmark
libavformat.a(aviobuf.o) : error LNK2001: unresolved external symbol __imp__avpr
iv_vsnprintf
libavformat.a(utils.o) : error LNK2001: unresolved external symbol __imp__avpriv
_vsnprintf
libavformat.a(rtpproto.o) : error LNK2001: unresolved external symbol __imp__avp
riv_vsnprintf
libavformat.a(rtmpproto.o) : error LNK2019: unresolved external symbol __imp__av
priv_strtod referenced in function _rtmp_write_amf_data
libavformat.a(sbgdec.o) : error LNK2001: unresolved external symbol __imp__avpri
v_strtod
libavutil.a(parseutils.o) : error LNK2001: unresolved external symbol __imp__avp
riv_strtod
libavutil.a(eval.o) : error LNK2001: unresolved external symbol __imp__avpriv_st
rtod
ffmpeg_g.exe : fatal error LNK1120: 3 unresolved externals
make: *** [ffmpeg_g.exe] Error 1

I have found out, that the reason of this errors is declarartion of functions of standart library in MSVC. If compilation evoked with optin -MD, all standart functions are declared as imported from DLL.

__declspec(dllimport) int __cdecl _snprintf(   char *_Dest,   size_t _Count,     const char * _Format, ...);

But build system of ffmpeg compiles sources with next command:

c99wrap cl -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-Dstrtod=avpriv_strtod -Dsnprintf=avpriv_snprintf -D_snprintf=avpriv_snprintf \
-Dvsnprintf=avpriv_vsnprintf -DHAVE_AV_CONFIG_H -nologo -D_USE_MATH_DEFINES \
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64   -Oy -Z7 -W4 -wd4244 \
-wd4127 -wd4018 -wd4389 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 -wd4152 \
-wd4324 -we4013 -wd4100 -wd4214 -wd4554 -wd4996 -wd4273 -O2 -MD     -c \
-Fo libavutil/eval.o libavutil/eval.c

I.e all occurences of _snprintf replaced with avpriv_snprintf.

And after preprocessing we have avpriv_snprintf declared as imported from DLL!

regression in c99-to-c89 1.0.2: makedef may generate incorrect def-file

This issue is found during ffmpeg 2.0.1 compilation under windows.
Previously I have compiled ffmpeg with msvc toolset and c99-to-c89 1.0.1 library.
Now I am trying to compile ffmpeg with icl toolset.
ffmpeg calls c99wrap with -noconv option which doesn't work in c99wrap 1.0.1. So I updated c99-to-c89 to 1.0.2. c99wrap works correct now. But there is other issue with makedef.

During ffmpeg compilation makedef is called like this:
makedef libavcodec/libavcodec.ver file1.o ... fileN.o > somefile.def

It works on default libavcodec.ver file. But I need one more function exported from the avcodec.dll. So my libavcodec.ver file contains one more line in global section:
ff_find_hwaccel;

The issue that output def-file doesn't contain this function "ff_find_hwaccel".

I have replaced makedef by 1.0.1 (perl version) and now it works: output def-file contains my function (ff_find_hwaccel).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.