PPAPI开发之路(二)在VS 2013上编译media_stream_video例子
来源:互联网 发布:xfplay mac版怎么下载 编辑:程序博客网 时间:2024/06/06 17:44
本例子工程代码下载地址:http://download.csdn.net/detail/y601500359/9862413
一、源码路径
例子源码在你nacl_sdk安装目录下,比如我的是:E:\SDK\nacl_sdk\pepper_49\examples\api\media_stream_video
二、新建vs项目
1、新建一个名为media_stream_video的Win32项目,类型选DLL;
2、去掉预编译头文件stdafx.h和stdafx.cpp,去掉dllmain.cpp文件;
3、在项目属性–>配置属性–>C/C++–>预编译头,把预编译头选项的值设置为不使用预编译头。
4、删除自动生成的media_stream_video.cpp。
5、在“配置属性–>C/C++–>代码生成–>运行库”中设置为MT6、将例子下的media_stream_video.cc,复制到刚刚创建的工程目录;
7、添加media_stream_video.cc到工程
8、设置包含的nacl_sdk头文件目录;
9、将nacl_sdk安装目录下的lib文件copy到我们的工程:我是在工程目录建了一个lib文件夹
我的目录是:E:\SDK\nacl_sdk\pepper_49\lib\win_x86_32_host,注意debug文件夹下的对应我们的debug工程,release对应release,
将lib添加进工程
设置lib路径
10、编译:平台选择x86 或者 PPAPI都行
三、本地调试PPAPI插件
1、在工程目录新建一个名为:media_stream_video.html的脚本,js脚本如下:
<!DOCTYPE html><html> <!-- Copyright 2014 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --><head> <title>Media Stream Video Example</title> <script type="text/javascript"> var plugin; var stream; function handleMessage(message) { console.log(message); } function success(s) { stream = s; plugin.postMessage({command: 'init', track: stream.getVideoTracks()[0]}); } function failure(e) { console.log(e); } function initialize() { plugin = document.getElementById('plugin'); plugin.addEventListener('message', handleMessage, false); var constraints = { audio: false, video: { mandatory: { minWidth: 640, minHeight: 320, minFrameRate: 30 }, optional: [] } }; navigator.webkitGetUserMedia(constraints, success, failure); } function changeFormat(format) { plugin.postMessage({command:'format', format: format}); } function changeSize(width, height) { plugin.postMessage({command:'size', width: width, height: height}); } document.addEventListener('DOMContentLoaded', initialize, false); </script></head><body> <h1>Pepper MediaStream Video API Example</h1><br> This example demonstrates receiving frames from a video MediaStreamTrack and rendering them in a plugin.<br> Left side shows YUV frames. Right side shows BGRA frames. <embed id="plugin" type="application/x-ppapi-example-media-stream-video" width="640" height="240"/> <h2>Format:</h2><br> <button onclick="changeFormat('YV12')" >YV12</button> <button onclick="changeFormat('I420')" >I420</button> <button onclick="changeFormat('BGRA')" >BGRA</button> <button onclick="changeFormat('DEFAULT')" >DEFAULT</button> <h2>Size:</h2><br> <button onclick="changeSize(72, 72)" >72 x 72</button> <button onclick="changeSize(640, 360)" >640 x 360</button> <button onclick="changeSize(1280, 720)" >1280 x 720</button> <button onclick="changeSize(0, 0)" >DEFAULT</button></body></html>
2、运行命令:
chrome --register-pepper-plugins="E:\\TestPro\media_stream_video\Debug\media_stream_video.dll#ppexample##1.0.0;application/x-ppapi-example-media-stream-video" file:///E:/TestPro/media_stream_video/media_stream_video.html
为什么插件没有被加载呢,原因是我们的chrome设置有问题,因为我们需要渲染,设置如图:
然后显示结果如图:
- PPAPI开发之路(二)在VS 2013上编译media_stream_video例子
- PPAPI开发之路(三)通过本地服务发布例子:media_stream_video的PPAPI
- 编译PPAPI的media_stream_video示例
- PPAPI开发之路(一)环境配置
- MAC之Qt在Xcode8上编译错误( 二)
- Lua 在VS上的环境配置(二)
- NPAPI和PPAPI开发
- NPAPI和PPAPI开发
- NPAPI和PPAPI开发
- PPAPI开发FAQ
- NPAPI和PPAPI开发
- PPAPI插件开发指南
- PPAPI插件开发指南
- linux-2.6.32在mini2440开发板上移植(0)之内核准备与编译
- iOS 多线程开发之OperationQueue(二)NSOperation VS GCD
- 在ubuntu12.04上编译 android源代码(二)
- QT学习之路(二)————Linux下搭建qt程序编译环境、开发板上搭建qt程序运行环境
- 如何在没有装VS(Visual Studio)的机器上编译运行C#程序
- 【进程间通信】Android 进程间通信的几种实现方式
- Android
- JavaScript:原生JS实现Facebook实时消息抓捕
- Spark性能调优(九)之Spark Tungsten内存使用
- Android将控件显示在最上层
- PPAPI开发之路(二)在VS 2013上编译media_stream_video例子
- 2017省市区最新编码(依据国家统计局最新数据)
- 补6.5日
- PHPxml解析成数组
- Android DeepLink原理与应用(2)
- Java中堆和栈的区别
- Redis与Memcached的区别
- A Famous Music Composer
- snackbard的一些使用技巧