本文整理汇总了C++中PLT_Service::SetSCPDXML方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_Service::SetSCPDXML方法的具体用法?C++ PLT_Service::SetSCPDXML怎么用?C++ PLT_Service::SetSCPDXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_Service
的用法示例。
在下文中一共展示了PLT_Service::SetSCPDXML方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*----------------------------------------------------------------------
| PLT_MediaServer::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::SetupServices()
{
PLT_Service* service;
{
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ContentDirectory:1",
"urn:upnp-org:serviceId:ContentDirectory",
"ContentDirectory");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) MS_ContentDirectorywSearchSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("ContainerUpdateIDs", "");
service->SetStateVariableRate("ContainerUpdateIDs", NPT_TimeInterval(2.));
service->SetStateVariable("SystemUpdateID", "0");
service->SetStateVariableRate("SystemUpdateID", NPT_TimeInterval(2.));
service->SetStateVariable("SearchCapability", "@id,@refID,dc:title,upnp:class,upnp:genre,upnp:artist,upnp:author,upnp:[email protected],upnp:album,dc:creator,[email protected],[email protected],[email protected],[email protected],dc:publisher,dc:language,upnp:originalTrackNumber,dc:date,upnp:producer,upnp:rating,upnp:actor,upnp:director,upnp:toc,dc:description,microsoft:userRatingInStars,microsoft:userEffectiveRatingInStars,microsoft:userRating,microsoft:userEffectiveRating,microsoft:serviceProvider,microsoft:artistAlbumArtist,microsoft:artistPerformer,microsoft:artistConductor,microsoft:authorComposer,microsoft:authorOriginalLyricist,microsoft:authorWriter,upnp:userAnnotation,upnp:channelName,upnp:longDescription,upnp:programTitle");
service->SetStateVariable("SortCapability", "dc:title,upnp:genre,upnp:album,dc:creator,[email protected],[email protected],[email protected],dc:publisher,dc:language,upnp:originalTrackNumber,dc:date,upnp:producer,upnp:rating,upnp:actor,upnp:director,upnp:toc,dc:description,microsoft:year,microsoft:userRatingInStars,microsoft:userEffectiveRatingInStars,microsoft:userRating,microsoft:userEffectiveRating,microsoft:serviceProvider,microsoft:artistAlbumArtist,microsoft:artistPerformer,microsoft:artistConductor,microsoft:authorComposer,microsoft:authorOriginalLyricist,microsoft:authorWriter,microsoft:sourceUrl,upnp:userAnnotation,upnp:channelName,upnp:longDescription,upnp:programTitle");
}
{
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:ConnectionManager",
"ConnectionManager");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) MS_ConnectionManagerSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
service->SetStateVariable("SinkProtocolInfo", "");
service->SetStateVariable("SourceProtocolInfo", "http-get:*:*:*");
}
return NPT_SUCCESS;
}
示例2:
/*----------------------------------------------------------------------
| PLT_MediaServer::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::SetupServices()
{
PLT_Service* service;
{
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ContentDirectory:1",
"urn:upnp-org:serviceId:ContentDirectory",
"ContentDirectory");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) MS_ContentDirectorywSearchSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("ContainerUpdateIDs", "");
service->SetStateVariableRate("ContainerUpdateIDs", NPT_TimeInterval(2.));
service->SetStateVariable("SystemUpdateID", "0");
service->SetStateVariableRate("SystemUpdateID", NPT_TimeInterval(2.));
service->SetStateVariable("SearchCapability", "upnp:class");
service->SetStateVariable("SortCapability", "");
}
{
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:ConnectionManager",
"ConnectionManager");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) MS_ConnectionManagerSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
service->SetStateVariable("SinkProtocolInfo", "");
service->SetStateVariable("SourceProtocolInfo", "http-get:*:*:*");
}
return NPT_SUCCESS;
}
示例3:
/*----------------------------------------------------------------------
| PLT_Simple::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_Simple::SetupServices()
{
PLT_Service* service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:Test:1",
"urn:upnp-org:serviceId:Test.001",
"Test");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*)SCPDXML_SIMPLE));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("Status", "True");
return NPT_SUCCESS;
}
示例4:
/*----------------------------------------------------------------------
| PLT_LightSampleDevice::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_LightSampleDevice::SetupServices(PLT_DeviceData& data)
{
PLT_Service* service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:SwitchPower:1",
"urn:upnp-org:serviceId:SwitchPower.001");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*)SCPDXML));
NPT_CHECK_FATAL(service->InitURLs("SwitchPower", m_UUID));
NPT_CHECK_FATAL(data.AddService(service));
service->SetStateVariable("Status", "True");
return NPT_SUCCESS;
}
示例5: AddService
/*----------------------------------------------------------------------
| PLT_LightSampleDevice::PLT_LightSampleDevice
+---------------------------------------------------------------------*/
PLT_LightSampleDevice::PLT_LightSampleDevice(char* FriendlyName, char* UUID) :
PLT_DeviceHost("/", UUID, "urn:schemas-upnp-org:device:SwitchPower:1", FriendlyName)
{
PLT_Service* service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:SwitchPower:1",
"urn:upnp-org:serviceId:SwitchPower.001");
if (SCPDXML &&
NPT_SUCCEEDED(service->SetSCPDXML((const char*)SCPDXML))) {
service->InitURLs("SwitchPower", m_UUID);
AddService(service);
} else {
delete service;
}
service->SetStateVariable("Status", "True");
}
示例6: AddService
/*----------------------------------------------------------------------
| PLT_LightSampleDevice::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_LightSampleDevice::SetupServices()
{
NPT_Result res;
PLT_Service* service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:SwitchPower:1",
"urn:upnp-org:serviceId:SwitchPower.001",
"SwitchPower");
NPT_CHECK_LABEL_FATAL(res = service->SetSCPDXML((const char*)SCPDXML), failure);
NPT_CHECK_LABEL_FATAL(res = AddService(service), failure);
service->SetStateVariable("Status", "True");
return NPT_SUCCESS;
failure:
delete service;
return res;
}
示例7: AddService
/*----------------------------------------------------------------------
| PLT_Simple::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_Simple::SetupServices()
{
NPT_Result res;
PLT_Service* service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:Test:1",
"urn:upnp-org:serviceId:Test.001",
"Test");
NPT_CHECK_LABEL_FATAL(res = service->SetSCPDXML((const char*)SCPDXML_SIMPLE), failure);
NPT_CHECK_LABEL_FATAL(res = AddService(service), failure);
service->SetStateVariable("Status", "True");
return NPT_SUCCESS;
failure:
delete service;
return res;
}
示例8: AddService
/*----------------------------------------------------------------------
| PLT_MediaRenderer::PLT_MediaRenderer
+---------------------------------------------------------------------*/
PLT_MediaRenderer::PLT_MediaRenderer(PlaybackCmdListener* listener,
const char* friendly_name,
bool show_ip,
const char* uuid,
unsigned int port) :
PLT_DeviceHost("/", uuid, "urn:schemas-upnp-org:device:MediaRenderer:1", friendly_name, show_ip, port)
{
NPT_COMPILER_UNUSED(listener);
PLT_Service* service;
/* AVTransport */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:AVTransport:1",
"urn:upnp-org:serviceId:AVT_1-0");
if (NPT_SUCCEEDED(service->SetSCPDXML((const char*) RDR_AVTransportSCPD))) {
service->InitURLs("AVTransport", m_UUID);
AddService(service);
service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
// GetCurrentTransportActions
service->SetStateVariable("CurrentTransportActions", "", false);
// GetDeviceCapabilities
service->SetStateVariable("PossiblePlaybackStorageMedia", "vendor-defined ,NOT_IMPLEMENTED,NONE,NETWORK,MICRO-MV,HDD,LD,DAT,DVD-AUDIO,DVD-RAM,DVD-RW,DVD+RW,DVD-R,DVD-VIDEO,DVD-ROM,MD-PICTURE,MD-AUDIO,SACD,VIDEO-CD,CD-RW,CD-R,CD-DA,CD-ROM,HI8,VIDEO8,VHSC,D-VHS,S-VHS,W-VHS,VHS,MINI-DV,DV,UNKNOWN", false);
service->SetStateVariable("PossibleRecordStorageMedia", "vendor-defined ,NOT_IMPLEMENTED,NONE,NETWORK,MICRO-MV,HDD,LD,DAT,DVD-AUDIO,DVD-RAM,DVD-RW,DVD+RW,DVD-R,DVD-VIDEO,DVD-ROM,MD-PICTURE,MD-AUDIO,SACD,VIDEO-CD,CD-RW,CD-R,CD-DA,CD-ROM,HI8,VIDEO8,VHSC,D-VHS,S-VHS,W-VHS,VHS,MINI-DV,DV,UNKNOWN", false);
service->SetStateVariable("PossibleRecordQualityModes", "vendor-defined ,NOT_IMPLEMENTED,2:HIGH,1:MEDIUM,0:BASIC,2:SP,1:LP,0:EP", false);
// GetMediaInfo
service->SetStateVariable("PlaybackStorageMedium", "UNKNOWN", false);
service->SetStateVariable("RecordStorageMedium", "UNKNOWN", false);
service->SetStateVariable("RecordMediumWriteStatus", "UNKNOWN", false);
service->SetStateVariable("NumberOfTracks", "0", false);
service->SetStateVariable("CurrentTrackDuration", "00:00:00", false);
service->SetStateVariable("CurrentMediaDuration", "00:00:00", false);
service->SetStateVariable("NextAVTransportURI", "NOT_IMPLEMENTED", false);
service->SetStateVariable("NextAVTransportURIMetadata", "NOT_IMPLEMENTED", false);
// GetPositionInfo
service->SetStateVariable("AbsTime", "NOT_IMPLEMENTED", false);
service->SetStateVariable("CurrentTrack", "0", false);
service->SetStateVariable("RelativeTimePosition", "00:00:00", false); //??
service->SetStateVariable("AbsoluteTimePosition", "NOT_IMPLEMENTED", false); //??
service->SetStateVariable("RelativeCounterPosition", "0", false); //??
service->SetStateVariable("AbsoluteCounterPosition", "0", false); //??
// GetTransportInfo
service->SetStateVariable("TransportState", "NO_MEDIA_PRESENT", false);
service->SetStateVariable("TransportStatus", "OK", false);
service->SetStateVariable("TransportPlaySpeed", "1", false);
// GetTransportSettings
service->SetStateVariable("CurrentPlayMode", "NORMAL", false);
service->SetStateVariable("CurrentRecordQualityMode", "NOT_IMPLEMENTED", false);
}
/* ConnectionManager */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:CMGR_1-0");
if (NPT_SUCCEEDED(service->SetSCPDXML((const char*) RDR_ConnectionManagerSCPD))) {
service->InitURLs("ConnectionManager", m_UUID);
AddService(service);
service->SetStateVariable("CurrentConnectionIDs", "0", false);
// put all supported mime types here instead
service->SetStateVariable("SinkProtocolInfo", "http-get:*:*:*", false);
service->SetStateVariable("SourceProtocolInfo", "", false);
}
/* RenderingControl */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:RenderingControl:1",
"urn:upnp-org:serviceId:RCS_1-0");
if (NPT_SUCCEEDED(service->SetSCPDXML((const char*) RDR_RenderingControlSCPD))) {
service->InitURLs("RenderingControl", m_UUID);
AddService(service);
service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
}
}
示例9:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::SetupServices()
{
PLT_Service* service;
{
/* AVTransport */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:AVTransport:1",
"urn:upnp-org:serviceId:AVTransport",
"AVTransport",
"urn:schemas-upnp-org:metadata-1-0/AVT/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_AVTransportSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
service->SetStateVariable("A_ARG_TYPE_InstanceID", "0");
// GetCurrentTransportActions
service->SetStateVariable("CurrentTransportActions", "Play,Pause,Stop,Seek,Next,Previous");
// GetDeviceCapabilities
service->SetStateVariable("PossiblePlaybackStorageMedia", "NONE,NETWORK,HDD,CD-DA,UNKNOWN");
service->SetStateVariable("PossibleRecordStorageMedia", "NOT_IMPLEMENTED");
service->SetStateVariable("PossibleRecordQualityModes", "NOT_IMPLEMENTED");
// GetMediaInfo
service->SetStateVariable("NumberOfTracks", "0");
service->SetStateVariable("CurrentMediaDuration", "00:00:00");
service->SetStateVariable("AVTransportURI", "");
service->SetStateVariable("AVTransportURIMetadata", "");;
service->SetStateVariable("NextAVTransportURI", "NOT_IMPLEMENTED");
service->SetStateVariable("NextAVTransportURIMetadata", "NOT_IMPLEMENTED");
service->SetStateVariable("PlaybackStorageMedium", "NONE");
service->SetStateVariable("RecordStorageMedium", "NOT_IMPLEMENTED");
service->SetStateVariable("RecordMediumWriteStatus", "NOT_IMPLEMENTED");
// GetPositionInfo
service->SetStateVariable("CurrentTrack", "0");
service->SetStateVariable("CurrentTrackDuration", "00:00:00");
service->SetStateVariable("CurrentTrackMetadata", "");
service->SetStateVariable("CurrentTrackURI", "");
service->SetStateVariable("RelativeTimePosition", "00:00:00");
service->SetStateVariable("AbsoluteTimePosition", "00:00:00");
service->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
service->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
// disable indirect eventing for certain state variables
PLT_StateVariable* var;
var = service->FindStateVariable("RelativeTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("RelativeCounterPosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteCounterPosition");
if (var) var->DisableIndirectEventing();
// GetTransportInfo
service->SetStateVariable("TransportState", "NO_MEDIA_PRESENT");
service->SetStateVariable("TransportStatus", "OK");
service->SetStateVariable("TransportPlaySpeed", "1");
// GetTransportSettings
service->SetStateVariable("CurrentPlayMode", "NORMAL");
service->SetStateVariable("CurrentRecordQualityMode", "NOT_IMPLEMENTED");
}
{
/* ConnectionManager */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:ConnectionManager",
"ConnectionManager");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_ConnectionManagerSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
// put all supported mime types here instead
service->SetStateVariable("SinkProtocolInfo", "http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_PRO,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_SP_G726,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_FULL,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_MED,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_BASE,http-get:*:audio/L16;rate=44100;channels=1:DLNA.ORG_PN=LPCM,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_PRO,http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM,http-get:*:video/x-ms-asf:DLNA.ORG_PN=VC1_ASF_AP_L1_WMA,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMDRM_WMABASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_FULL,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPLL_BASE,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC_XAC3,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMDRM_WMVSPLL_BASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPML_BASE,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_ASP_L5_SO_G726,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG,http-get:*:audio/mpeg:DLNA.ORG_PN=MP3,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL_XAC3,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG1,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_ASP_L4_SO_G726,http-get:*:audio/L16;rate=48000;channels=2:DLNA.ORG_PN=LPCM,http-get:*:audio/mpeg:DLNA.ORG_PN=MP3X,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPML_MP3,http-get:*:video/x-ms-wmv:*");
service->SetStateVariable("SourceProtocolInfo", "");
}
{
/* RenderingControl */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:RenderingControl:1",
"urn:upnp-org:serviceId:RenderingControl",
"RenderingControl",
"urn:schemas-upnp-org:metadata-1-0/RCS/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_RenderingControlSCPD));
NPT_CHECK_FATAL(AddService(service));
//.........这里部分代码省略.........
示例10:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::SetupServices(PLT_DeviceData& data)
{
PLT_Service* service;
{
/* AVTransport */
service = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:AVTransport:1",
"urn:upnp-org:serviceId:AVT_1-0",
"urn:schemas-upnp-org:metadata-1-0/AVT/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_AVTransportSCPD));
NPT_CHECK_FATAL(service->InitURLs("AVTransport", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(service));
service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
service->SetStateVariable("A_ARG_TYPE_InstanceID", "0");
// GetCurrentTransportActions
service->SetStateVariable("CurrentTransportActions", "Play,Pause,Stop,Seek,Next,Previous");
// GetDeviceCapabilities
service->SetStateVariable("PossiblePlaybackStorageMedia", "NONE,NETWORK");
service->SetStateVariable("PossibleRecordStorageMedia", "NOT_IMPLEMENTED");
service->SetStateVariable("PossibleRecordQualityModes", "NOT_IMPLEMENTED");
// GetMediaInfo
service->SetStateVariable("NumberOfTracks", "0");
service->SetStateVariable("CurrentMediaDuration", "00:00:00");;
service->SetStateVariable("AVTransportURI", "");
service->SetStateVariable("AVTransportURIMetadata", "");;
service->SetStateVariable("NextAVTransportURI", "NOT_IMPLEMENTED");
service->SetStateVariable("NextAVTransportURIMetadata", "NOT_IMPLEMENTED");
service->SetStateVariable("PlaybackStorageMedium", "NONE");
service->SetStateVariable("RecordStorageMedium", "NOT_IMPLEMENTED");
service->SetStateVariable("RecordMediumWriteStatus", "NOT_IMPLEMENTED");
// GetPositionInfo
service->SetStateVariable("CurrentTrack", "0");
service->SetStateVariable("CurrentTrackDuration", "00:00:00");
service->SetStateVariable("CurrentTrackMetadata", "");
service->SetStateVariable("CurrentTrackURI", "");
service->SetStateVariable("RelativeTimePosition", "00:00:00");
service->SetStateVariable("AbsoluteTimePosition", "00:00:00");
service->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
service->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
// disable indirect eventing for certain state variables
PLT_StateVariable* var;
var = service->FindStateVariable("RelativeTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("RelativeCounterPosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteCounterPosition");
if (var) var->DisableIndirectEventing();
// GetTransportInfo
service->SetStateVariable("TransportState", "NO_MEDIA_PRESENT");
service->SetStateVariable("TransportStatus", "OK");
service->SetStateVariable("TransportPlaySpeed", "1");
// GetTransportSettings
service->SetStateVariable("CurrentPlayMode", "NORMAL");
service->SetStateVariable("CurrentRecordQualityMode", "NOT_IMPLEMENTED");
}
{
/* ConnectionManager */
service = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:CMGR_1-0");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_ConnectionManagerSCPD));
NPT_CHECK_FATAL(service->InitURLs("ConnectionManager", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
// put all supported mime types here instead
service->SetStateVariable("SinkProtocolInfo", "http-get:*:*:*");
service->SetStateVariable("SourceProtocolInfo", "");
}
{
/* RenderingControl */
service = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:RenderingControl:1",
"urn:upnp-org:serviceId:RCS_1-0",
"urn:schemas-upnp-org:metadata-1-0/RCS/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_RenderingControlSCPD));
NPT_CHECK_FATAL(service->InitURLs("RenderingControl", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(service));
//.........这里部分代码省略.........
示例11:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::SetupServices()
{
PLT_Service* service;
{
/* AVTransport */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:AVTransport:1",
"urn:upnp-org:serviceId:AVTransport",
"AVTransport",
"urn:schemas-upnp-org:metadata-1-0/AVT/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_AVTransportSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
service->SetStateVariable("A_ARG_TYPE_InstanceID", "0");
// GetCurrentTransportActions
service->SetStateVariable("CurrentTransportActions", "Play,Pause,Stop,Seek,Next,Previous");
// GetDeviceCapabilities
service->SetStateVariable("PossiblePlaybackStorageMedia", "NONE,NETWORK,HDD,CD-DA,UNKNOWN");
service->SetStateVariable("PossibleRecordStorageMedia", "NOT_IMPLEMENTED");
service->SetStateVariable("PossibleRecordQualityModes", "NOT_IMPLEMENTED");
// GetMediaInfo
service->SetStateVariable("NumberOfTracks", "0");
service->SetStateVariable("CurrentMediaDuration", "00:00:00");
service->SetStateVariable("AVTransportURI", "");
service->SetStateVariable("AVTransportURIMetadata", "");;
service->SetStateVariable("NextAVTransportURI", "NOT_IMPLEMENTED");
service->SetStateVariable("NextAVTransportURIMetadata", "NOT_IMPLEMENTED");
service->SetStateVariable("PlaybackStorageMedium", "NONE");
service->SetStateVariable("RecordStorageMedium", "NOT_IMPLEMENTED");
service->SetStateVariable("RecordMediumWriteStatus", "NOT_IMPLEMENTED");
// GetPositionInfo
service->SetStateVariable("CurrentTrack", "0");
service->SetStateVariable("CurrentTrackDuration", "00:00:00");
service->SetStateVariable("CurrentTrackMetadata", "");
service->SetStateVariable("CurrentTrackURI", "");
service->SetStateVariable("RelativeTimePosition", "00:00:00");
service->SetStateVariable("AbsoluteTimePosition", "00:00:00");
service->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
service->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
// disable indirect eventing for certain state variables
PLT_StateVariable* var;
var = service->FindStateVariable("RelativeTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteTimePosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("RelativeCounterPosition");
if (var) var->DisableIndirectEventing();
var = service->FindStateVariable("AbsoluteCounterPosition");
if (var) var->DisableIndirectEventing();
// GetTransportInfo
service->SetStateVariable("TransportState", "NO_MEDIA_PRESENT");
service->SetStateVariable("TransportStatus", "OK");
service->SetStateVariable("TransportPlaySpeed", "1");
// GetTransportSettings
service->SetStateVariable("CurrentPlayMode", "NORMAL");
service->SetStateVariable("CurrentRecordQualityMode", "NOT_IMPLEMENTED");
}
{
/* ConnectionManager */
service = new PLT_Service(
this,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:ConnectionManager",
"ConnectionManager");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_ConnectionManagerSCPD));
NPT_CHECK_FATAL(AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
// put all supported mime types here instead
//service->SetStateVariable("SinkProtocolInfo", "http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_PRO,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_SP_G726,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_FULL,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_MED,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVMED_BASE,http-get:*:audio/L16;rate=44100;channels=1:DLNA.ORG_PN=LPCM,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_PRO,http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM,http-get:*:video/x-ms-asf:DLNA.ORG_PN=VC1_ASF_AP_L1_WMA,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMDRM_WMABASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVHIGH_FULL,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAFULL,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPLL_BASE,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC_XAC3,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMDRM_WMVSPLL_BASE,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPML_BASE,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_ASP_L5_SO_G726,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG,http-get:*:audio/mpeg:DLNA.ORG_PN=MP3,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_PAL_XAC3,http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMAPRO,http-get:*:video/mpeg:DLNA.ORG_PN=MPEG1,http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN,http-get:*:video/x-ms-asf:DLNA.ORG_PN=MPEG4_P2_ASF_ASP_L4_SO_G726,http-get:*:audio/L16;rate=48000;channels=2:DLNA.ORG_PN=LPCM,http-get:*:audio/mpeg:DLNA.ORG_PN=MP3X,http-get:*:video/x-ms-wmv:DLNA.ORG_PN=WMVSPML_MP3,http-get:*:video/x-ms-wmv:*");
service->SetStateVariable("SinkProtocolInfo"
,"http-get:*:*:*"
",xbmc-get:*:*:*"
",http-get:*:audio/mpegurl:*"
",http-get:*:audio/mpeg:*"
",http-get:*:audio/mpeg3:*"
",http-get:*:audio/mp3:*"
",http-get:*:audio/mp4:*"
",http-get:*:audio/basic:*"
",http-get:*:audio/midi:*"
",http-get:*:audio/ulaw:*"
",http-get:*:audio/ogg:*"
",http-get:*:audio/DVI4:*"
",http-get:*:audio/G722:*"
//.........这里部分代码省略.........
示例12:
NPT_Result
GPAC_MediaRenderer::SetupServices(PLT_DeviceData& data)
{
PLT_Service* service;
{
/* AVTransport */
m_pAVService = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:AVTransport:1",
"urn:upnp-org:serviceId:AVT_1-0",
"urn:schemas-upnp-org:metadata-1-0/AVT/");
NPT_CHECK_FATAL(m_pAVService->SetSCPDXML((const char*) RDR_AVTransportSCPD));
NPT_CHECK_FATAL(m_pAVService->InitURLs("AVTransport", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(m_pAVService));
m_pAVService->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));
m_pAVService->SetStateVariable("A_ARG_TYPE_InstanceID", "0");
// GetCurrentTransportActions
m_pAVService->SetStateVariable("CurrentTransportActions", "Play,Pause,Stop,Seek,Next,Previous");
// GetDeviceCapabilities
m_pAVService->SetStateVariable("PossiblePlaybackStorageMedia", "NONE,NETWORK");
m_pAVService->SetStateVariable("PossibleRecordStorageMedia", "NOT_IMPLEMENTED");
m_pAVService->SetStateVariable("PossibleRecordQualityModes", "NOT_IMPLEMENTED");
// GetMediaInfo
m_pAVService->SetStateVariable("NumberOfTracks", "0");
m_pAVService->SetStateVariable("CurrentMediaDuration", "00:00:00");;
m_pAVService->SetStateVariable("AVTransportURI", "");
m_pAVService->SetStateVariable("AVTransportURIMetadata", "");;
m_pAVService->SetStateVariable("NextAVTransportURI", "NOT_IMPLEMENTED");
m_pAVService->SetStateVariable("NextAVTransportURIMetadata", "NOT_IMPLEMENTED");
m_pAVService->SetStateVariable("PlaybackStorageMedium", "NONE");
m_pAVService->SetStateVariable("RecordStorageMedium", "NOT_IMPLEMENTED");
m_pAVService->SetStateVariable("RecordMediumWriteStatus", "NOT_IMPLEMENTED");
// GetPositionInfo
m_pAVService->SetStateVariable("CurrentTrack", "0");
m_pAVService->SetStateVariable("CurrentTrackDuration", "00:00:00");
m_pAVService->SetStateVariable("CurrentTrackMetadata", "");
m_pAVService->SetStateVariable("CurrentTrackURI", "");
m_pAVService->SetStateVariable("RelativeTimePosition", "00:00:00");
m_pAVService->SetStateVariable("AbsoluteTimePosition", "00:00:00");
m_pAVService->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
m_pAVService->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
// disable indirect eventing for certain state variables
//PLT_StateVariable* var;
//var =
m_pAVService->FindStateVariable("RelativeTimePosition");
//if (var) var->DisableIndirectEventing();
//var =
m_pAVService->FindStateVariable("AbsoluteTimePosition");
//if (var) var->DisableIndirectEventing();
//var =
m_pAVService->FindStateVariable("RelativeCounterPosition");
//if (var) var->DisableIndirectEventing();
//var =
m_pAVService->FindStateVariable("AbsoluteCounterPosition");
//if (var) var->DisableIndirectEventing();
// GetTransportInfo
m_pAVService->SetStateVariable("TransportState", "NO_MEDIA_PRESENT");
m_pAVService->SetStateVariable("TransportStatus", "OK");
m_pAVService->SetStateVariable("TransportPlaySpeed", "1");
// GetTransportSettings
m_pAVService->SetStateVariable("CurrentPlayMode", "NORMAL");
m_pAVService->SetStateVariable("CurrentRecordQualityMode", "NOT_IMPLEMENTED");
}
{
/* ConnectionManager */
service = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:upnp-org:serviceId:CMGR_1-0");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_ConnectionManagerSCPD));
NPT_CHECK_FATAL(service->InitURLs("ConnectionManager", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(service));
service->SetStateVariable("CurrentConnectionIDs", "0");
// put all supported mime types here instead
service->SetStateVariable("SinkProtocolInfo", "http-get:*:*:*, rtsp-rtp-udp:*:*:*");
service->SetStateVariable("SourceProtocolInfo", "");
}
{
/* RenderingControl */
service = new PLT_Service(
&data,
"urn:schemas-upnp-org:service:RenderingControl:1",
"urn:upnp-org:serviceId:RCS_1-0",
"urn:schemas-upnp-org:metadata-1-0/RCS/");
NPT_CHECK_FATAL(service->SetSCPDXML((const char*) RDR_RenderingControlSCPD));
NPT_CHECK_FATAL(service->InitURLs("RenderingControl", data.GetUUID()));
NPT_CHECK_FATAL(data.AddService(service));
//.........这里部分代码省略.........