Git Product home page Git Product logo

platinum's Introduction

PLATINUM UPNP SDK

Carthage compatible Build Status

This toolkit consists of 2 modules:

  • Neptune : a C++ Runtime Library
  • Platinum: a modular UPnP Framework [Platinum depends on Neptune]

Unless you intend to use Neptune independently from Platinum, it is recommended that you build binaries directly from the Platinum root directory. All the dependent binaries will be rebuilt automatically (including Neptune).

Building SDK and Sample Applications

Windows:

Open the Visual Studio 2010 solution located @ Build\Targets\x86-microsoft-win32-vs2010\Platinum.sln

OSX, iOS:

First install carthage (https://github.com/Carthage/Carthage)

> brew update || brew install carthage

Build Neptune & Platinum frameworks

> carthage bootstrap
> carthage build --no-skip-current

Both Neptune and Platinum frameworks binaries can be found under Carthage/Build folders which you can link with your applications. Follow the instructions on the carthage page. If you are building for iOS, special instructions here.

If you are interested in building sample apps or tests, you can also open the XCode project file located @ Build/Targets/universal-apple-macosx/Platinum.xcodeproj.

Linux, Cygwin, etc ...

Open a shell, go to the Platinum root directory and type 'scons' (http://scons.org).

> brew update || brew install scons
> git submodule update --init
> scons target={TARGET} build_config={Debug|Release}

The output of the scons build will be found under Build/Targets/{TARGET}/{Debug|Release}. Additionally, the output is copied under Targets/{TARGET}/{Debug|Release} for convenience when applicable.

Running Sample Applications

FileMediaServerTest

This is an example of a UPnP MediaServer. Given a path, it allows a UPnP ControlPoint to browse the content of the directory and its sub-directories. Additionally, files can be streamed (Note that only files with known mimetypes are advertised).

FileMediaServerTest [-f <friendly_name>] <path>
    -f : optional upnp server friendly name
    <path> : local path to serve

Once started, type 'q' to quit.

MediaRendererTest

This is an example shell of a UPnP MediaRenderer. It is to be contolled by a UPnP ControlPoint. This is just a SHELL, this won't play anything yet. You need to hook up the playback functionality yourself.

MediaRendererTest [-f <friendly_name>]
    -f : optional upnp server friendly name

Once started, type 'q' to quit.

MediaCrawler

This is a combo UPnP MediaServer + ControlPoint. It browses content from other MediaServers it finds on the network and present them under one single aggregated view. This is useful for some devices that need to select one single MediaServer at boot time (i.e. Roku).

Once started, type 'q' to quit.

MicroMediaController

This is a ControlPoint (synchronous) that lets you browse any MediaServer using a shell-like interface. Once started, a command prompt lets you enter commands such as:

     quit    -   shutdown
     exit    -   same as quit
     setms   -   select a media server to become the active media server
     getms   -   print the friendly name of the active media server
     ls      -   list the contents of the current directory on the active
                 media server
     cd      -   traverse down one level in the content tree on the active
                 media server
     cd ..   -   traverse up one level in the content tree on the active
                 media server
     pwd     -   print the path from the root to your current position in the
                 content tree on the active media server

Experimental MediaRenderer commands (not yet full implemented):

     setmr   -   select a media renderer to become the active media renderer
     getmr   -   print the friendly name of the active media renderer
     open    -   set the uri on the active media renderer
     play    -   play the active uri on the active media renderer
     stop    -   stop the active uri on the active media renderer

MediaConnect

This is a derived implementation of the FileMediaServerTest with the only difference that it makes it visible to a XBox 360.

MediaServerCocoaTest

A basic cocoa test server app showing how to use the Platinum framework on Mac OSX.

Language Bindings

Objective-C

Under Source/Extras/ObjectiveC

C++/CLR

Under Source/Extras/Managed

Android Java/JNI

To build the JNI shared library, you will need to install the Android NDK and set up the proper environment variables such as ANDROID_NDK_ROOT.

> scons target=arm-android-linux build_config=Release
> cd Source/Platform/Android/module/platinum
> ndk-build NDK_DEBUG=0

This will create the libplatinum-jni.so files under the Source/Platform/Android/module/platinum/libs folder. You can then import eclipse Android .project located @ Source/Platform/Android/modules/platinum to create the jar file @ Source/Platform/Android/modules/platinum/bin/platinum.jar

To Test the Platinum jni layer, import into eclipse both Android projects located @ Source/Platform/Android/samples/sample-upnp & Source/Platform/Android/modules/platinum.

Contributing

We're glad you're interested in Platinum, and we'd love to see where you take it.

Any contributors to the master Platinum repository must sign the Individual Contributor License Agreement (CLA). It's a short form that covers our bases and makes sure you're eligible to contribute.

When you have a change you'd like to see in the master repository, send a pull request. Before we merge your request, we'll make sure you're in the list of people who have signed a CLA.

Thanks!

platinum's People

Contributors

c0diq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platinum's Issues

scons install with msys2

Hi,

I'm trying to run the install with msys2 64 bits, using scons .

When running the install, the version of the python scripts are incompatible with scons python.
From my install I have:
-in msys2 64 bits -

scons --version
SCons by Steven Knight et al.:
        script: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
        engine: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
        engine path: ['/usr/lib/python3.8/site-packages/SCons']
Copyright (c) 2001 - 2019 The SCons Foundation

Then when checking for version of python which scons uses I get: nano /usr/bin/scons and line1 : #!/usr/bin/python .
I have tried to symlink to my python2 install:
(powershell)

cmd /c 'mklink C:\dev\msys64\usr\bin\python2.exe C:\dev\msys64\mingw64\bin\python2.exe'
symbolic link created for C:\dev\msys64\usr\bin\python2.exe <<===>> C:\dev\msys64\mingw64\bin\python2.exe

In msys2: /usr/bin/python2.exe starts python2 that's fine, but changing the first line of scons to #!/usr/bin/python2.exe , or to python2 - with respect to changing the symlink - doesn't work.
The problem seem to come from the fact that the rest of the scons install depends on the directories near the python install - if i get it correctly -.

Can you provide an install for a python vesion > 3.0?

Best,

P

False URL created by Device.getAbsolutePath(String path)

I tried to get an action by using these:
Service service = device.getService("urn:schemas-upnp-org:device:MediaRenderer:1"); Action action = service.getAction("SetAVTransportURI");
Then I found "service" is created but "action" is null. I checked the source code and confirmed it caused by these:

`
// Service.java
private Node getSCPDNode() {
try {

    URL scpdUrl = new URL(rootDev.getAbsoluteURL(scpdURLStr));
		
    scpdNode = getSCPDNode(scpdUrl);		
		
    if (scpdNode != null) {
			
       data.setSCPDNode(scpdNode);
			
       return scpdNode;
		
   }
	
}
...

}
`
it got a false URL by using rootDev.getAbsoluteURL(scpdURLStr), this is what I got:
image
Is is a bug?

windows media player play error

hello,why use windows media player connect mediarendertest show anomalies。The contact surface following chart shows,how to recover the error?
1

It's not stable when I used it in my iOS app..

Hi. I have some trouble when I used Platinum in my iOS app.
I feel it's not stable.
In my app, I have a list to present all devices which have 'AVTransport' service. These devices seem as DMR. But,the list of devices will be refreshed in several seconds because of receive list change notification. Some methods are called frequently, such as "PLT_::OnMRRemoved","PLT_::OnMRAdded"..I don't know what happend.
After that,i suspected network environment.So, I changed network . But it's no help...
Can you replay me when you see this issue?
Thanks for your contribution.

buffer overflow issues caused by using gets

hi, great project!

I found that some places in the code are still using the dangerous function 'gets', which may cause buffer overflows. It seems to be a small problem, but it is better to replace it with a safe function.

https://github.com/plutinosoft/Platinum/blob/master/Source/Tools/SsdpProxy/SsdpProxy.cpp

    fprintf(stdout, "Listening for SSDP unicast packets on port %d\n", Options.port);
    fprintf(stdout, "Enter q to quit\n");

    char buf[256];
    while (gets(buf)) {
        if (*buf == 'q')
            break;
    }

iPhone os 14.6 can't find the Tv device

Hi Sylvain Rebaud

I get a issue while test the library. If DMR start first, DMC cant find the device. you can find it the other way around. and it only happend in my iphone 12, OS 14.6. but Iphone 7 plus with OS 15.1 is ok. so i wonder if Whether the order of joining the network matters.

Thank you for help.

search devices of LAN

Hi i'd like to ask for your help.
I want to add a button to proactive refresh the device list of local area network due to an issue which power down device still in.
could u please teach me how to proactive a boardcast to get the devices list now
thanks for your help
:P

Now on AUR!

Packaged as best I could. Any reason you don't build .so's on GNU/Linux?

Metapackage: https://aur.archlinux.org/pkgbase/neptune «Platinum UPnP SDK + Neptune C++ Runtime by Axiomatic Software»
Providing:

Incompatibility

Hi,
is it not possible to update the SDK to an actual VS Version?
It is very hard to compile the project with VS 2017 or VS 2019.
Maybe you could share the binaries of the Managed Library.
I would like to test this for a private application.

Thank You for your work
Jo A. Kim

deprecated gets used

many of the test programs use gets(), which is deprecated:

 http://www.cplusplus.com/reference/cstdio/gets/ :
 Compatibility
 The most recent revision of the C standard (2011) has definitively removed this function from its specification.
 The function is deprecated in C++ (as of 2011 standard, which follows C99+TC3).

better use gets_s, else, VS2015 and above won't compile.

affected files:
\Platinum\Source\Apps\FrameStreamer\main.cpp
\Platinum\Source\Apps\MediaConnect\main.cpp
\Platinum\Source\Apps\MediaCrawler\main.cpp
\Platinum\Source\Tests\FileMediaServer\FileMediaServerTest.cpp
\Platinum\Source\Tests\LightSample\LightSampleTest.cpp
\Platinum\Source\Tests\MediaRenderer\MediaRendererTest.cpp
\Platinum\Source\Tests\Simple\SimpleTest.cpp

change like this:

  • while (gets(buf)) {
  • while (gets_s(buf,256)) {

Could not find some rendering devices

I found some devices, even though it has responded to the "search" signal and returned the device description, but the process goes to "PLT_CtrlPoint::InspectDevice", but it cannot continue.

Only commented "if (NPT_SUCCEEDED(NPT_ContainerFind(m_PendingInspections,
NPT_StringFinder(uuid),
pending_uuid))) ",
The device description can be parsed correctly, otherwise there will always be some devices in the list sometimes missing.

This problem is prone to occur if some devices send out device description multiple times.

The reason is that after some devices have issued descriptions multiple times, the corresponding number of tasks cannot respond to the descriptions of all devices, resulting in the UUID in the m_PendingInspections table cannot be deleted. In the future, the device whose UUID is not deleted in m_PendingInspections, even if it is not in the mRootDevice table, can no longer process its description and add it to the table, resulting in some devices that cannot be searched until it is restarted.

PltHttpServer.cpp have “PathTraversal” Vulnerability

I audit the code and found a problem,the problem code is in:Platinum/blob/master/Source/Core/PltHttpServer.cpp,line 193
if ((file_path.Find("/..") >= 0) || (file_path.Find("\\..") >= 0) || NPT_FAILED(NPT_File::GetInfo(file_path, &file_info))) { return NPT_ERROR_NO_SUCH_ITEM; }
the function to prevent pathtraversal is not enough:(file_path.Find("/..") >= 0)
in the PltFileMediaServer.cpp line 364 the function ExtractResourcePath:
NPT_Ordinal skip = 0; if (uri_path.StartsWith(m_UrlRoot)) { skip = m_UrlRoot.GetLength(); } else if (uri_path.StartsWith(url_root_encode)) { skip = url_root_encode.GetLength(); } else { return NPT_FAILURE; } /* account for extra slash */ skip += ((m_UrlRoot=="/")?0:1); file_path = uri_path.SubString(skip);

we know if victim's root directory is:
/home/sanpangzi/mediaserver/
if an attacker post a GET request as:
http://localhost:40009/home/sanpangzi/mediaserver/../test.mp3
the variable "file_path" is "../test.mp3"
and the filter function Find("/..") could not match "../" so cause PathTraversal Vulnerability

we suggest the code as fallows:

if ((file_path.Find("../") >= 0) || (file_path.Find("..\") >= 0) `

Issues on build android x64

Hi,

I mod file platinum/Build/Targets/arm-android-linux/config.scons as follow:

set defaults

ANDROID_ARCH = 'arm64'
ANDROID_PLATFORM = 'android-24'
ANDROID_TOOLCHAIN = 'arm-linux-androideabi-4.9'
ANDROID_CROSS_PREFIX = 'arm-linux-androideabi'

and compile use these command:

env NPT_CONFIG_NO_CRYPTO=1 NPT_CONFIG_NO_SSL=1 scons target=arm-android-linux build_config=Release
ndk-build NDK_DEBUG=0 NPT_CONFIG_NO_SSL=1

build arm64-v8a fail:

czbill@ubuntu:~/Develop/WirelessScreen/Dlna/Platinum/Source/Platform/Android/module/platinum$ ndk-build NDK_DEBUG=0 NPT_CONFIG_NO_SSL=1
Android NDK: WARNING: APP_PLATFORM android-24 is larger than android:minSdkVersion 19 in ./AndroidManifest.xml
[arm64-v8a] Compile++ : platinum-jni <= platinum-jni.cpp
[arm64-v8a] SharedLibrary : libplatinum-jni.so
jni/../../../../../../Build/Targets/arm-android-linux/Release/libPlatinum.a: error adding symbols: File in wrong format
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/arm64-v8a/libplatinum-jni.so] Error 1

How to solve?

FileMediaServerTest couldn'r run

Mac OS: 10.15
while excute FileMediaServerTest, message
$ ./FileMediaServerTest
-bash: ./FileMediaServerTest: cannot execute binary file"

setVolume timeout

SetVolume function fast, about one second one time, Timeout occurred
LOG info below:
2019-11-06 16:57:36.256 32213-32213/com.cdel.acc.dlna I/EasyMediaController: setVolume into. vol=12
2019-11-06 16:57:36.258 32213-32560/com.cdel.acc.dlna D/Neptune: [SendRequestOnce] FINE: requesting URL http://192.168.98.42:37198/RenderingControl/BF-TV-DMR-3F0EED7C/control.xml
2019-11-06 16:57:36.258 32213-32560/com.cdel.acc.dlna D/Neptune: [SendRequestOnce] FINE: calling connector (proxy:no) (http 1.1:yes) (url:http://192.168.98.42:37198/RenderingControl/BF-TV-DMR-3F0EED7C/control.xml)
2019-11-06 16:57:36.258 32213-32560/com.cdel.acc.dlna D/Neptune: [Connect] FINE: looking for a connection to reuse
2019-11-06 16:57:36.258 32213-32560/com.cdel.acc.dlna D/Neptune: [Connect] FINE: reusing connection
2019-11-06 16:57:36.258 32213-32560/com.cdel.acc.dlna D/Neptune: [SendRequestOnce] FINE: got connection (reused: true)
2019-11-06 16:57:36.262 32213-32560/com.cdel.acc.dlna D/Neptune: [WriteRequest] FINE: sending body stream, 363 bytes
2019-11-06 16:57:36.472 32213-32560/com.cdel.acc.dlna D/Neptune: [FindServer] FINE: Device (BF-TV-DMR-3F0EED7C) not found in our list of servers
2019-11-06 16:57:36.472 32213-32560/com.cdel.acc.dlna I/EasyMediaController: OnSetVolumeResult into.
2019-11-06 16:57:47.686 32213-32448/com.cdel.acc.dlna D/Neptune: [Parse] WARNING: NPT_CHECK failed, result=-20014 (NPT_ERROR_TIMEOUT) [(stream.ReadLine(line, NPT_HTTP_PROTOCOL_MAX_LINE_LENGTH))]
2019-11-06 16:57:47.686 32213-32448/com.cdel.acc.dlna D/Neptune: [ReadResponse] FINE: NPT_CHECK failed, result=-20014 (NPT_ERROR_TIMEOUT) [(result)]
2019-11-06 16:58:11.339 32213-32428/com.cdel.acc.dlna D/Neptune: [Cleanup] FINE: cleaning up connection (1 remain)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.