本文整理汇总了C++中DOMParser::getRootNode方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMParser::getRootNode方法的具体用法?C++ DOMParser::getRootNode怎么用?C++ DOMParser::getRootNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMParser
的用法示例。
在下文中一共展示了DOMParser::getRootNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
/*****************************************************************************
* Open:
*****************************************************************************/
static int Open(vlc_object_t *p_obj)
{
demux_t *p_demux = (demux_t*) p_obj;
if(!p_demux->s->psz_url)
return VLC_EGENERIC;
std::string mimeType;
char *psz_mime = stream_ContentType(p_demux->s);
if(psz_mime)
{
mimeType = std::string(psz_mime);
free(psz_mime);
}
PlaylistManager *p_manager = NULL;
char *psz_logic = var_InheritString(p_obj, "adaptive-logic");
AbstractAdaptationLogic::LogicType logic = AbstractAdaptationLogic::Default;
if( psz_logic )
{
for(size_t i=0;i<ARRAY_SIZE(pi_logics); i++)
{
if(!strcmp(psz_logic, ppsz_logics_values[i]))
{
logic = pi_logics[i];
break;
}
}
free( psz_logic );
}
std::string playlisturl(p_demux->s->psz_url);
bool dashmime = DASHManager::mimeMatched(mimeType);
bool smoothmime = SmoothManager::mimeMatched(mimeType);
if(!dashmime && !smoothmime && HLSManager::isHTTPLiveStreaming(p_demux->s))
{
M3U8Parser parser;
M3U8 *p_playlist = parser.parse(VLC_OBJECT(p_demux),p_demux->s, playlisturl);
if(!p_playlist)
{
msg_Err( p_demux, "Could not parse playlist" );
return VLC_EGENERIC;
}
p_manager = new (std::nothrow) HLSManager(p_demux, p_playlist,
new (std::nothrow) HLSStreamFactory, logic);
}
else
{
/* Handle XML Based ones */
DOMParser xmlParser; /* Share that xml reader */
if(dashmime)
{
p_manager = HandleDash(p_demux, xmlParser, playlisturl, logic);
}
else if(smoothmime)
{
p_manager = HandleSmooth(p_demux, xmlParser, playlisturl, logic);
}
else
{
/* We need to probe content */
const uint8_t *p_peek;
const ssize_t i_peek = vlc_stream_Peek(p_demux->s, &p_peek, 2048);
if(i_peek > 0)
{
stream_t *peekstream = vlc_stream_MemoryNew(p_demux, const_cast<uint8_t *>(p_peek), (size_t)i_peek, true);
if(peekstream)
{
if(xmlParser.reset(peekstream) && xmlParser.parse(false))
{
if(DASHManager::isDASH(xmlParser.getRootNode()))
{
p_manager = HandleDash(p_demux, xmlParser, playlisturl, logic);
}
else if(SmoothManager::isSmoothStreaming(xmlParser.getRootNode()))
{
p_manager = HandleSmooth(p_demux, xmlParser, playlisturl, logic);
}
}
vlc_stream_Delete(peekstream);
}
}
}
}
if(!p_manager || !p_manager->start())
{
delete p_manager;
return VLC_EGENERIC;
}
p_demux->p_sys = reinterpret_cast<demux_sys_t *>(p_manager);
//.........这里部分代码省略.........