opencore官方文档中文版Word格式.docx
- 文档编号:19010197
- 上传时间:2023-01-03
- 格式:DOCX
- 页数:16
- 大小:895.51KB
opencore官方文档中文版Word格式.docx
《opencore官方文档中文版Word格式.docx》由会员分享,可在线阅读,更多相关《opencore官方文档中文版Word格式.docx(16页珍藏版)》请在冰豆网上搜索。
2.高层次设计(HLD)
2.1简介和局限性
PVPlayerSDK包含所有必要的特点来支持这个要求先前的部分。
这个特性的要求是被设计来处理的很全面的应用程序。
这个模块结构和设计的扩展提供了便利的机制,不过由于opencore的复杂性,相对起MPLAYER,VLC等多媒体播放器来说,扩展格式相对麻烦点。
而且PVPlayer在新版本和升级PVPlayer的SDK里,可能会有不兼容的BUG。
2.2开发环境和工具
PVPlayerSDK是c++语言实现的,所以它需要ANSIC++开发工具支持平台。
不过对于开发者不要求每个特征定义为c++标准。
例如,RTTI异常处理。
然而,C++编译环境是必需的,在Android环境中用的是G++3.3.3编译,PVPlayerSDK也需要另一种类型的接口(例如。
C,Java),PVPlayerSDK提供了一种适配接口,但内部部件还需在c++环境下编译.
PVPlayerSDK源代码是基于PacketVideo的操作系统(OSCL)和PacketVideo多媒体框架(PVMF)。
PVPlayerSDK依赖OSCL来提供系统的功能,是便携式在平台上(例如,它作为一个操作系统的抽象层提供了平台的API来了PVPlayerSDK)。
PVMF框架是确定多媒体架构包PVPlayerSDK。
OSCL需要一个平台和服务的相对完整操作系统,如动态记忆、管理、多线程、文件I/O、网络、域名服务,时钟信息。
2.3结构和组件
PVPlayerSDK是一个标准架构,结构灵活的、可扩展的,轻巧的多媒体播放框架。
PVPlayer引擎是播放器的核心。
引擎使用PVMF节点和节点图表数据处理和内部注册时,节点的图形结构。
下图是PVPlayerSDK简单框架图。
、图一PVPlayerSDK软件框架图
2.4控制流
回放控制PVPlayerSDK是user(这里一般是开发者)的PVPlayer,典型的LINUX应用程序,通过BINDLE一个服务给JAVA层调用。
PVPlayerSDKapi提供了如调用初使化、setdatasourse、prepare、开始(停止)多媒体播放等等。
在PVPlayerSDK、控制流量通常是自上而下的。
这个应用程序请求被PVPlayer收到后经引擎适配。
这个PVPlayer引擎根据先前注册的节点并通过相应的标识控制PVMF节点数据。
有一些控制数据连接节点之间,但主要的控制数据PVPlayer引擎和PVMF节点之间。
2.5数据流
PVPlayerSDK多媒体数据流过程的通过一个或更多的PVMF节点连接在一起。
PVMF节点类型使用和结构将取决于回放文件源参数的类型进行相应播放操作。
文件类型主要是提取文件元数据的具体参数,由PVPlayer引擎或PVMF提取节点PVPlayerSDK通过适当的接口返回给用户。
3.PVPlayer引擎设计
PVPlayer引擎是PVPlayerSDK的心脏。
它接收和处理所有PVPlayerSDK从用户和管理PVMF播放多媒体所需的组成及相关业务的请求。
其任务应用和简化高级控制。
这个PVPlayer引擎也侦测,处理,和过滤事件和信息生成多媒体播放操作控制。
3.1PVPlayerInterfaceAPI
PVPlayer用户界面PVPlayer引擎通过PVPlayerInterface接口类来确定是否有一种适配接口用户和PVPlayer引擎。
PVPlayerInterface是一种OSCL-based接口和遵循公共接口,除了多媒体播放特定api,PVPlayerInterface提供方法检索SDK信息、操纵和取消的命令。
并描述PVPlayerInterfaceAPI,指的是一种PVPlayerInterfaceAPI文档生成的支持的标记。
3.2异步操作
ThePVPlayerengineprocessesmostcommandsinitiatedbyAPIcallsasynchronously.Therearesomecommandsthatareprocessedsynchronouslyandtheycanbedifferentiatedbythereturnvalue.SynchronouscommandsreturnaPVMFstatuscodewhichtellstheuserwhetherthecommandsucceededornotandifitdidfail,whattheerrorwas.AllasynchronouscommandsreturnacommandID.Fortheusertobenotifiedofasynchronouscommandcompletion,theusermustspecifyacallbackhandlerwheninstantiatingPVPlayerengineviathefactoryfunction.Whentheasynchronouscommandcompletes,PVPlayerenginecallsthecallbackhandlerwiththecommandIDforthecommand,commandstatus,andanyotherrelevantdata.Toprocessthecommandasynchronously,thePVPlayerengineisimplementedasanactiveobject,whichgetstorunaccordingtotheactiveschedulerrunninginthethread.ThePVPlayerengineexpectsschedulertobeavailablewheninstantiatedandtheengineitselfwillnotdirectlycreateathreadorscheduler.
Withasynchronouscommands,thereisapossibilityofcommandsnotcompletinginexpectedtime.Todealwiththisissue,PVPlayerengineprovidesstandardPVSDKAPIstocancelaspecificorallissuedcommands.TheuserofPVPlayerSDKcanusetheseAPIstocancelanyrequestthatdidnotcompleteintimeorarenotneededduetochangingcircumstances.InPVPlayerengine,itmighthavetodealwithlowerlevelcomponentsthatbehaveasynchronously.TopreventanunresponsivelowerlevelcomponentfromblockingPVPlayerengineoperation,PVPlayerenginehastimeouthandlingforanyasynchronouscommandsthatitissues.Whentimeoutdoesoccur,theasynchronouscommandiscanceledandishandledappropriately(e.g.commandfailure,errorevent).
3.3事件处理
ThePVPlayerenginenotifiestheuseroferrorsandotherinformationnotrelatedtoAPIcallsasunsolicitedevents.ThenotificationishandledbymakingacallbackonhandlersspecifiedbytheuserofPVPlayerengine.Therearetwocallbackhandlers,oneforerroreventsandoneforinformationalevents,thatmustbespecifiedbytheuserwheninstantiatingPVPlayerengineviathefactoryfunction.
3.4引擎框架
下面的图表说明了应用程序使用PVPlayer引擎的接口PVPlayerInterface时直接适配。
PVPlayerFactory处理实例化组件和destory的PVPlayerEngine对象。
所有PVPlayer引擎的api提供PVPlayerInterface。
PVPlayerEngine采用三种回收处理过的应用,PVCommandStatusObserver,PVInformationalObserver,PVErrorEventObserver,通知申请上述指令完成同步误差和信息的事件。
图二类图
3.5状态机
图三状态机
PVPlayer引擎实例化后状态为IDLE,在IDLE状态时,可以调用AddDataSource()来指定需要回放的多媒体数据,然后调用init()初始化数据并且状态转为INITIALIZED,在进入INITIALIZED
状态的时候,用户可以获取媒体的tracks和metadata,并且可以调用AddDataSink()去指定具体的datasinks去回放.
在所有的datasinks添加后,用户调用Prepare(),使引擎建立相关的PVMF节点,并为数据流指定多媒体播放的数据源和数据接收器,建立需要播放的数据流队列.用户在PREPARED状态时调用Start()进入到STARTED状态,启动多媒体播放.在调用Stop()后回到INITIALIZED状态并且刷新多媒体数据流.
在STARTED状态时,用户也可以调用Pause().Stop().调用Stop()后停止回放,刷新所有数据流,并且使引擎回到初始化状态.调用Pause(),会停止回放,但不会刷新数据流,而且可以调用Resume()继续从暂停的地方播放.在PAUSED状态时可以调用Stop()使引擎回到初始化状态.
调用Stop()回到INITIALIZED状态后,数据队列可以通过调用AddDataSink()和RemoveDataSink()来添加和删除.在调用Prepare()\Start()重新回放,但是关闭回到IDLE状态时,或需要重新打开另一个媒体文件时,需要调用Reset().因为在IDLE状态调用RemoveDataSink()不能删除所有数据队列.调用Reset()后,又回到起始状态,流程如上一样.如果用户想退出PVPlayer,也可以调用Reset(),在PREPARED,STARTED,PAUSED状态时都可以调用该函数.
如果PVPlayer引擎收到错误信息或从其它组件传来错误事件后,引擎会发送ERROR状态并且尝试恢复.如果这个错误是不可恢复的,刚引擎会清空所有状态和数据列回到IDLE状态.此时用户应该等待PVMFInfoErrorHandlingCompleteinformationalevent.
以上是这个状态机的简要描述,具体参考OPENCORE源码.
4.接口
4.1默认接口
PVPlayer的接口是标准的OSCL-based接口,引擎的API都是通过这些接口来调用相对应的操作,但是像一些OSCL类型的组件和PVMF类型的组件里需要注意有些不同.
4.2适配层
ftheinterfacetoPVPlayerSDKneedstobedifferentthantheOSCL-basedinterface,anotherinterfacelayerneedstobecreatedto“wrap”aroundtheOSCL-basedinterface.This“wrapper”isreferredtoasan
adaptationlayerforOSCL-basedPVPlayerengineinterface.OnepossiblereasontocreateanadaptationlayerwouldbetoencapsulatetheOSCLinterfacewithtypesandcomponentsofaparticularplatformoroperatingsystem(e.g.ANSICinterface,Symbianinterface).AnotherreasonwouldbethattheadaptationlayermodifiestheinterfaceandbehaviorofPVPlayerSDK
tomatchtheexpectationoftheapplication(e.g.legacyinterface).TheadaptationlayercouldalsocombinePVPlayerSDKwithanotherSDKorcomponenttoprovideaunifiedinterfacetotheapplication.TheblockdiagramsbelowillustratehowtheadaptationlayerrelatestoPVPlayerEngineanditsOSCL-basedinterface.Thediagramontherightshowstheadaptationlayeraddingmorefunctionalitybyincludinganotherengine.
PvPlayer
AdapationLayer
pvPlayer
OSCLInterface
pvPlayerEngine
pvPlayer+AdapationLayer
Another
Engine
pvPlayerOSCL
Interface
pvPlayerEngine
图四适配层
4.3多线程支持
默认的OSCL-based接口不支持多线程,所以在使用多线程的时候,适配层需要提供一个功能来实现.一种方法是使用OSCLproxy接口组件来提供多线程的支持.另一种方法是添加一个另外的PlatformThreadingSupport.两种方法的框图如下.
pvPlayerAdapationLayer
OSCL
Interface
OSCLProxy
Framework
Engine
Platform
Threading
Support
pvPlayerOSCL
Threading
Support
图五多线程支持
4.4媒体数据输出到数据池
PVPlayer引擎利用PVMF节点指定数据输出的数据池,但大部份使用的时候,同步数据通过适合的渲染后再送到媒体输出设备.在输出视频流的时候,需要一个显示设备,音频流需要一个PCM音频输出设备.媒体输出设备是一个具体的特定平台.输出设备的创建有两个方法可以实现:
(1)在PVMF节点里封装一个mediadevice,引擎可以直接调用,这种方法可以最大限度的减少PVPlayer和接口层的代码,但是需要创建一个新的PVMF节点.
Platform-specific
Output
MediaPVMF
Node
OutputMedia
Device
Interface
Engine
PVMediaI/Oto
Output
MediaDevice
Wrapper
PVMediaI/O
PVMFNode
Device
(2)直接调用PVmediaI/O接口,在I/O接口中调用输出设备.这种方法相对于第一种来说并不需要创建新的PVMF节点,复杂性也小.但增加了代码的层次和和代码量.下图是两种方法的引擎.更多PVI/O接口的信息,参考PVMEDIAI/Odatasheet.
图6媒体输出的两种方法
5.PVMFNode
本节给出PVMF简短的描述节点,由PVPlayer引擎使用。
只有PVMF节点OSCL和PVMF基于组件都包括在内。
没有特定于平台PVMF节点覆盖。
欲了解更多有关特定节点(1,低于或平台特定一)的详细信息,请参阅该节点文件。
5.1数据池节点(DataSinkNodes)
数据池节点是PVPlayer的引擎中输出数据前最后的数据终点.
5.1.1PVMFMediaOutputNode
PVMFMediaOutputNodeisawrappernodearoundthePVmediaI/Ointerfacetooutputdata.ThenodetranslatesnodecommandsandincomingmediadatatoappropriatemediaI/OactionsandhandlesmediaI/Oevents.UsingPVMFMediaOutputNodeallowsencapsulationofplatformanddevicespecificoutput
interfacewithPVmediaI/Ointerface.
5.1.2PVMFFileOutputNode
PVMFFileOutputNodeaccessesthefiledirectlyusingOSCLfileI/Otowritemediadatacominginviatheport.Thenodehassomecapabilitytounderstandformattypeandtowriteoutdataappropriatelyforthespecifiedformattype(AMRfileheaderforAMRIETFformat).
6.同步机制
在OPENCORE官方文档中对时间戳相关介绍,有些难懂,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- opencore 官方 文档 中文版