4thline / cling Goto Github PK
View Code? Open in Web Editor NEWUPnP/DLNA library for Java and Android
UPnP/DLNA library for Java and Android
All the code of Cling should be inspected to not rely on the default locale or default encoding and explictely use "UTF-8" if appropriate. This include at least (but probably not limited):
Action implementation code (for example a MediaServer Browse() action) should be able to check if the action has been aborted for example if:
The action code should be able to call a function that return true if the action has been cancelled (or a function that throw InterruptedException).
It should work for both local and remote actions.
Use case:
Browse() action on a Media Server can be a long operation taking several seconds.
Currently, a remote client may choose to close the connection, aborting the action, but the Browse() action processing continue to execute for nothing.
See ReceivingAction.throwIfCancelled() for an example implementation using thread local storage:
https://github.com/bubbleguuum/cling/blob/ffc9bdd1e438ed85707694904aca4a376b588861/core/src/main/java/org/fourthline/cling/protocol/sync/ReceivingAction.java
issue is described here
http://mailinglists.945824.n3.nabble.com/NullPointerException-td3511964.html
if (s == null) {
throw new InvalidValueException("Service type is null");
}
Some variables documented in the spec are missing in class org.teleal.cling.support.avtransport.lastchange.AVTransportVariable, e.g. RelativeTimePosition and AbsoluteTimePosition. This makes it difficult to use the LastChangeParser to read these variables.
Hi !
Cling seems to be a Maven build. However it can not be found from the central Maven repository.
Would it be too much to ask to upload it there, so it could be found using the "fourthline" and/or "cling" keywords and easily attached to other maven projects without having to download the JAR ? or is there something to prevent this?
Some of the constructor-based startup routine has unresolved dependencies, cleanup when introducing @Inject startup code:
http://mailinglists.945824.n3.nabble.com/rare-NPE-on-start-td3078213.html
When trying to build any of the Cling projects with Maven, this error occurs:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site (default-cli) on project cling-core: SiteToolException: ArtifactNotFoundException: The skin does not exist: Failure to find org.fourthline.site:fourthline-skin:jar:1.0 in http://4thline.org/m2 was cached in the local repository, resolution will not be reattempted until the update interval of 4thline-repo has elapsed or updates are forced
I cloned git source and built workbench. I got messages below when running standalong jar.
JarClassLoader: Warning: Null manifest from input stream associated with: lib/javax.inject-1.jar
JarClassLoader: Warning: javax/interceptor/InvocationContext.class in lib/ejb-api-3.0.jar is hidden by lib/jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar (with different bytecode)
Jan 18, 2012 5:05:46 PM org.jboss.weld.bootstrap.WeldBootstrap
INFO: WELD-000900 1.1.1 (Final)
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.simontuffs.onejar.Boot.run(Boot.java:340)
at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.RuntimeException: Error handling file /workbench/target/cling-workbench-2.0-SNAPSHOT-standalone.jar
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handleArchiveByFile(FileSystemURLHandler.java:97)
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handle(FileSystemURLHandler.java:68)
at org.jboss.weld.environment.se.discovery.url.URLScanner.scan(URLScanner.java:117)
at org.jboss.weld.environment.se.discovery.url.WeldSEUrlDeployment.(WeldSEUrlDeployment.java:42)
at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:128)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:81)
at org.fourthline.cling.workbench.Workbench.(Workbench.java:38)
... 6 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:127)
at java.util.zip.ZipFile.(ZipFile.java:144)
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handleArchiveByFile(FileSystemURLHandler.java:85)
... 12 more
Add to the documentation how to return an error message in an action:
@UpnpAction
public String doAction() throws ActionException {
throw new ActionException(ErrorCode.INVALID_ARGS, "That's not right!");
}
We should create a new StrictUPnpConfiguration with the specification-compliant processors/binders and switch the DefaultUpnpConfiguration to the more lenient recovering alternatives.
There's a bug in NetworkAddressFactoryImpl.isInSubnet() if netmask /8 == ip.length (for example if netmask=32, which I've seen happening).
An ArrayIndexOutOfBoundsException is thrown on the last line.
The fix is to check for this case:
while (prefix >= 8 && i < ip.length) {
...
}
if(i == ip.length) return true; // added line
JettyUpnpServiceConfiguration and ApacheUpnpServiceConfiguration
Cling versions: 1.05, 1.1, 2.0
Android Devices/OS Versions:
The crash is easy to reproduce by turning WiFi Off and then On really quickly (i have used the default Android widget at the home screen).
09-18 10:42:06.820: E/AndroidRuntime(29918): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x8000010 (has extras) } in org.teleal.cling.android.AndroidWifiSwitchableRouter$1@425dac90
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Handler.handleCallback(Handler.java:615)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Handler.dispatchMessage(Handler.java:92)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Looper.loop(Looper.java:137)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-18 10:42:06.820: E/AndroidRuntime(29918): at java.lang.reflect.Method.invokeNative(Native Method)
09-18 10:42:06.820: E/AndroidRuntime(29918): at java.lang.reflect.Method.invoke(Method.java:511)
09-18 10:42:06.820: E/AndroidRuntime(29918): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-18 10:42:06.820: E/AndroidRuntime(29918): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-18 10:42:06.820: E/AndroidRuntime(29918): at dalvik.system.NativeStart.main(Native Method)
09-18 10:42:06.820: E/AndroidRuntime(29918): Caused by: org.teleal.cling.transport.SwitchableRouterImpl$RouterLockAcquisitionException: Failed to acquire router lock: WriteLock
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.transport.SwitchableRouterImpl.lock(SwitchableRouterImpl.java:211)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.transport.SwitchableRouterImpl.lock(SwitchableRouterImpl.java:219)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.android.AndroidWifiSwitchableRouter.enable(AndroidWifiSwitchableRouter.java:97)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.android.AndroidWifiSwitchableRouter$1.onReceive(AndroidWifiSwitchableRouter.java:59)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
09-18 10:42:06.820: E/AndroidRuntime(29918): ... 9 more
my app doesn't in a wifi network environment, but local network(ip: 192.168.10.193). and my app can ping wifi gateway success(gateway: 192.168.6.168). my expectation is that searching DLNA devices on 192.168.6.168 network. but it failed. Can cling can resolove this issue? thanks.
We have used Cling for a prototype project relying on the Wi-Fi P2P android interface.
It is not supported yet but a quick workaround was to modify in the class org.teleal.cling.android.AndroidNetworkAddressFactory the method:
public static NetworkInterface getRealWifiNetworkInterface(WifiManager manager)
A wifi direct interface always has the term p2p
along with its network interface name (this is identified by inspecting different wifi direct enable devices and many users and blogs suggest the same).
So this method code is altered in such a way that it loops through all available network interfaces until it finds one with name p2p
.
Once found it will be returned as the network interface. If not any other available interface is returned.
A reliable support of Wi-Fi P2P probably needs more work as other classes may be affected.
-environment:
two or more SAME android devices
Under Android 2.2
-target source:
org.teleal.cling.model.types.UDN.java
public static UDN uniqueSystemIdentifier(String salt) {
java.net.InetAddress i = java.net.InetAddress.getLocalHost();
systemSalt.append(i.getHostName()).append(i.getHostAddress());
// Android always returns "localhost" and "127.0.0.1", not "192.168.0.xxx"
-more details:
http://mailinglists.945824.n3.nabble.com/Same-Android-Devices-Couldn-t-Discovery-Because-Same-UDN-Created-tp3808695p3808695.html
From ICS onwards doing any network operation in main thread will throw an exception. We need to change the onDestroy() of AndroidUpnpServiceImpl to asynchronously call svc.shutdown.
@OverRide
public void onDestroy() {
new Shutdown().execute(upnpService);
}
/**
The type system is mapping 1:n between Java and UPnP types, in some places. It needs to be n:m.
http://mailinglists.945824.n3.nabble.com/Short-java-type-incompatible-with-IntegerDataType-td2996406.html
http://mailinglists.945824.n3.nabble.com/X-MS-MediaReceiverRegistrar-and-int-State-variable-td3066928.html
I'll try to use XBMC as DMR and apparently XBMC supports a protocol xbmc-get.
Since the enum Protocol doesn't know about this protocol, it is nullified with Protocol.valueOrNullOf(String) and can't be stringified subsequently in ProtocolInfo.toString().
Evaluate existing work, decide on feature set.
DLNA attributes should not be wrapped in DIDLObject.Property but in DIDLObject.Attribute.
I am new to cling api. My issue is below.
I have to display a loading progress i.e ( 10 of 100 ) loaded . if the media server is not providing the content item within 1min. my question is how should i upgrade the loading one by one i.e( 11 of 100 ) loaded, (12 of 100 )loaded .. and so on..
Please do help me ..
Probably means changing the Callback API.
I'm using a EyeTV's Netstream SAT streamer in the network which descriptor doesn't seem to be digestable for cling 1.0:
WARNING: Could not hydrate device or its services from descriptor: (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:4df40997-9cd4-66d2-011b-3c0a00e6ded7, Descriptor: http://10.0.0.169:49152/description.xml, Root: true
Feb 19, 2013 5:23:01 PM org.teleal.cling.protocol.RetrieveRemoteDescriptors describe
Can't parse service type string (namespace/type/version): urn:schemas-microsoft-com:service:pbda:tuner:1
It would be nice to have a way to validate/filter the remote devices that cling discovers.
For example a FilterProvider that the Router or Register could be receive and run for every device before adding it to the register.
It would be nice to be able to call "portforward -lan 10.0.0.2 -lanPort 1234 -wanPort 80" from the CLI.
Got this stack trace. We need to catch and return 0 for this exception in cling
java.lang.NumberFormatException: 01.000
at java.lang.Long.parse(Long.java:353)
at java.lang.Long.parseLong(Long.java:344)
at java.lang.Long.parseLong(Long.java:311)
at org.teleal.cling.model.ModelUtil.fromTimeString(ModelUtil.java:189)
at org.teleal.cling.support.model.PositionInfo.getTrackElapsedSeconds(PositionInfo.java:143)
at org.teleal.cling.support.model.PositionInfo.getElapsedPercent(PositionInfo.java:151)
at com.android.myapp.avtransport.AVTransportController$4.received(AVTransportController.java:191)
at org.teleal.cling.support.avtransport.callback.GetPositionInfo.success(GetPositionInfo.java:47)
at org.teleal.cling.controlpoint.ActionCallback.run(ActionCallback.java:156)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
thanks,
-D
WMP12 "Play to" will disable volume controls with Cling renderers.
WMP12 doesn't like "retval" tags found in the RenderingControl service XML generated by class UDA10ServiceDescriptorBinderImpl.
It is safe to not include this tag for all services (most other service XML definitions from other UPnP software do not include it):
private void generateActionArgument(ActionArgument actionArgument, Document descriptor, Element actionElement) {
Element actionArgumentElement = appendNewElement(descriptor, actionElement, ELEMENT.argument);
appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.name, actionArgument.getName());
appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.direction, actionArgument.getDirection().toString().toLowerCase());
appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.relatedStateVariable, actionArgument.getRelatedStateVariableName());
/*
// WMP will disable the RenderingControl Service with this tag
if (actionArgument.isReturnValue()) {
appendNewElement(descriptor, actionArgumentElement, ELEMENT.retval);
}
*/
}
All of the following discussion threads should be added to the FAQ, remove URL from list when done:
http://mailinglists.945824.n3.nabble.com/Runtime-Exception-during-locking-td3487332.html
Almost done with OSGi integration.
http://mailinglists.945824.n3.nabble.com/building-cling4osgi-td2794551.html
Several were found, the synchronization in the GENA code needs to be rewritten.
http://mailinglists.945824.n3.nabble.com/rare-Deadlock-between-Registry-thread-and-ending-SubcriptionCallback-td3272876.html
http://mailinglists.945824.n3.nabble.com/Another-deadlock-in-variable-eventing-td3162154.html
Using cling on an android system this exception was reported through Google Play
Exception class java.lang.NullPointerException
Source method IncomingSubscribeResponseMessage.getSubscriptionDurationSeconds()
java.lang.NullPointerException
at org.fourthline.cling.model.message.gena.IncomingSubscribeResponseMessage.getSubscriptionDurationSeconds(IncomingSubscribeResponseMessage.java:47)
at org.fourthline.cling.protocol.sync.SendingRenewal.executeSync(SendingRenewal.java:85)
at org.fourthline.cling.protocol.sync.SendingRenewal.executeSync(SendingRenewal.java:42)
at org.fourthline.cling.protocol.SendingSync.execute(SendingSync.java:55)
at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)
While being in Service, (especially in ContentDirectoryService) it's sometimes needed to be aware of address of client that is now connected. Other related information is the interface that the client connected to (machine can have two or more interfaces, and that makes it hard to return appropriate resource address).
IncomingActionRequestMessage should have two methods: getLocalAddress and GetRemoteAddress .
-environment:
two or more android devices connect on Wi-Fi Direct each other
run cling, then IP address always returns zero
-target source:
org.teleal.cling.android.AndroidNetworkAddressFactory.java
public static NetworkInterface getRealWifiNetworkInterface(WifiManager manager) {
//....
int wifiIP = manager.getConnectionInfo().getIpAddress();
// when device connectd by Wi-Fi Direct, getIpAddress () is always returns "0"
//....
-more details:
http://mailinglists.945824.n3.nabble.com/Cling-couldn-t-get-IP-address-on-Android-Wi-Fi-Direct-network-td3740102.html
The one-jar bundles no longer work, Weld scanning fails on nested JARs.
Then there is this:
http://mailinglists.945824.n3.nabble.com/Weld-and-Cling-Support-td3400102.html
Investigate the bugfix/workaround on the Android issue tracker, so far it seems only applicable to HTTPs requests.
http://mailinglists.945824.n3.nabble.com/Android-and-reverse-DNS-lookup-issues-td3011461.html
http://mailinglists.945824.n3.nabble.com/Hanging-UI-thread-on-Android-td2482785.html
In the class org.fourthline.cling.support.model.TransportStatus the status ERROR_OCCURRED is misspelled as ERROR_OCCURED (notice the missing 'R'). This causes the last change parser to fail when attempting to parse this transport status.
the class org.fourthline.cling.support.avtransport.impl.state.Playing should pass the type parameter to the superclass. Currently, the class definition reads:
public abstract class Playing<T extends AVTransport> extends AbstractState {
it should however be:
public abstract class Playing<T extends AVTransport> extends AbstractState<T> {
the same goes for class Stopped.
It's probably rare but if enabling it is easy...
Currently only WLAN is configured, used, and tested.
Hack patches here:
http://mailinglists.945824.n3.nabble.com/Patch-to-support-ethernet-in-cling-td3301540.html
http://mailinglists.945824.n3.nabble.com/Compile-Cling-Core-from-source-td3999287.html#a4000748
Is there known issue with seek? I am getting an error back :
current state of service prevents invoking that action. Action method invocation failed: Invalid int: "REL_COUNT". (HTTP response was 500 Internal Server Error)
All other commands are fine, including setURI, play, stop, pause ... etc.
I am occasionally seeing the exception below when my app terminates after bein launched from the IDE (i.e., in strict mode). Interestingly, it does not happen all the time, and I assume it wont happen in a production environment which doesnt impose strict mode. Still, the underlying issue seems to exist.
OS: Android 4.03
Device: ASUS EeePad Transformer
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)
at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at com.bubblesoft.org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149)
at com.bubblesoft.org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:110)
at com.bubblesoft.org.apache.http.impl.io.SocketInputBuffer.isDataAvailable(SocketInputBuffer.java:121)
at com.bubblesoft.org.apache.http.impl.AbstractHttpClientConnection.isStale(AbstractHttpClientConnection.java:310)
at com.bubblesoft.org.apache.http.impl.conn.AbstractClientConnAdapter.isStale(AbstractClientConnAdapter.java:174)
at com.bubblesoft.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:406)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:821)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:942)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:920)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:911)
at org.fourthline.cling.transport.impl.apache.StreamClientImpl.sendRequest(StreamClientImpl.java:137)
at org.fourthline.cling.transport.RouterImpl.send(RouterImpl.java:282)
at org.fourthline.cling.transport.SwitchableRouterImpl.send(SwitchableRouterImpl.java:211)
at org.fourthline.cling.protocol.sync.SendingUnsubscribe.executeSync(SendingUnsubscribe.java:55)
at org.fourthline.cling.protocol.SendingSync.execute(SendingSync.java:55)
at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:44)
at org.fourthline.cling.registry.RemoteItems.shutdown(RemoteItems.java:306)
at org.fourthline.cling.registry.RegistryImpl.shutdown(RegistryImpl.java:385)
at org.fourthline.cling.UpnpServiceImpl.shutdown(UpnpServiceImpl.java:131)
at org.fourthline.cling.android.AndroidUpnpServiceImpl.onDestroy(AndroidUpnpServiceImpl.java:101)
at android.app.ActivityThread.handleStopService(ActivityThread.java:2389)
... 10 more
Previously reported here: http://code.google.com/p/bwgz-org/issues/detail?id=1
What steps will reproduce the problem?
The expected behaviour: An event serviceChanged(ServiceEvent.UNREGISTERING) should be thrown to the ServiceListener which is not happening.
Version: 2.0-SNAPSHOT as of nov.9 2011, on felix.
In org.fourthline.cling.osgi.basedriver.discover.ClingRegistryListener:122, there is context.ungetService(data.getServiceReference());
In order to correctly throw events, it has to call ServiceRegistration.unregister().
I slightly modified UPnPDeviceBinding to keep registration instead of reference and it's working.
Old 1.1 sourcecode is available as an attachment of the original issue, but no changes have been made and is applicable to 2.0.
When VirtualBox is installed on the same computer running Cling, Cling will mistakenly identify the virtual interface created by VirtualBox as usable. Once it does, Cling seems to be unable to successfully discover any upnp sources. Cling already filters out an interface if it is identified as being created by vmware. This is the same situation. Just a different vm software. I corrected the issue by performing a check for the VirtualBox interface and skipping it if it is detected. The code change was in NetworkAddressFactoryImpl.isUsableNetworkInterface().
This is the code that was added to fix it:
if (iface.getName().toLowerCase().startsWith("virtualbox") ||
(iface.getDisplayName() != null && iface.getDisplayName().toLowerCase().contains("virtualbox"))) {
log.finer("Skipping network interface (VirtualBox): " + iface.getDisplayName());
return false;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.