⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 general.texi

📁 mediastreamer2是开源的网络传输媒体流的库
💻 TEXI
📖 第 1 页 / 共 3 页
字号:
@code{X} means that encoding (resp. decoding) is supported.@code{I} means that an integer-only version is available, too (ensures highperformance on systems without hardware floating point support).@chapter Platform Specific information@section BSDBSD make will not build FFmpeg, you need to install and use GNU Make(@file{gmake}).@section WindowsTo get help and instructions for building FFmpeg under Windows, check outthe FFmpeg Windows Help Forum at@url{http://arrozcru.no-ip.org/ffmpeg/}.@subsection Native Windows compilationFFmpeg can be built to run natively on Windows using the MinGW tools. Installthe current versions of MSYS and MinGW from @url{http://www.mingw.org/}. Alsoinstall the coreutils package. You can find detailed installationinstructions in the download section and the FAQ.Within the MSYS shell, configure and make with:@example./configure --enable-memalign-hackmakemake install@end exampleThis will install @file{ffmpeg.exe} along with many other development filesto @file{/usr/local}. You may specify another install path using the@code{--prefix} option in @file{configure}.Notes:@itemize@item Use at least bash 3.1. Older versions are known to fail on theconfigure script.@item In order to compile vhooks, you must have a POSIX-compliant libdl inyour MinGW system. Get dlfcn-win32 from@url{http://code.google.com/p/dlfcn-win32}.@item In order to compile FFplay, you must have the MinGW development libraryof SDL. Get it from @url{http://www.libsdl.org}.Edit the @file{bin/sdl-config} script so that it points to the correct prefixwhere SDL was installed. Verify that @file{sdl-config} can be launched fromthe MSYS command line.@item The target @code{make wininstaller} can be used to create aNullsoft-based Windows installer for FFmpeg and FFplay. @file{SDL.dll}must be copied to the FFmpeg directory in order to build theinstaller.@item By using @code{./configure --enable-shared} when configuring FFmpeg,you can build libavutil, libavcodec and libavformat as DLLs.@end itemize@subsection Microsoft Visual C++ compatibilityAs stated in the FAQ, FFmpeg will not compile under MSVC++. However, if youwant to use the libav* libraries in your own applications, you can stillcompile those applications using MSVC++. But the libav* libraries you linkto @emph{must} be built with MinGW. However, you will not be able to debuginside the libav* libraries, since MSVC++ does not recognize the debugsymbols generated by GCC.We strongly recommend you to move over from MSVC++ to MinGW tools.This description of how to use the FFmpeg libraries with MSVC++ is based onMicrosoft Visual C++ 2005 Express Edition. If you have a different version,you might have to modify the procedures slightly.@subsubsection Using static librariesAssuming you have just built and installed FFmpeg in @file{/usr/local}.@enumerate@item Create a new console application ("File / New / Project") and thenselect "Win32 Console Application". On the appropriate page of theApplication Wizard, uncheck the "Precompiled headers" option.@item Write the source code for your application, or, for testing, justcopy the code from an existing sample application into the source filethat MSVC++ has already created for you. For example, you can copy@file{output_example.c} from the FFmpeg distribution.@item Open the "Project / Properties" dialog box. In the "Configuration"combo box, select "All Configurations" so that the changes you make willaffect both debug and release builds. In the tree view on the left handside, select "C/C++ / General", then edit the "Additional IncludeDirectories" setting to contain the path where the FFmpeg includes wereinstalled (i.e. @file{c:\msys\1.0\local\include}).@item Still in the "Project / Properties" dialog box, select"Linker / General" from the tree view and edit the"Additional Library Directories" setting to contain the @file{lib}directory where FFmpeg was installed (i.e. @file{c:\msys\1.0\local\lib}),the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}),and the directory where MinGW's GCC libs are installed(i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select"Linker / Input" from the tree view, and add the files @file{libavformat.a},@file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a},@file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a})to the end of "Additional Dependencies".@item Now, select "C/C++ / Code Generation" from the tree view. Select"Debug" in the "Configuration" combo box. Make sure that "RuntimeLibrary" is set to "Multi-threaded Debug DLL". Then, select "Release" inthe "Configuration" combo box and make sure that "Runtime Library" isset to "Multi-threaded DLL".@item Click "OK" to close the "Project / Properties" dialog box.@item MSVC++ lacks some C99 header files that are fundamental for FFmpeg.Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list}and install it in MSVC++'s include directory(i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}).@item MSVC++ also does not understand the @code{inline} keyword used byFFmpeg, so you must add this line before @code{#include}ing libav*:@example#define inline _inline@end example@item If you used @file{output_example.c} as your sample application,you will have to edit the @code{#include}s to point to the files whichare under the @file{ffmpeg} directory (i.e. @code{<ffmpeg/avformat.h>}).@item Build your application, everything should work.@end enumerate@subsubsection Using shared librariesThis is how to create DLL and LIB files that are compatible with MSVC++:@enumerate@item Add a call to @file{vcvars32.bat} (which sets up the environmentvariables for the Visual C++ tools) as the first line of @file{msys.bat}.The standard location for @file{vcvars32.bat} is@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat},and the standard location for @file{msys.bat} is @file{C:\msys\1.0\msys.bat}.If this corresponds to your setup, add the following line as the first lineof @file{msys.bat}:@examplecall "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"@end exampleAlternatively, you may start the @file{Visual Studio 2005 Command Prompt},and run @file{c:\msys\1.0\msys.bat} from there.@item Within the MSYS shell, run @code{lib.exe}. If you get a help messagefrom @file{Microsoft (R) Library Manager}, this means your environmentvariables are set up correctly, the @file{Microsoft (R) Library Manager}is on the path and will be used by FFmpeg to createMSVC++-compatible import libraries.@item Build FFmpeg with@example./configure --enable-shared --enable-memalign-hackmakemake install@end exampleYour install path (@file{/usr/local/} by default) should now have thenecessary DLL and LIB files under the @file{bin} directory.@end enumerateTo use those files with MSVC++, do the same as you would do withthe static libraries, as described above. But in Step 4,you should only need to add the directory where the LIB files are installed(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files areinstalled in the @file{bin} directory. And instead of adding @file{libxx.a}files, you should add @file{avcodec.lib}, @file{avformat.lib}, and@file{avutil.lib}. There should be no need for @file{libmingwex.a},@file{libgcc.a}, and @file{wsock32.lib}, nor any other external librarystatically linked into the DLLs. The @file{bin} directory contains a bunchof DLL files, but the ones that are actually used to run your applicationare the ones with a major version number in their filenames(i.e. @file{avcodec-51.dll}).@subsection Cross compilation for Windows with LinuxYou must use the MinGW cross compilation tools available at@url{http://www.mingw.org/}.Then configure FFmpeg with the following options:@example./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-@end example(you can change the cross-prefix according to the prefix chosen for theMinGW tools).Then you can easily test FFmpeg with Wine(@url{http://www.winehq.com/}).@subsection Compilation under CygwinThe main issue with Cygwin is that newlib, its C library, does notcontain llrint().  However, it is possible to leverage theimplementation in MinGW.Just install your Cygwin with all the "Base" packages, plus thefollowing "Devel" ones:@examplebinutils, gcc-core, make, subversion, mingw-runtime@end exampleDo not install binutils-20060709-1 (they are buggy on shared builds);use binutils-20050610-1 instead.Then create a small library that just contains llrint():@examplear x /usr/lib/mingw/libmingwex.a llrint.oar cq /usr/local/lib/libllrint.a llrint.o@end exampleThen run@example./configure --enable-static --disable-shared  --extra-ldflags='-L /usr/local/lib' --extra-libs='-l llrint'@end exampleto make a static build or@example./configure --enable-shared --disable-static  --extra-ldflags='-L /usr/local/lib' --extra-libs='-l llrint'@end exampleto build shared libraries.If you want to build FFmpeg with additional libraries, download Cygwin"Devel" packages for Ogg and Vorbis from any Cygwin packages repositoryand/or SDL, xvid, faac, faad2 packages from Cygwin Ports,(@url{http://cygwinports.dotsrc.org/}).@subsection Crosscompilation for Windows under CygwinWith Cygwin you can create Windows binaries that do not need the cygwin1.dll.Just install your Cygwin as explained before, plus these additional"Devel" packages:@examplegcc-mingw-core, mingw-runtime, mingw-zlib@end exampleand add some special flags to your configure invocation.For a static build run@example./configure --target-os=mingw32 --enable-memalign-hack --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin@end exampleand for a build with shared libraries@example./configure --target-os=mingw32 --enable-memalign-hack --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin@end example@section BeOSBeOS support is broken in mysterious ways.@section OS/2For information about compiling FFmpeg on OS/2 see@url{http://www.edm2.com/index.php/FFmpeg}.@chapter Developers Guide@section API@itemize @bullet@item libavcodec is the library containing the codecs (both encoding anddecoding). Look at @file{libavcodec/apiexample.c} to see how to use it.@item libavformat is the library containing the file format handling (mux anddemux code for several formats). Look at @file{ffplay.c} to use it in aplayer. See @file{output_example.c} to use it to generate audio or videostreams.@end itemize@section Integrating libavcodec or libavformat in your programYou can integrate all the source code of the libraries to link themstatically to avoid any version problem. All you need is to provide a'config.mak' and a 'config.h' in the parent directory. See the definesgenerated by ./configure to understand what is needed.You can use libavcodec or libavformat in your commercial program, but@emph{any patch you make must be published}. The best way to proceed isto send your patches to the FFmpeg mailing list.@node Coding Rules@section Coding RulesFFmpeg is programmed in the ISO C90 language with a few additionalfeatures from ISO C99, namely:@itemize @bullet@itemthe @samp{inline} keyword;@item@samp{//} comments;@itemdesignated struct initializers (@samp{struct s x = @{ .i = 17 @};})@itemcompound literals (@samp{x = (struct s) @{ 17, 23 @};})@end itemizeThese features are supported by all compilers we care about, so we will notaccept patches to remove their use unless they absolutely do not impairclarity and performance.All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg alsocompiles with several other compilers, such as the Compaq ccc compileror Sun Studio 9, and we would like to keep it that way unless it wouldbe exceedingly involved. To ensure compatibility, please do not use anyadditional C99 features or GCC extensions. Especially watch out for:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -