Exemplo n.º 1
0
Arquivo: zsh.cpp Projeto: 0xheart0/vlc
int main(int argc, const char **argv)
{
    libvlc_instance_t *libvlc = libvlc_new(argc - 1, argv + 1);
    if (!libvlc)
        return 1;

    size_t modules = 0;
    module_t **mod_list;

    mod_list = module_list_get(&modules);
    if (!mod_list || modules == 0)
    {
        libvlc_release(libvlc);
        return 2;
    }

    module_t **max = &mod_list[modules];

    puts("#compdef vlc cvlc rvlc svlc mvlc qvlc nvlc\n"
           "#This file is autogenerated by zsh.cpp\n"
           "typeset -A opt_args\n"
           "local context state line ret=1\n"
           "local modules\n");

    printf("vlc_modules=\"");
    for (module_t **mod = mod_list; mod < max; mod++)
        PrintModule(*mod);
    puts("\"\n");

    puts("_arguments -S -s \\");
    for (module_t **mod = mod_list; mod < max; mod++)
        ParseModule(*mod);
    puts("  \"(--module)-p[print help on module]:print help on module:($vlc_modules)\"\\");
    puts("  \"(-p)--module[print help on module]:print help on module:($vlc_modules)\"\\");
    puts("  \"(--help)-h[print help]\"\\");
    puts("  \"(-h)--help[print help]\"\\");
    puts("  \"(--longhelp)-H[print detailed help]\"\\");
    puts("  \"(-H)--longhelp[print detailed help]\"\\");
    puts("  \"(--list)-l[print a list of available modules]\"\\");
    puts("  \"(-l)--list[print a list of available modules]\"\\");
    puts("  \"--reset-config[reset the current config to the default values]\"\\");
    puts("  \"--config[use alternate config file]\"\\");
    puts("  \"--reset-plugins-cache[resets the current plugins cache]\"\\");
    puts("  \"--version[print version information]\"\\");
    puts("  \"*:Playlist item:->mrl\" && ret=0\n");

    puts("case $state in");
    puts("  mrl)");
    puts("    _alternative 'files:file:_files' 'urls:URL:_urls' && ret=0");
    puts("  ;;");
    puts("esac\n");

    puts("return ret");

    module_list_free(mod_list);
    libvlc_release(libvlc);
    return 0;
}
Exemplo n.º 2
0
bool CLoadModule::LoadModule(const char* szModulePath, const char* szResourceName)
{
	vector<string> vecModuleName;
	string strModuleName;

	//将字符串数组解析成单一的模块名称
	ParseModule(szResourceName, vecModuleName);

	sprintf_safe(m_szModulePath, MAX_BUFF_200, "%s", szModulePath);

	for(uint16 i = 0; i < (uint16)vecModuleName.size(); i++)
	{
		strModuleName = vecModuleName[i];
		OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] Begin Load ModuleName[%s]!\n", strModuleName.c_str()));

		//确定这个模块是否被注册过
		_ModuleInfo* pCurr = m_mapModuleInfo.SearchMapData(strModuleName);
		if(NULL != pCurr)
		{
			//如果被注册过,先卸载现有的,再重新装载
			UnLoadModule(strModuleName.c_str());
		}

		_ModuleInfo* pModuleInfo = new _ModuleInfo();

		if(NULL == pModuleInfo)
		{
			OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] new _ModuleInfo is error!\n"));
			return false;
		}

		//开始注册模块
		if(false == LoadModuleInfo(strModuleName, pModuleInfo))
		{
			SAFE_DELETE(pModuleInfo);
			return false;
		}

        //将注册成功的模块,加入到map中
		if(false == m_mapModuleInfo.AddMapData(pModuleInfo->GetName(), pModuleInfo))
		{
			OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] m_mapModuleInfo.AddMapData error!\n"));
			SAFE_DELETE(pModuleInfo);
			return false;
		}

		OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] Begin Load ModuleName[%s] OK!\n", strModuleName.c_str()));
	}

	return true;
}
Exemplo n.º 3
0
bool CLoadModule::LoadModule(const char* pModulePath, const char* pResourceName)
{
	vector<string> vecModuleName;
	string strModuleName;

	//将字符串数组解析成单一的模块名称
	ParseModule(pResourceName, vecModuleName);

	sprintf_safe(m_szModulePath, MAX_BUFF_200, "%s", pModulePath);

	for(uint16 i = 0; i < (uint16)vecModuleName.size(); i++)
	{
		strModuleName = vecModuleName[i];
		OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] Begin Load ModuleName[%s]!\n", strModuleName.c_str()));

		//确定这个模块是否被注册过
		_ModuleInfo* pCurr = m_mapModuleInfo.SearchMapData(strModuleName);
		if(NULL != pCurr)
		{
			//如果被注册过,先卸载现有的,再重新装载
			UnLoadModule(strModuleName.c_str());
		}

		_ModuleInfo* pModuleInfo = new _ModuleInfo();

		if(NULL == pModuleInfo)
		{
			OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] new _ModuleInfo is error!\n"));
			return false;
		}

		//开始注册模块函数
		if(false == LoadModuleInfo(strModuleName, pModuleInfo, m_szModulePath))
		{
			SAFE_DELETE(pModuleInfo);
			return false;
		}

		//查找此模块是否已经被注册,有则把信息老信息清理
		_ModuleInfo* pOldModuleInfo = m_mapModuleInfo.SearchMapData(strModuleName);
		if(NULL != pOldModuleInfo)
		{
			//关闭副本
			ACE_OS::dlclose(pOldModuleInfo->hModule);
			m_mapModuleInfo.DelMapData(strModuleName, true);
		}

		//将注册成功的模块,加入到map中
		if(false == m_mapModuleInfo.AddMapData(pModuleInfo->GetName(), pModuleInfo))
		{
			OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] m_mapModuleInfo.AddMapData error!\n"));
			SAFE_DELETE(pModuleInfo);
			return false;
		}

		//开始调用模块初始化动作
		int nRet = pModuleInfo->LoadModuleData(App_ServerObject::instance());
		if(nRet != 0)
		{
			OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadModuleInfo] strModuleName = %s, Execute Function LoadModuleData is error!\n", strModuleName.c_str()));
			return false;
		}

		OUR_DEBUG((LM_ERROR, "[CLoadModule::LoadMoudle] Begin Load ModuleName[%s] OK!\n", strModuleName.c_str()));
	}

	return true;
}