http://blog.csdn.net/moruite/article/details/8496218
出发点:Android电视棒实现DLNA功能采用JAVA版本的cyberlink的话,缺点明显,SSDP协议设备发现有延时(有时还发现不了设备)体验差,基于Linux电视棒可以控制硬件成本在100元以下,而且c语言实现的cyberlink DLNA协议栈不存在设备发现不了的情况,本文记录记录linux下实现dlna碰到的一揽子问题
1. DLNA的DMR方案
方案1: MediaGateForCC (
http://www.cybergarage.org/twiki/bin/view/Main/MediaGateForCC) 交叉编译,基于gstreamer实现播放器
Cyberlink协议栈需要依赖xml库, 可以选择xerces和libxml2, xerces是apatch提供的一个比较庞大的xml解析库,嵌入式设备不考虑。
1) 编译libxml2
./configure --prefix=/home/work/mylib --host=mips-linux-gnu --build=i686 --target=mips-linux-gnu CC=mips-linux-gnu-gcc -EL CFLAGS=-I/home/work/mylib/include LDFLAGS=-L/home/work/mylib/lib
2)编译MediaGateForCC
./configure --prefix=/home/work/mylib --host=mips-linux-gnu --build=i686 --target=mips-linux-gnu CC=mips-linux-gnu-gcc -EL --enable-libxml2 CFLAGS=-I/home/work/mylib/include CPPFLAGS=-I/home/work/mylib/include LDFLAGS=-L/home/work/mylib/lib
错误1:LibXml2Parser.cpp中Node *newChildNode = convertToCLinkFormat( doc, child, depth 1)改成Node *newChildNode = convertToCLinkFormat( doc, child, depth );
错误2:ControlPoint.cpp中Device **dev = new (Device(*[devCnt])); 改成 Device **dev = new Device* [devCnt];
编译成功
3) CyberLink中没有实现Media Renderer的AVTransport和RenderingControl服务,以下是补充的AVTransport..h和RenderingControl.h
[cpp] view
plaincopy
-
class AVT : public ActionListener, public QueryListener
-
{
-
-
CyberUtil::Mutex mutex;
-
int maxConnectionID;
-
-
-
-
-
-
-
public:
-
-
static const char *DESCRIPTION;
-
-
static const char *SERVICE_TYPE;
-
-
static const char * TRANSPORTSTATE ;
-
static const char * TRANSPORTSTATUS ;
-
static const char * PLAYBACKSTORAGEMEDIUM;
-
static const char * RECORDSTORAGEMEDIUM;
-
static const char * POSSIBLEPLAYBACKSTORAGEMEDIA;
-
static const char * POSSIBLERECORDSTORAGEMEDIA;
-
static const char * CURRENTPLAYMODE ;
-
static const char * TRANSPORTPLAYSPEED;
-
static const char * RECORDMEDIUMWRITESTATUS ;
-
static const char * CURRENTRECORDQUALITYMODE ;
-
static const char * POSSIBLERECORDQUALITYMODES;
-
static const char * NUMBEROFTRACKS;
-
static const char * CURRENTTRACK;
-
static const char * CURRENTTRACKDURATION;
-
static const char * CURRENTMEDIADURATION;
-
static const char * CURRENTTRACKMETADATA;
-
static const char * CURRENTTRACKURI;
-
static const char * AVTRANSPORTURI;
-
static const char * AVTRANSPORTURIMETADATA ;
-
static const char * NEXTAVTRANSPORTURI;
-
static const char * NEXTAVTRANSPORTURIMETADATA;
-
static const char * RELATIVETIMEPOSITION;
-
static const char * ABSOLUTETIMEPOSITION;
-
static const char * RELATIVECOUNTERPOSITION ;
-
static const char * ABSOLUTECOUNTERPOSITION ;
-
static const char * CURRENTTRANSPORTACTIONS;
-
static const char * LASTCHANGE;
-
static const char * SETAVTRANSPORTURI;
-
static const char * INSTANCEID;
-
static const char * CURRENTURI;
-
static const char * CURRENTURIMETADATA;
-
static const char * SETNEXTAVTRANSPORTURI;
-
static const char * NEXTURI;
-
static const char * NEXTURIMETADATA ;
-
static const char * GETMEDIAINFO;
-
static const char * NRTRACKS;
-
static const char * MEDIADURATION;
-
static const char * PLAYMEDIUM ;
-
static const char * RECORDMEDIUM ;
-
static const char * WRITESTATUS ;
-
static const char * GETTRANSPORTINFO ;
-
static const char * CURRENTTRANSPORTSTATE;
-
static const char * CURRENTTRANSPORTSTATUS ;
-
static const char * CURRENTSPEED ;
-
static const char * GETPOSITIONINFO;
-
static const char * TRACK;
-