博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PJSIP 学习进度
阅读量:6349 次
发布时间:2019-06-22

本文共 8624 字,大约阅读时间需要 28 分钟。

hot3.png

Getting Started: Building for Microsoft Windows

    • Preparation

    • Build for Desktop

    • Build for Mobile

      • ...

    • Next: Using the libraries

      •  (2.0 onwards)
  • See Also

This page describes how to use Microsoft Visual Studio to build pjsip libraries:

Note: You can also build for Windows using GNU tools such mingw. Follow the steps in .

Note: For buiding DLLs, please see .

Build Preparation for Windows

  1. , if you haven't already.
  2. It is important that you create a config_site.h as described in 

Requirements

Tools and SDKs

The Visual Studio based project files can be used with one of the following tools:

  • Microsoft Visual Studio 6, (no longer supported since 2.0)
  • Microsoft Visual Studio .NET 2002,
  • Microsoft Visual Studio .NET 2003,
  • Microsoft Visual Studio/C++ 2005 (including Express edition),
  • Microsoft Visual Studio 2008. You may need to fix the . Follow the instructions for Visual Studio 2005.
  • Microsoft Visual Studio 2012. Tested on Professional version, untested on Express version.
  • Note: Microsoft Visual Studio 2010 is currently unsupported.
    • This is because Visual Studio 2010 importer for our VS2005 solution files is broken. Use Visual Studio 2012 instead.
    • Workaround tips:  

In addition, the following SDK's are needed:

  • Essential for other than Windows 8/Visual Studio 2012: DirectX SDK (tested with DirectX version 8 and 9). After installing DirectX, add the paths to the include files and the library to Visual Studio.
  • Optional if not using Visual Studio 2008: Platform SDK (tested with Platform SDK for Windows Server 2003 SP1).
  • Optional: OpenSSL development kit is needed if TLS support is wanted. Learn more: .

Note: The new Platform SDK is still needed for Visual Studio 6, although VS6 comes with its own Platform SDK. The new Platform SDK is needed for Iphlpapi.[h|lib] for the new PJNATH library.

Video support (2.0 and above only)

Additional requirements

  1. DirectShow SDK, included in Windows SDK. The minimum component required within the SDK is Windows Development Headers and Libraris and Samples. As there are several versions of SDK we found they have different issues:
    1. If you don't need Windows 7 features, the recommended SDK is . This is because it doesn't have .
    2. If you need Windows 7 features then use  and follow the instructions on . Also if you are using Visual Studio 2005 then you will need to patch it using 
  2.  version 2.0 or version 1.3
    • Note that this is the newer and not yet released SDL library, hence most likely it won't be installed by default on your system. You can download the SDL 2.0 source snapshot or from the Mercurial repository from .
    • SDL 1.3 is sometimes under SDL sub-directory of SDL 2.0.
    • SDL sources comes with VS project settings, under VisualC sub-directory
  3.  development library. We tested with ffmpeg version ranging from 0.5.1 (from circa 2009) to 0.10.
    • Note that for H.264 support, you need newer releases (October 2011 onwards), and it needs libz too.
    • You may be able to use the binary distributions (such as from  - get the 'dev' builds). It compiles fine, however we haven't tested them thoroughly.
    • Otherwise, get  for building libx264 and ffmpeg, and also its . Note:
      • It is recommended to use gcc 4 or above to build ffmpeg.
      • To avoid problems, put MSYS, libx264, and ffmpeg in folders that do not contain space, e.g: C:\msys, C:\devlib\ffmpeg.
      • To use ffmpeg with VS, inttypes.h and stdint.h will be needed, check .
    • In MSYS, build with at least:
      $ ./configure --enable-shared --disable-static --enable-memalign-hack                      # add other options if needed, e.g: optimization, install dir, search path                       # particularly CFLAGS and LDFLAGS for x264                      # to enable H264, add "--enable-gpl --enable-libx264"$ make && make install
  4. Optional for H.264: . We tested with the latest from git (as of October 2011). In MSYS console:
    $ ./configure --enable-static      # add options if needed, e.g: optimization, install dir, search path$ make && make install-lib-static  # default install dir is /usr/local
  5. Optional:  for building the . We tested with version 4.6 or later.
    • without this you can still enjoy video with pjsua console application

Additional configuration

  1. Add include and library paths for the required components:
    1. DirectShow SDK
    2. SDL
    3. ffmpeg
  2. Add these to your config_site.h:
    #define PJMEDIA_HAS_VIDEO	        1#define PJMEDIA_HAS_FFMPEG	        1#define PJMEDIA_VIDEO_DEV_HAS_SDL       1#define PJMEDIA_VIDEO_DEV_HAS_DSHOW     1

Host requirements

For the host, the following are required:

  • Windows NT, 2000, XP, 2003, Vista, Windows 7, or later ,
  • Windows 95/98 should work too, but this has not been tested,
  • Sufficient amount of RAM for the build process.

Building the Projects

Follow the steps below to build the libraries/application using Visual Studio:

  1. For Visual Studio 6/2002/2003: open pjproject.dsw workspace file. (No longer supported since pjsip 2.0)
  2. For Visual Studio 8 (VS 2005): open pjproject-vs8.sln solution file.
  3. For Visual Studio 9 (VS 2008): open pjproject-vs8.sln solution file. One-time conversion of projects to VS 2008 format will done automatically.
  4. For Visual Studio 11 (VS 2012): open pjproject-vs8.sln solution file. One-time conversion of projects to VS 2012 format will done automatically.
    1. Warnings about Windows Mobile projects/configurations can be safely ignored, VS 2012 does not support Windows Mobile
    2. Additional tips from 
  5. Set pjsua as Active or Startup Project.
  6. Set Win32 as the platform.
    1. Currently we are still encountering issues with 64-bit builds, therefore it is not yet supported.
  7. Select Debug or Release build as appropriate.
  8. Build the project. This will build pjsua application and all libraries needed by pjsua.
  9. After successful build, the pjsua application will be placed in pjsip-apps/bin directory, and the libraries in lib directory under each projects.

To build the samples:

  1. (Still using the same workspace)
  2. Set samples project as Active Project
  3. Select Debug or Release build as appropriate. See  page for explanation of each provided build configuration
  4. Build the project. This will build all sample applications and all libraries needed.
  5. After successful build, the sample applications will be placed in pjsip-apps/bin/samples directory, and the libraries in lib directory under each projects.

Debugging Sample Applications

Sample applications are built using Samples.mak makefile, therefore it is difficult to setup debugging session in Visual Studio for these applications. To solve this issue, the pjsip_apps workspace contain one project called sample_debug which can be used to debug a sample application.

To setup debugging using sample_debug project:

  1. Set sample_debug project as Active Project
  2. Edit debug.c file inside this project.
  3. Modify the #include line to include the particular sample application to debug
  4. Select Debug build.
  5. Build and debug the project.

Next: Using pjproject libraries for your own application

  1. Put these include directories in the include search path of your project:
    • pjlib/include
    • pjlib-util/include
    • pjnath/include
    • pjmedia/include
    • pjsip/include
  2. Put the combined library directory lib (located in the root directory of pjproject source code) in the library search path
  3. Include the relevant PJ header files in the application source file. For example, using these would include ALL APIs exported by PJ:
    #include 
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include
    (Note: the documentation of the relevant libraries should say which header files should be included to get the declaration of the APIs).
  4. Declare PJ_WIN32=1 macro in the project settings (declaring the macro in the source file may not be sufficient).
    • For Windows Mobile applications build with Visual C++, we need to declare PJ_WIN32_WINCE=1 macro in the project settings.
  1. Link with the main pjproject library libpjproject. It includes all the libraries provided. Note: the actual library names will be appended with the target name and the build configuration. For example: The actual library names will look like libpjproject-i386-win32-vc6-debug.lib depending on whether we are building the Debug or Release version of the library.
  1. Link with system specific libraries such as: wsock32.lib, ws2_32.lib, ole32.lib, dsound.lib
  1. If you want to use video API see 

Crash problem on Win32

Please see  for troubleshooting crash problem on Win32.

Windows 98 Support

Please see  to make PJSIP works on Windows 95 and windows 98.

转载于:https://my.oschina.net/BlueLove/blog/159920

你可能感兴趣的文章
20文件
查看>>
Android开发Intent应用概述
查看>>
【Go】并发编程
查看>>
VMware虚拟化NSX-Manager命令行更改admin用户密码
查看>>
悦纳自己
查看>>
python字符串函数
查看>>
ORM框架Hibernate (四)MyEclipse Hibernate Tool 逆向生成实体类
查看>>
去掉iphone连接电脑时会出现的弹出窗口
查看>>
【python】-- web开发之HTML
查看>>
vs2015 去除 git 源代码 绑定
查看>>
解决firefox的button按钮文字不能垂直居中
查看>>
网络协议端口号详解
查看>>
大话数据结构读后感——第一章
查看>>
各种排序
查看>>
ts 格式化日期输出
查看>>
Optional
查看>>
sed 命令编辑文本
查看>>
LRUCache 具体解释
查看>>
Activity调用isDestroyed()方法报出,java.lang.NoSuchMethodError
查看>>
使用AFNetworking第三方下载类
查看>>