Exemple #1
0
/*----------------------------------------------------------------------
|   PLT_MediaConnect::SetupServices
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::SetupServices(PLT_DeviceData& data)
{
    m_RegistrarService = new PLT_Service(
        &data,
        "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1", 
        "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar");

    NPT_CHECK_FATAL(m_RegistrarService->SetSCPDXML((const char*) X_MS_MediaReceiverRegistrarSCPD));
    NPT_CHECK_FATAL(m_RegistrarService->InitURLs("X_MS_MediaReceiverRegistrar", data.GetUUID()));
    NPT_CHECK_FATAL(data.AddService(m_RegistrarService));
    
    m_RegistrarService->SetStateVariable("AuthorizationGrantedUpdateID", "0");
    m_RegistrarService->SetStateVariable("AuthorizationDeniedUpdateID", "0");
    m_RegistrarService->SetStateVariable("ValidationSucceededUpdateID", "0");
    m_RegistrarService->SetStateVariable("ValidationRevokedUpdateID", "0");

    return PLT_FileMediaServer::SetupServices(data);
}
Exemple #2
0
/*----------------------------------------------------------------------
|   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));

        service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));

        service->SetStateVariable("Mute", "0");
        service->SetStateVariable("Volume", "100");
    }

    return NPT_SUCCESS;
}
Exemple #3
0
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));

        service->SetStateVariableRate("LastChange", NPT_TimeInterval(0.2f));

        service->SetStateVariable("Mute", "0");
        service->SetStateVariable("Volume", "100");
    }

    {
static NPT_UInt8 MIGRATION_SCPDXML[] = "<scpd xmlns=\"urn:schemas-upnp-org:service-1-0\">\
    <serviceStateTable>\
        <stateVariable>\
            <name>MigrationStatus</name>\
            <sendEventsAttribute>no</sendEventsAttribute>\
            <dataType>string</dataType>\
            <allowedValueList>\
                <allowedValue>OK</allowedValue>\
                <allowedValue>ERROR_OCCURRED</allowedValue>\
            </allowedValueList>\
        </stateVariable>\
        <stateVariable>\
            <name>MigrationMetaData</name>\
            <sendEventsAttribute>no</sendEventsAttribute>\
            <dataType>string</dataType>\
        </stateVariable>\
        <stateVariable>\
            <name>A_ARG_TYPE_InstanceID</name>\
            <sendEventsAttribute>no</sendEventsAttribute>\
            <dataType>ui4</dataType>\
        </stateVariable>\
    </serviceStateTable>\
    <actionList>\
        <action>\
            <name>StopForMigration</name>\
            <argumentList>\
                <argument>\
                    <name>InstanceID</name>\
                    <direction>in</direction>\
                    <relatedStateVariable>A_ARG_TYPE_InstanceID</relatedStateVariable>\
                </argument>\
                <argument>\
                    <name>MigrationStatus</name>\
                    <direction>out</direction>\
                    <relatedStateVariable>MigrationStatus</relatedStateVariable>\
                </argument>\
                <argument>\
                    <name>MigrationMetaData</name>\
                    <direction>out</direction>\
                    <relatedStateVariable>MigrationMetaData</relatedStateVariable>\
                </argument>\
            </argumentList>\
        </action>\
    </actionList>\
</scpd>";

        /* MigrationService */
        m_pMigrationService = new PLT_Service(&data, "urn:intermedia:service:migration:1", "urn:intermedia:service:migration.001");

		NPT_CHECK_FATAL(m_pMigrationService->SetSCPDXML((const char*) MIGRATION_SCPDXML));
        NPT_CHECK_FATAL(m_pMigrationService->InitURLs("SessionMigration", data.GetUUID()));
        NPT_CHECK_FATAL(data.AddService(m_pMigrationService));

        m_pMigrationService->SetStateVariable("MigrationStatus", "OK");
        m_pMigrationService->SetStateVariable("MigrationMetaData", "");
    }

    return NPT_SUCCESS;
}