Media_stream_video example for compiling PPAPI

Source: Internet
Author: User

Media_stream_video example for compiling PPAPI

In Windows, the static library corresponding to the C ++ API of CEF and PPAPI is compiled from the source code compilation file CEF. Now we will compile the media_stream_video example.

Use VS 2013 for compiling.

VS Project Creation

Create a Win32 project named media_stream_video, select the DLL type, and remove the pre-compiled header file stdafx. h and stdafx. cpp, and in the project properties-> Configure properties-> C/C ++-> pre-compilation header, set the value of the pre-compilation header option to not use the pre-compilation header.

Delete automatically generated media_stream_video.cpp.

In "configuration properties-> C/C ++-> code generation-> Runtime Library", set it to MT.

The character set uses the Unicode Character Set.

Add the following directories:

E: \ sources \ CEF \ 2526 \ chromium \ src \ cef \ binary_distrib \ cef_binary_3.2526.1364.gf6bf57b_windows32 // For CEFE: \ sources \ CEF \ 2526 \ chromium \ src \ third_party \ khronos // For GLESE: \ sources \ CEF \ 2526 \ chromium \ src // For ppapiE: \ sources \ CEF \ 2526 \ chromium \ src \ gpu // This is for gl2chromium. h

Copy chromium \ src \ ppapi \ examples \ media_stream_video \ media_stream_video.cc to the project directory and add it to the project.

Add the following path to the additional Library:

E: \ sources \ CEF \ 2526 \ chromium \ src \ cef \ binary_distrib \ cef_binary_3.2526.1364.gf6bf57b_windows32 \ Release // copy all lib here, saving you trouble.

Add dependency libraries such as ppapi_cpp.lib, ppapi_cpp_objects.lib, libGLESv2.dll. lib, and ppapi_gles2.lib.

This is basically the case.

Compile and run

If you compile the project, you will encounter a link error similar to the following:

Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2EnableVertexAttribArray @ 4
Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2UseProgram @ 4
Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2VertexAttribPointer @ 24
Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2ClearColor @ 16
Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2GetAttribLocation @ 8
Media_stream_video.obj: error LNK2001: external symbol that cannot be parsed _ GLES2ActiveTexture @ 4

This is because media_stream_video needs to be linked to ppapi_gles2.lib, and this library is not generated during CEF compilation. We need to compile it manually.

Compile ppapi_gles2

The ppapi_gles2.lib file is not generated when CEF is compiled by default. Fortunately, the ppapi_gles2.ninja file is generated under the chromium \ src \ out \ Release \ obj \ ppapi directory, which is the Build File of ppapi_gles2.lib. At the same time, the build File chromium \ src \ out \ Release \ build of the Release version. the build command and subninja command of ppapi_gles2 are also added at the beginning of ninja, but ppapi_gles2 is not added to the build all target. Therefore, everything is ready for us. Execute the "ninja ppapi_gles2" command in the chromium \ src \ out \ Release directory to compile ppapi_gles2.lib.

This is also a way to manually compile some modules.

Run

Run the following command:

cefsimple.exe --ppapi-out-of-process --register-pepper-plugins="E:\sources\CEF\2526\chromium\src\cef\binary_distrib\cef_binary_3.2526.1364.gf6bf57b_windows32\Release\media_stream_video.dll;application/x-ppapi-example-media-stream-video" --url=file:///E:/sources/CEF/2526/chromium/src/cef/binary_distrib/cef_binary_3.2526.1364.gf6bf57b_windows32/Release/media_stream_video.html

The effect is as follows:

Does it stop here?

Continuing study...

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.