本文整理汇总了C++中PLT_ActionReference::GetArgumentValue方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_ActionReference::GetArgumentValue方法的具体用法?C++ PLT_ActionReference::GetArgumentValue怎么用?C++ PLT_ActionReference::GetArgumentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_ActionReference
的用法示例。
在下文中一共展示了PLT_ActionReference::GetArgumentValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
if (m_Delegate) {
return m_Delegate->OnSetAVTransportURI(action);
}
// default implementation is using state variable
NPT_String uri;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURI", uri));
NPT_String metadata;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURIMetaData", metadata));
PLT_Service* serviceAVT;
NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
serviceAVT->SetStateVariable("AVTransportURI", uri);
serviceAVT->SetStateVariable("AVTransportURIMetaData", metadata);
serviceAVT->SetStateVariable("TransportState", "STOPPED");
serviceAVT->SetStateVariable("TransportStatus", "OK");
serviceAVT->SetStateVariable("TransportPlaySpeed", "1");
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
}
示例2:
/*----------------------------------------------------------------------
| PLT_MediaController::OnGetVolumeResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnGetVolumeResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String channel;
NPT_String current_volume;
NPT_UInt32 volume;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Channel", channel))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("CurrentVolume", current_volume))) {
goto bad_action;
}
if (NPT_FAILED(current_volume.ToInteger(volume))) {
goto bad_action;
}
m_Delegate->OnGetVolumeResult(NPT_SUCCESS, device, channel, volume, userdata);
return NPT_SUCCESS;
bad_action:
m_Delegate->OnGetVolumeResult(NPT_FAILURE, device, "", 0, userdata);
return NPT_FAILURE;
}
示例3: ParseCSV
/*----------------------------------------------------------------------
| PLT_MediaController::OnGetProtocolInfoResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnGetProtocolInfoResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String source_info, sink_info;
PLT_StringList sources, sinks;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Source", source_info))) {
goto bad_action;
}
ParseCSV(source_info, sources);
if (NPT_FAILED(action->GetArgumentValue("Sink", sink_info))) {
goto bad_action;
}
ParseCSV(sink_info, sinks);
m_Delegate->OnGetProtocolInfoResult(NPT_SUCCESS, device, &sources, &sinks, userdata);
return NPT_SUCCESS;
bad_action:
m_Delegate->OnGetProtocolInfoResult(NPT_FAILURE, device, NULL, NULL, userdata);
return NPT_FAILURE;
}
示例4: PlayMedia
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
NPT_String uri, meta;
PLT_Service* service;
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
NPT_CHECK_SEVERE(action->GetArgumentValue("CurrentURI", uri));
NPT_CHECK_SEVERE(action->GetArgumentValue("CurrentURIMetaData", meta));
// if not playing already, just keep around uri & metadata
// and wait for play command
if (!g_application.m_pPlayer->IsPlaying() && g_windowManager.GetActiveWindow() != WINDOW_SLIDESHOW) {
service->SetStateVariable("TransportState", "STOPPED");
service->SetStateVariable("TransportStatus", "OK");
service->SetStateVariable("TransportPlaySpeed", "1");
service->SetStateVariable("AVTransportURI", uri);
service->SetStateVariable("AVTransportURIMetaData", meta);
service->SetStateVariable("NextAVTransportURI", "");
service->SetStateVariable("NextAVTransportURIMetaData", "");
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
}
return PlayMedia(uri, meta, action.AsPointer());
}
示例5:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
/*test*/
PLT_Service* serviceAVT;
NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
//serviceAVT->SetStateVariable("TransportState", "TRANSITIONING");
/*test*/
if (m_Delegate) {
return m_Delegate->OnSetAVTransportURI(action);
}
// default implementation is using state variable
NPT_String uri;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURI", uri));
NPT_String metadata;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURIMetaData", metadata));
//PLT_Service* serviceAVT;
//NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
serviceAVT->SetStateVariable("AVTransportURI", uri);
serviceAVT->SetStateVariable("AVTransportURIMetaData", metadata);
//serviceAVT->SetStateVariable("TransportState", "PLAYING");//test
OutputDebugString(uri.GetChars());
return NPT_SUCCESS;
}
示例6:
/*----------------------------------------------------------------------
| PLT_MediaBrowser::OnSearchResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnSearchResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String value;
PLT_BrowseInfo info;
NPT_String unescaped;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("ContainerId", info.object_id))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("UpdateID", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.uid))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("NumberReturned", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.nr))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("TotalMatches", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.tm))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Result", value)) ||
value.GetLength() == 0) {
goto bad_action;
}
if (NPT_FAILED(PLT_Didl::FromDidl(value, info.items))) {
goto bad_action;
}
if (m_Delegate) m_Delegate->OnSearchResult(NPT_SUCCESS, device, &info, userdata);
return NPT_SUCCESS;
bad_action:
if (m_Delegate) m_Delegate->OnSearchResult(NPT_FAILURE, device, NULL, userdata);
return NPT_FAILURE;
}
示例7: msg
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetNextAVTransportURI(PLT_ActionReference& action)
{
NPT_String uri, meta;
PLT_Service* service;
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
NPT_CHECK_SEVERE(action->GetArgumentValue("NextURI", uri));
NPT_CHECK_SEVERE(action->GetArgumentValue("NextURIMetaData", meta));
CFileItemPtr item = GetFileItem(uri, meta);
if (!item) {
return NPT_FAILURE;
}
#if 0
if (g_application.m_pPlayer->IsPlaying()) {
int playlist = PLAYLIST_MUSIC;
if(item->IsVideo())
playlist = PLAYLIST_VIDEO;
{ CSingleLock lock(g_graphicsContext);
g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.Add(playlist, item);
g_playlistPlayer.SetCurrentSong(-1);
g_playlistPlayer.SetCurrentPlaylist(playlist);
}
CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0);
g_windowManager.SendThreadMessage(msg);
service->SetStateVariable("NextAVTransportURI", uri);
service->SetStateVariable("NextAVTransportURIMetaData", meta);
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
} else if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) {
return NPT_FAILURE;
} else {
return NPT_FAILURE;
}
#endif
return NPT_SUCCESS;
}
示例8: if
/*----------------------------------------------------------------------
| PLT_LightSampleDevice::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_LightSampleDevice::OnAction(PLT_ActionReference& action, NPT_SocketInfo* /* info */)
{
/* parse the action name */
NPT_String name = action->GetActionDesc()->GetName();
if (name.Compare("SetTarget") == 0) {
NPT_String value;
action->GetArgumentValue("newTargetValue", value);
PLT_StateVariable* variable = action->GetActionDesc()->GetService()->FindStateVariable("Status");
if (NPT_FAILED(variable->SetValue(value))) {
action->SetError(402, "Invalid Args");
return NPT_FAILURE;
}
return NPT_SUCCESS;
} else if (name.Compare("GetStatus") == 0) {
PLT_StateVariable* variable = action->GetActionDesc()->GetService()->FindStateVariable("Status");
if (variable) {
action->SetArgumentValue("ResultStatus", variable->GetValue());
return NPT_SUCCESS;
}
}
action->SetError(501, "Action Failed");
return NPT_FAILURE;
}
示例9:
/*----------------------------------------------------------------------
| PLT_MediaServer::OnUpdate
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::OnUpdate(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
if (!m_Delegate)
return NPT_ERROR_NOT_IMPLEMENTED;
int err;
const char* msg = NULL;
NPT_String object_id, current_xml, new_xml;
NPT_Map<NPT_String,NPT_String> curr_values;
NPT_Map<NPT_String,NPT_String> new_values;
NPT_CHECK_LABEL(action->GetArgumentValue("ObjectID", object_id), args);
NPT_CHECK_LABEL(object_id.IsEmpty(),args);
NPT_CHECK_LABEL(action->GetArgumentValue("CurrentTagValue", current_xml), args);
NPT_CHECK_LABEL(action->GetArgumentValue("NewTagValue", new_xml), args);
if (NPT_FAILED(ParseTagList(current_xml, curr_values))) {
err = 702;
msg = "Invalid currentTagvalue";
goto failure;
}
if (NPT_FAILED(ParseTagList(new_xml, new_values))) {
err = 703;
msg = "Invalid newTagValue";
goto failure;
}
if (curr_values.GetEntryCount() != new_values.GetEntryCount()) {
err = 706;
msg = "Paramater mismatch";
goto failure;
}
return m_Delegate->OnUpdateObject(action, object_id, curr_values, new_values, context);
args:
err = 402;
msg = "Invalid args";
failure:
NPT_LOG_WARNING(msg);
action->SetError(err, msg);
return NPT_FAILURE;
}
示例10:
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetVolume
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetVolume(PLT_ActionReference& action)
{
NPT_String volume;
NPT_CHECK_SEVERE(action->GetArgumentValue("DesiredVolume", volume));
g_application.SetVolume((float)strtod((const char*)volume, NULL));
return NPT_SUCCESS;
}
示例11:
/*----------------------------------------------------------------------
| CMediaCrawler::OnBrowseResponse
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::OnBrowseResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_COMPILER_UNUSED(device);
if (!userdata) return NPT_FAILURE;
CMediaCrawlerBrowseInfoReference* info = (CMediaCrawlerBrowseInfoReference*) userdata;
(*info)->res = res;
(*info)->code = action->GetErrorCode();
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("ObjectID", (*info)->object_id))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("UpdateID", (*info)->uid))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("NumberReturned", (*info)->nr))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("TotalMatches", (*info)->tm))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Result", (*info)->didl))) {
goto bad_action;
}
goto done;
bad_action:
if (NPT_SUCCEEDED((*info)->res)) (*info)->res = NPT_FAILURE;
done:
(*info)->shared_var.SetValue(1);
delete info;
return NPT_SUCCESS;
}
示例12:
/*----------------------------------------------------------------------
| PLT_MediaConnect::OnRegisterDevice
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::OnRegisterDevice(PLT_ActionReference& action)
{
NPT_String reqMsgBase64;
NPT_CHECK_WARNING(action->GetArgumentValue("RegistrationReqMsg", reqMsgBase64));
NPT_String respMsgBase64;
NPT_CHECK_WARNING(action->SetArgumentValue("RegistrationRespMsg", respMsgBase64));
return NPT_SUCCESS;
}
示例13: OnSeek
NPT_Result GPAC_MediaRenderer::OnSeek(PLT_ActionReference& action)
{
u32 h, m, s;
Double time;
NPT_String unit, target;
if (NPT_FAILED(action->GetArgumentValue("Unit", unit))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->GetArgumentValue("Target", target))) {
return NPT_FAILURE;
}
if ((unit!="ABS_TIME") && (unit!="REL_TIME")) {
action->SetError(710,"Seek mode not supported");
return NPT_FAILURE;
}
sscanf(target, "%d:%d:%d", &h, &m, &s);
time = h*3600.0 + m*60.0 + s;
m_pUPnP->OnSeek(time);
return NPT_SUCCESS;
}
示例14: OnBrowseRoot
/*----------------------------------------------------------------------
| PLT_MediaServer::OnBrowse
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::OnBrowse(PLT_ActionReference& action,
const NPT_HttpRequestContext& context)
{
NPT_Result res;
NPT_String object_id;
if (NPT_FAILED(action->GetArgumentValue("ObjectId", object_id))) {
NPT_LOG_WARNING("PLT_FileMediaServer::OnBrowse - invalid arguments.");
return NPT_FAILURE;
}
NPT_LOG_FINE_1("PLT_FileMediaServer::OnOnBrowse - id = %s\r\n", (const char*)object_id);
// extract server uuid and server object id from our object id
NPT_String server_uuid;
NPT_String server_object_id;
if (NPT_FAILED(SplitObjectId(object_id, server_uuid, server_object_id))) {
/* error */
NPT_LOG_WARNING("CMediaCrawler::OnBrowse - ObjectID not found.");
action->SetError(701, "No Such Object.");
return NPT_FAILURE;
}
// root ?
if (server_uuid.GetLength() == 0) {
res = OnBrowseRoot(action);
} else {
// we have a device to browse
// is it device root?
if (server_object_id.GetLength() == 0) {
server_object_id = "0";
}
res = OnBrowseDevice(action, server_uuid, server_object_id, context);
}
if (NPT_FAILED(res) && (action->GetErrorCode() == 0)) {
action->SetError(800, "Internal error");
}
return res;
}
示例15: OnSetAVTransportURI
NPT_Result GPAC_MediaRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
char the_url[4096], szVal[100];
NPT_String url_id;
const char *MediaUri;
if (NPT_FAILED(action->GetArgumentValue("CurrentURI", url_id))) {
return NPT_FAILURE;
}
MediaUri = url_id;
if (!MediaUri) return NPT_FAILURE;
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Request: change media\n"));
if (m_connected) {
m_connected = GF_FALSE;
m_pUPnP->OnStop(m_ip_src);
}
const char *ext = strrchr(MediaUri, '.');
if (ext && !stricmp(ext, ".m3u")) {
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[UPnP] M3U playlists not supported yet\n"));
return NPT_SUCCESS;
}
/* Load and add to mediaHistoryList */
strcpy(the_url, MediaUri);
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Adding media to the list : %s\n", MediaUri));
gf_list_add(m_mediaHistoryList, gf_strdup(MediaUri));
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Opening URL %s\n", the_url));
m_track_pos = gf_list_count(m_mediaHistoryList);
m_connected = GF_TRUE;
m_pUPnP->OnConnect(the_url, m_ip_src);
/* Set UPnP datas */
m_pAVService->SetStateVariable("TransportState", "PLAYING");
m_pAVService->SetStateVariable("AVTransportURI", the_url);
sprintf(szVal, "%d", gf_list_count(m_mediaHistoryList));
m_pAVService->SetStateVariable("NumberOfTracks", szVal);
sprintf(szVal, "%d", m_track_pos);
m_pAVService->SetStateVariable("CurrentTrack", szVal);
return NPT_SUCCESS;
}