Giter Site home page Giter Site logo

upnpx's People

Contributors

al-zonke avatar basti2310 avatar bluegaspode avatar brunokeymolen avatar carloslozano avatar chouquette avatar dhrebeniuk avatar dmappgroup avatar edrflt avatar ened avatar fkuehne avatar gpinigin avatar haseebyf avatar jasperfioole21 avatar jstart avatar lightbow avatar master-nevi avatar messi avatar mikanbu avatar mikyl avatar nathanpeles avatar plashchynski avatar ptiz avatar squarefrog avatar xaphod 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

upnpx's Issues

Finding XBMC

When demo project loads, it find some of the UPnP devices however does't find the running XBMC.

ssdp.cpp crashes with SIGPIPE when returning from background

I have allowed my app to run in the background, which works fine. I do however experience a SIGPIPE call when returning.

Steps to reproduce

  • Play some music
  • Move into the background
  • After the last track stops, wait 5 minutes
  • Open the app up again
  • Go back to the root view controller, where [[manager SSDP] searchSSDP]; is called in viewWillAppear:
  • App crashes on [line 431[(https://github.com/fkuehne/upnpx/blob/master/src/ssdp/ssdp.cpp#L431).

I understand this issue is related to writing to a broken socket. I am unable to stop the SSDP server, as I observing UPnP events (transport changes etc.)

I believe this may be a simple fix of ignoring SIGPIPE exceptions, based on this stackoverflow answer. I'm going to test this this morning and submit a PR.

@fkuehne feel free to raise any concerns about this in this discussion.

deathlock

deathlock with this lock
UPNP::GetInstance()->GetSSDP()->GetDB()->Lock();

tow functions have this issue
int SSDPSearchResp::Process(struct sockaddr* sender, std::vector<SSDP_HTTP_HEADER*> msgheaders)
int SSDPNotifyAlive::Process(struct sockaddr* sender, std::vector<SSDP_HTTP_HEADER*> msgheaders)

its call:
mDB->Lock();
and call:
mDB->DeviceUpdate(device);

mDB->DeviceUpdate(device); also call:UPNP::GetInstance()->GetSSDP()->GetDB()->Lock();

the deathlock appear

can you also find this issue?

Crash in LastChangeParser.m

Selecting a MediaRenderer in the upnpx demo app causes an exception to be raised (EXC_BAD_ACCESS code=1 address =0x18) on line 61 of LastChangeParser.m
NSString *value = elementAttributeDict[@"val"];

Thread 17:
[LastChangeParser propertyName:]
Queue:reentrantAvoidanceQueue (serial)

State of locals:
self is not null;
startStop = @"ElementStop"
name = nil;
value = nil;

The exception always occurs with ElementStop.

2014-09-19 18:26:11.278 upnpxdemo[71447:8661656] close=stateVariable
2014-09-19 18:26:11.278 upnpxdemo[71447:8661656] close=serviceStateTable
2014-09-19 18:26:11.278 upnpxdemo[71447:8661656] close=scpd
2014-09-19 18:26:11.422 upnpxdemo[71447:8661656] open=propertyset
2014-09-19 18:26:11.422 upnpxdemo[71447:8661656] open=property
2014-09-19 18:26:11.422 upnpxdemo[71447:8661656] open=LastChange
2014-09-19 18:26:11.422 upnpxdemo[71447:8661656] close=LastChange
2014-09-19 18:26:11.422 upnpxdemo[71447:8661664] open=Event
2014-09-19 18:26:11.423 upnpxdemo[71447:8661664] open=InstanceID
2014-09-19 18:26:11.423 upnpxdemo[71447:8661664] open=TransportState
2014-09-19 18:26:11.423 upnpxdemo[71447:8661664] close=TransportState
(exception occurs here).

Crash

Hi,
I got a crash report from an user:
UPnPDB.m line 317 :
Fatal Exception: NSInvalidArgumentException
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil

By reading the code, this seems quite impossible

    while( [readyForDescription count] > 0){
        upnpdevice = readyForDescription[0];
        //fill the upnpdevice with info from the XML
        int ret = [upnpdevice loadDeviceDescriptionFromXML];
        if(ret == 0){
            [self lock];
            //NSLog(@"httpThread upnpdevice, location=%@", [upnpdevice xmlLocation]);

            //This is the only place we add devices to the rootdevices
            [rootDevices addObject:upnpdevice];
            [self unlock];
        }
        [readyForDescription removeObjectAtIndex:0];

    }

Any idea of what could be the problem ? I guess it has to do with asynchronous update of readyForDescription array ... Between the while test and upnpdevice assignment, readyForDescription may have changed !

Suggestion for more logs in the demo app

I have changed the UPnPDBUpdated as follows. Might be useful for others.

-(void)UPnPDBUpdated:(UPnPDB*)sender{
    NSLog(@"UPnPDBUpdated %lu", (unsigned long)[mDevices count]);
    NSMutableString *txt = [NSMutableString new];
    for (int i = 0; i<mDevices.count; i++) {
        BasicUPnPDevice *device = mDevices[i];
        [txt appendFormat:@"-----\n[%i] %@:\n\turn=[%@]\n\turl=[%@]\n\tmodel=[%@/%@]\n", i, [device friendlyName],
              device.urn,
              device.baseURLString,
              device.modelName?device.modelName:@"-",
              device.modelDescription?device.modelDescription:@"-"
              ];
        for (NSString *key in device.services.keyEnumerator) {
            BasicUPnPService *srv = device.services[key];
            //commented out because seem to hold null in all fields but ssdpdevice which we expand
            //  in the next print
            //[txt appendFormat:@"srv %@: url=[%@], evntUrl=[%@], srvType=[%@], stateVars=[%@], ssdpDevice=[%@], soap=[%@]", key, srv.baseURLString, srv.eventURL, srv.serviceType, srv.stateVariables, srv.ssdpdevice, srv.soap];
            SSDPDBDevice_ObjC *dev = srv.ssdpdevice;
            [txt appendFormat:@"SSDPDBDevice %@:\n\thost=[%@]\n\tip=[%i]\n\tloc=[%@]\n\tport=[%i]\n\ttype=[%@]\n\tuuid=[%@]\n", dev.urn, dev.host, dev.ip, dev.location, dev.port, dev.type, dev.uuid];
        }
    }
    NSLog(@"%@", txt);
    [menuView performSelectorOnMainThread : @ selector(reloadData) withObject:nil waitUntilDone:YES];
}

class BasicHTTPServer not complete?

bool bret = observer->Response(&returnCode, &headers, &body, &bodyLen);

if(body){
    free(body);
}

What about the body? Just simply ignored it?

When event subscriptions timeout, the app no longer forwards events to subscribers.

When you subscribe for notifications, upnpx will subscribe for 1800 seconds (30 minutes). After that time has passed, the app no longer forwards any event notifications. This should not happen as -[UPnPEvents ManageSubscriptionTimeouts:] (here) is called once per minute.

In this method, subscriptions due to expire in the next 300 seconds (5 minutes) are refreshed using -[BasicUPnPService SubscriptionTimerExpiresIn: timeoutSubscription: timeSubscription] (here).

The issue with this though is when the subscription is renewed, the link to the original subscribed object is broken.

Steps to reproduce

  1. Change the default timeout to something smaller in UPnPEvents.m:

    [urlRequest setValue:@"Second-180" forHTTPHeaderField:@"TIMEOUT"]; // 3 minutes

  2. Create a playlist with 2 or more songs, over 3 minutes in length

  3. Choose a renderer

  4. Observe changes to the renderer transport state with:

    [[self.renderer avTransportService] addObserver:(BasicUPnPServiceObserver *)self];

  5. Play music and notice the UPnP events are no longer forwarded to - (void)UPnPEvent: events: after the subscription renews

I've added a bunch of breakpoints to log this behaviour and it seems like the event is being picked up by UPnPEvents. But then there are no event subscribers present in this line:

ObserverEntry *entry = mEventSubscribers[uuid];

Crashes when selecting a renderer on 64bit

When selecting a renderer on a 64bit device, an exception is raised: EXC_BAD_ACCESS (code=EXC_I386_GPFLT). The debugger points at this line as causing the exception.

Setting a breakpoint just before this and doing po elementAttributeDict reveals something has gone wrong assigning the variable. It is not of type NSMutableDictionary, like it is in 32-bit mode.

I don't know if this is just a simulator issue, or if it exists on devices too as I don't have a 5S.

Version 1.3.2?

Hi there, I see there are some good fixes since v1.3.1 and I was just curious if there was going to be a v1.3.2 any time soon. Thanks in advance. Cheers.

iOS 9 / Xcode 7 Bitcode compatibility

Yesterday the GM for iOS 9 was released and we tried to build our app with the current setup and dependencies with Xcode 7 to make sure everything works. It turns out we have a couple of pods which don't work well with Bitcode. One of them is upnpx.

When you try to build a app with Xcode 7 which includes the upnpx pod it will fail with the following error ld: -weak_library and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Are you planing to fix this issue?

Build tvOS Target error

I build project with tvos target. I got unpnx.framework
I copied to my project and added to framework, when i build, i got error message
upnpx/src/api/BasicUPnPService.h:40:9: 'UPnPServiceConstants.h' file not found
I use swift language

It's possible to get erroneous results from BasicParser

As mentioned in #35, I have a block of code executing batched background fetching of all the upnp media items in a list. If I tap into an album while the batch fetching is still taking place, instead of the view displaying the Albums child items, I get a list of 20 objects from the previous operation.

This is a fairly extreme example, as generally you don't want to fetch all objects at once, but it does bring up an interesting issue. Why is SoapAction or BasicParser returning stale data?

Show lifecycle management in iOS demo

The demo should show how to start the SSDP server and any background threads when app is active and shutdown the server and threads when it becomes inactive. Right now, the RootViewController is starting the server. But I didn't see any code to shutdown the server and threads.

Crash in BasicParser.m when running on background thread

After updating to 1.3.0 I'm constantly getting crashes in BasicParser.m when performing operations on a background thread (for example BrowseWithObjectID).

Most of the time: EXC_BAD_ACCESS (code=1, address=0x18) in line 92. Sometimes an exception is raised: 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x7f986847a2d0> was mutated while being enumerated.' in BasicParser getAssetForElementStack.

I can avoid this by executing the operation on main thread which renders my UI unresponsive.

parsing trips up when given two <res> objects

When using an old LG NAS drive, I have noticed that the parser stores the wrong resource entity. Given the following example:

<item id="30373" refID="30370" parentID="30319" restricted="1">
  <upnp:class>object.item.audioItem.musicTrack</upnp:class>
  <dc:title>The Number Of The Beast</dc:title>
  <dc:date>2013-05-07T06:54:36</dc:date>
  <upnp:albumArtURI dlna:profileID="JPEG_TN">http://192.168.1.60:49815/thumbnail/13061.tn.jpg</upnp:albumArtURI>
  <upnp:icon>http://192.168.1.60:49815/thumbnail/13061.icon.jpg</upnp:icon>
  <dc:creator>Iron Maiden</dc:creator>
  <upnp:artist>Iron Maiden</upnp:artist>
  <upnp:album>A Real Dead One</upnp:album>
  <upnp:genre>Metal</upnp:genre>
  <upnp:originalTrackNumber>1</upnp:originalTrackNumber>
  <upnp:playbackCount>0</upnp:playbackCount>
  <res duration="0:04:59.000" size="4793584" protocolInfo="http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000">http://192.168.1.60:49815/webdir/30373.mp3</res>
  <res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_OP=01;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=00f00000000000000000000000000000" resolution="160x160">http://192.168.1.60:49815/thumbnail/13061.tn.jpg</res>
</item>

When printing the objects attributes, it's clear that the second <res> element has overwritten the first:

(lldb) po self.protocolInfo
http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_OP=01;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=00f00000000000000000000000000000

(lldb) po self.uri
http://192.168.1.60:49815/thumbnail/13061.tn.jpg

Thankfully, both resources are stored in the uriCollection property, but it does make me wonder if the item.uri convenience property should favour media items?

Memory leaks in BasicParser.m

BasicParser.m uses the old memory manual memory management system for Objective-C instead of ARC, so it's easy to make changes and accidentally forget a "release" or two. Here are four instances uncovered by the static analyzer:

Line 98 calls elementStack = [stack copy] with no subsequent release
Line 99 calls assets = [mAssets copy] with no subsequent release
Lines 163 and 185 call NSString *xml = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; with no subsequent release

upnpx retrieves incomplete protocol info when browsing.

When browsing using upnpx I don't get the full protocol info for each track.

upnpx

Request Headers

POST /ContentDirectory/control HTTP/1.1
Host: 10.54.6.186:50001
Content-Type: text/xml;charset="utf-8"
Connection: keep-alive
SOAPACTION: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
Accept: */*
User-Agent: iOS UPnP/1.1 UPNPX/1.3.1
Content-Length: 504
Accept-Language: en-us
Accept-Encoding: gzip, deflate

Request Body

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <s:Body>
    <u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
      <ObjectID>22$299</ObjectID>
      <BrowseFlag>BrowseDirectChildren</BrowseFlag>
      <Filter>*</Filter>
      <StartingIndex>0</StartingIndex>
      <RequestedCount>20</RequestedCount>
      <SortCriteria>+upnp:album,+upnp:originalTrackNumber,+dc:title</SortCriteria>
    </u:Browse>
  </s:Body>
</s:Envelope>

Response

<?xml version="1.0"?>
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:sec="http://www.sec.co.kr/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/">
  <item id="22$@9017" parentID="22$299" restricted="1">
    <dc:title>What Do You Do For Money Honey</dc:title>
    <upnp:class>object.item.audioItem.musicTrack</upnp:class>
    <dc:date>2009-01-01</dc:date>
    <upnp:album>Greatest Hell's Hits (Disc 1)</upnp:album>
    <upnp:albumArtist>AC/DC</upnp:albumArtist>
    <upnp:artist>ACDC</upnp:artist>
    <dc:creator>ACDC</dc:creator>
    <upnp:genre>Rock</upnp:genre>
    <upnp:originalTrackNumber>13</upnp:originalTrackNumber>
    <upnp:albumArtURI dlna:profileID="JPEG_TN">http://10.54.6.186:50002/transcoder/jpegtnscaler.cgi/ebdart/9017.jpg</upnp:albumArtURI>
    <res protocolInfo="http-get:*:audio/x-flac:*" size="27745455" bitrate="127500" duration="0:03:37.000" nrAudioChannels="2" sampleFrequency="44100">http://10.54.6.186:50002/m/NDLNA/9017.flac</res>
  </item>

///// .....

</DIDL-Lite>

BubbleUPNP

Request Headers

POST /ContentDirectory/control HTTP/1.1
Content-type: text/xml;charset="utf-8"
Soapaction: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
Content-Length: 474
Host: 10.54.6.186:50001
Connection: Keep-Alive
User-Agent: Android/4.4.3 UPnP/1.0 BubbleUPnP/2.3.1

Request Body

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <s:Body>
    <u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
      <ObjectID>22$299</ObjectID>
      <BrowseFlag>BrowseDirectChildren</BrowseFlag>
      <Filter>*</Filter>
      <StartingIndex>0</StartingIndex>
      <RequestedCount>16</RequestedCount>
      <SortCriteria/>
    </u:Browse>
  </s:Body>
</s:Envelope>

Response

<?xml version="1.0"?>
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:sec="http://www.sec.co.kr/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/">
  <item id="22$@9005" parentID="22$299" restricted="1">
    <dc:title>What Do You Do For Money Honey</dc:title>
    <upnp:class>object.item.audioItem.musicTrack</upnp:class>
    <dc:date>2009-01-01</dc:date>
    <upnp:album>Greatest Hell's Hits (Disc 1)</upnp:album>
    <upnp:albumArtist>AC/DC</upnp:albumArtist>
    <upnp:artist>ACDC</upnp:artist>
    <dc:creator>ACDC</dc:creator>
    <upnp:genre>Rock</upnp:genre>
    <upnp:originalTrackNumber>13</upnp:originalTrackNumber>
    <upnp:albumArtURI dlna:profileID="JPEG_TN">http://10.54.6.186:50002/transcoder/jpegtnscaler.cgi/ebdart/9017.jpg</upnp:albumArtURI>
    <res protocolInfo="http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000" size="27745455" bitrate="127500" duration="0:03:37.000" nrAudioChannels="2" sampleFrequency="44100">http://10.54.6.186:50002/m/NDLNA/9017.flac</res>
  </item>

///// .....

</DIDL-Lite>

Looking at the <res protocolInfo> property you can clearly see the differences.

upnpx

http-get:*:audio/x-flac:*

BubbleUPnP

http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000

Why is this an issue?

Without setting the flags, the renderer has no idea that the server is capable of supporting file resuming. You can read more on the flags and what they mean here.

Support for IPv6-only networks

Apple announced that starting with 1st of June 2016 all apps must support IPv6 only networks.
Is there any chance to have this in upnpx too?

Should update the official cocoa pods repository entry

https://github.com/GoLdO/CocoaPods-Specs/blob/master/upnpx/1.2.4/upnpx.podspec

=> this really should point here.

Pod::Spec.new do |s|
  s.name     = 'upnpx'
  s.version  = '1.2.4'
  s.license  = 'BSD'
  s.summary  = 'Open Source Mac OS X / iOS Cocoa UPnP Stack.'
  s.homepage = 'http://code.google.com/p/upnpx/'
  s.authors  = { 'Bruno Keymolen' => '[email protected]' }
  s.source   = { :git  => 'https://github.com/fkuehne/upnpx.git' }

  s.description = 'Static OS X & iOS UPnP library written in Cocoa (UPnP) and C++ (SSDP).' \
    'The Current implementation has support for control point/client only.'

  s.ios.source_files =  'src/{api,common,eventserver,ssdp,upnp}/*.{h,m,mm,c,cpp}', 'src/port/ios/*.{h,m}'
  s.osx.source_files =  'src/{api,common,eventserver,ssdp,upnp}/*.{h,m,mm,c,cpp}', 'src/port/macos/*.{h.m}'
  s.xcconfig         =  { 'OTHER_LDFLAGS' => '-lstdc++' }
end

Question about uuid string with "uuid:" or not ?

I'm confused about the uuid string content.
Should it be initiated with "uuid:" ?

In my case, I found out that in UPnPDB.m
-(NSArray_)getSSDPServicesForUUID:(NSString_)uuid
below is In this function:
if( [uuid isEqual:[ssdpdevice uuid]]){
[services addObject:ssdpdevice];//change string to service
NSLog(@"debug uuid is match");
}else{
NSLog(@"debug ssdpdevice uuid= %@ ",[ssdpdevice uuid]);
}
the [ssdpdevice uuid] is initiated with "uuid:" , but sometime not.
Therefore the function always return null.

And in BascicUPnPDevice.m the function
-(void)syncServices
below is In this function
NSArray *ssdpservices = [[[UPnPManager GetInstance] DB] getSSDPServicesForUUID:uuid];

In this line, the uuid is not initiaied with "uuid:" , it's only number likes "898f9738-d930-4db4-a3cf-020000000000"

Therefore , the ssdpservices has nothing. so my BasicUPnPService will not be initial.
I'm just wondering which one is correct , with "uuid:" or not ?
By the way , I use uShare(libupnp) to make iPhone as upnp server.

Thanks

locking and unlocking some iPads Play events are resuming only if i uncomment the log in SocketServer::ReadLoop

I am using Upnpx 1.3.6 playing an upnp event locking the ipad i am stopping the ssdp and after unlocked starting the ssdp again But the event is not playing unless i uncomment the log in SocketServer::ReadLoop method while (mReadLoop) For the first time lock/unlock scenario it is working fine but for the second time onwards i have to uncomment the following log
printf("mServerSocket=%d, highSocket=%d, sizeof(mReadFDS)=%d\n", mServerSocket,highSocket,sizeof(mReadFDS)); in SocketServer::ReadLoop,,Any one Please suggest some solution why i am getting this strange behaviour

PlayBack Events not work

I update one project based on upnpx 1.2
With 1.3.x i have this issue:
Play from server to render starts and plays ok, but on external stop or end of track stop , no events is triggered in new code. Too no playing / transitioning or other events....
I test it on demo app too and makes no difference. Breakpoint in observer UPnPEvent PlayBack.m never occur.

I need help where is trouble.?

Using copy attribute in @property causes crash

The MediaServerBasicObjectParser interface declares various NSMutableArray properties like this:

@property (nonatomic, copy) NSMutableArray *creators;
@property (nonatomic, copy) NSMutableArray *authors;
@property (nonatomic, copy) NSMutableArray *directors;

They are initialized as follows:

self.creators = [NSMutableArray new];

Unfortunately, copying a mutable array will create a immutable array - NSArray. This will cause crash in the following line because addObject is not a selector of NSArray:

- (void)setCreator: (NSString *)value
{
    [self.creators addObject:value];
}

Quickest way to fix the problem is to change the copy attribute to retain:

@property (nonatomic, retain) NSMutableArray *creators;
@property (nonatomic, retain) NSMutableArray *authors;
@property (nonatomic, retain) NSMutableArray *directors;

But, I don't know the code good enough to say if that will have some other implications.

MediaServer Unable to play any music and video

Hello fkuehne,

I am using TVMOBiLi dlna server software in my mac machine.
I am able to get the list of playlist,but when i am trying to play any music and video,It is not playing or showing any response

I am getting a log

20141014 130024_14Oct.m4a - 8309, 01:58:01.000, 0, 58842782, 7081, http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000

Volume Channel Event overwrite in UPnPEventParser

The Eventing for different volume channels does not work as expected because the volume entries of different channels are overwriting each other in the UPnPEventParser. This is due the fact, that only the xml tag name and val attribute are getting analysed and the volume property is always equal to the last entry in the list.

Example (Setting Master Volume to 5):

<LastChange>
<Event xmlns="urn:schemas-upnp-org:metadata-1-0/RCS/">
<InstanceID val="0">
<Volume channel="Master" val="5"/>
<Volume channel="LF" val="100"/>
<Volume channel="RF" val="100"/>
</InstanceID>
</Event>
</LastChange>

modelName & modelNumber removed?

It seems the latest upnpx version got these two fields removed from the BasicUPnPDevice class.
In some use cases this might be very useful. Is there a reason it got removed?

Invalid Socket Error

Hi,

I am getting this error when using this library in Xcode 7.

FOUND thisaddress->ifa_name:en1
address in use start error
Invalid Socket.

Please help.

UPnP observer not informed of events

I have an issue with a particular renderer, where 90% of the time it's events fail to parse. I can see the events coming in through basichttpserver.cpp, but this method seems to be causing an issue:

ret = thisSession->AddData(buf, (unsigned int)len);

On this particular renderer I never seem to get a 0 return value, so observer inform code is never called.

(lldb) p ret
(int) $3 = 2294
(lldb) 

@fkuehne any suggestions where to start debugging this? I don't know C++ so I'm just poking at things and seeing what sticks!

Multiple Artists within XML

Currently there is no handling of multiple Artist tags from a XML within MediaServerBasicObjectParser. The last one will always be used which can lead to the case where the artist-property contains the composer instead of the artists. For example the following xml-extract (shortened) from an album tagged with itunes:

<item>
 <dc:title>Autobahn</dc:title>
 <upnp:genre>Electronica</upnp:genre>
 <upnp:album>Autobahn</upnp:album>
 <upnp:originalTrackNumber>1</upnp:originalTrackNumber>
 <dc:creator>Kraftwerk</dc:creator>
 <upnp:artist>Kraftwerk</upnp:artist>
 <pv:extension>m4a</pv:extension>
 <upnp:albumArtist>Kraftwerk</upnp:albumArtist>
 <upnp:author role="Composer">Ralf Hütter, Florian Schneider, Emil Schult</upnp:author>
 <upnp:artist role="Composer">Ralf Hütter, Florian Schneider, Emil Schult</upnp:artist>
</item>

So in this the artist 'Kraftwerk' will always been overwritten because of the occurrence of the second artist-tag.

OrderedDictionary header misplaced

It looks like the OrderedDictionary header was removed from Headers/Public/upnpx/ in the last update. This wouldn't generate compiler errors for some people, but if users added a custom soap action subclass with the xml->subclass generator tool (https://code.google.com/p/upnpx/wiki/TutorialNewDevice), the change would break their projects. These subclasses end up in the user's project, and so need to be able to #import "OrderedDictionary.h". (Looks like OrderedDictionary.h is a stray header file left in Pods/upnpx/src/upnp/)

When device goes online->offline->online, it gets added multiple times on uPNP

I just updated from 1.3.6 to 1.4.0a2. I'm not sure if this is a new issue but I think it is.

If I connect my Canon T6i camera, disconnect it, and reconnect it... then repeat this process so that the camera has connected 4 times, then I see that on the 4th time the camera connects it logs the same connection 4 times. In other words something is not being removed where it should be....?

2016-11-02 17:28:06.772136 Photobooth[409:68183] [UPnP] Sync Service (Canon EOS Rebel T6i). Adding urn:schemas-canon-com:service:ICPO-SmartPhoneEOSSystemService:1
2016-11-02 17:28:06.773017 Photobooth[409:68183] [UPnP] Sync Service (Canon EOS Rebel T6i). Adding urn:schemas-canon-com:service:ICPO-SmartPhoneEOSSystemService:1
2016-11-02 17:28:06.774860 Photobooth[409:68183] [UPnP] Sync Service (Canon EOS Rebel T6i). Adding urn:schemas-canon-com:service:ICPO-SmartPhoneEOSSystemService:1
2016-11-02 17:28:06.775148 Photobooth[409:68183] [UPnP] Sync Service (Canon EOS Rebel T6i). Adding urn:schemas-canon-com:service:ICPO-SmartPhoneEOSSystemService:1

Reloading data

In the RootViewController.m, the UPnPDBUpdated: method s trying to refresh the display using menuView. It's not clear what the menuView does because it has never been initialized anywhere. All the method needs to do is reload the table view like this:

-(void)UPnPDBUpdated:(UPnPDB*)sender{
NSLog(@"UPnPDBUpdated %d", [mDevices count]);
[self.tableView reloadData];
}

Not receiving all events

I'm subscribing for a service but I'm not reliably receiving all the events. When I check all traffic with Wireshark I can see events that are incoming but are not always registering with the observer.

Is anybody else experiencing this?

Update Tag

@fkuehne fancy bumping the tag to 1.3.1 and I'll update the pod?

git tag 1.3.1
git push --tags

Infinite loop on socketserver.cpp ReadLoop

I'm using version 1.3.0 of upnpx to play content from a Twonky server to an xbmc raspberry pi through an ios app. I got problem at the very beginning of the play to sequence (listing renderer & subscribe to avtransportservice).
It appears that the select() of the socketServer::Readloop method never get clean FDS for the write events (writeFDS are not handled), causing the while to loop on select() and the thread to go 100% CPU.

Adding this code to socketserver.cpp looks to clean write connections.
349,350d347
< }else if(FD_ISSET(thisSocket, &mWriteFDS)){
< connection->isActive = false;

Wrong Protocols

Hey,

I've been working on Mobile VR Station for iOS and UPNP is a mini nightmare of compatibility issues.

I have a client whos trying to watch MP4 content from their UPNP router and for some reason their video comes back as Protocol:
"http-get:*:audio/vnd.dlna.adts:DLNA.ORG_PN=AAC_ADTS;DLNA.ORG_OP=01;DLNA.ORG_PS=1;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000"

when it should be Protocol: "http-get:*:video/mp4"

Is there something I need to send to the server so it won't treat my device as an audio player? The file still plays if they copy the link and stream it.

Crash in tools.cpp line 90: trimspaces->righttrim()

Hi there,
Thanks for upnpx, it's really useful.
I wonder if you can fix this bug for me... it's a crash in tools.cpp at line 90, which is the while statement below:

u32 righttrim(u8* buf, u32 len){
    if(len==0){
        return len;
    }
    u8* pos = buf+len-1;
    while(pos>=buf && *pos==' '){
        pos--;
    }
    return (unsigned int)((pos-buf)+1);
}

I see this crash with 2 occurrences from a single installation of my iOS app, via Parse crashreporting. Here's the full stack that I have...

Thread 10 (crashed)
0
Photobooth
trimspaces(unsigned char**, unsigned int*) @ 0x4, tools.cpp : 90
1
Photobooth
SSDPParser::Parse(sockaddr*, unsigned char*, unsigned int) @ 0x8, ssdpparser.cpp : 165
2
Photobooth
SSDP::IncommingMessage(sockaddr*, unsigned char*, unsigned int) @ 0x10, ssdp.cpp : 406
3
Photobooth
SSDP::ReadLoop() @ 0x8, ssdp.cpp : 370
4
Photobooth
SSDP::sReadLoop(void*) @ 0x0, ssdp.cpp : 455
5
libsystem_pthread.dylib
_pthread_body @ 0xa0
6
libsystem_pthread.dylib
_pthread_start @ 0x9c
7
libsystem_pthread.dylib
thread_start @ 0x0

Here are the other two threads from upnpx in case this helps:

Thread 6
0
libsystem_kernel.dylib
__select @ 0x8
1
Photobooth
SocketServer::ReadLoop() @ 0xc, socketserver.cpp : 287
2
Photobooth
SocketServer::sReadLoop(void*) @ 0x0, socketserver.cpp : 383
3
libsystem_pthread.dylib
_pthread_body @ 0xa0
4
libsystem_pthread.dylib
_pthread_start @ 0x9c
5
libsystem_pthread.dylib
thread_start @ 0x0


Thread 7
0
libsystem_kernel.dylib
__semwait_signal @ 0x8
1
libsystem_c.dylib
nanosleep @ 0xd4
2
libsystem_c.dylib
sleep @ 0x2c
3
Photobooth
SSDPDB::CacheControlLoop() @ 0x0, ssdpdb.cpp : 264
4
Photobooth
SSDPDB::sCacheControlLoop(void*) @ 0x0, ssdpdb.cpp : 294
5
libsystem_pthread.dylib
_pthread_body @ 0xa0
6
libsystem_pthread.dylib
_pthread_start @ 0x9c
7
libsystem_pthread.dylib
thread_start @ 0x0


Thread 8
0
libsystem_kernel.dylib
__semwait_signal @ 0x8
1
libsystem_c.dylib
nanosleep @ 0xd4
2
libsystem_c.dylib
sleep @ 0x2c
3
Photobooth
-[UPnPDB httpThread:] @ 0x0, UPnPDB.m : 320
4
Foundation
__NSThread__main__ @ 0x42c
5
libsystem_pthread.dylib
_pthread_body @ 0xa0
6
libsystem_pthread.dylib
_pthread_start @ 0x9c
7
libsystem_pthread.dylib
thread_start @ 0x0

thanks!

Upnpx slow on SSDP discover, or ignoring SSDP discover replies

I noticed this in the latest upnpx in this fork. When using it in my code and also with the included sample, devices responding to SSDP discover packets do not show up. They do show up after a couple minutes when a notify is received or possibly a stalled discover response is finally processed. I've stepped through the code and upnpx sees the replies, but the notification to the observer never seems to go out.

The discovery packets and responses were verified with Wireshark.

Other forks of upnpx do not show this problem. This happens on both a native iOS device and in the simulator in iOS 7. If there's something specific you need from me to trace this, let me know.

Unable to build with iOS 8 & 7 as deployment target

If I set the deployment target for the demo project to 7 or 8 I get a lot of errors concerning the C++ files.

"Undefined symbols for architecture i386:
"std::string::find(char const_, unsigned long) const", referenced from:
SSDPNotifyAlive::Process(sockaddr_, std::vector<SSDP_HTTP_HEADER*, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpnotifyalive.o)
SSDPSearchResp::Process(sockaddr_, std::vector<SSDP_HTTP_HEADER_, std::allocator<SSDP_HTTP_HEADER*> >) in libupnpx.a(ssdpsearchresp.o)
"std::string::c_str() const", referenced from:
"

And I have deleted i386 and 64_x86 as valid architectures from the library project

BasicUPnPDevice missing presentationURL property

According to the Basic device template, there should be a "presentationURL" property in the device data. This is currently not extracted from the XML, and is not made available as a property of BasicUPnPDevice.

Designated Initializer invoked a non-designated initializer

When building on Xcode 6.2 with the new upnpx 1.3.2, I get a ton of warnings about designated initializers. Looking at the code, the warnings are justified because subclass-overrides of the designated initializer are indeed calling the non-designated initializer on the superclass, for example BasicServiceParser uses this
-(instancetype)initWithUPnPDevice:(BasicUPnPDevice*)upnpdevice{ self = [super init];
even though basicParser.h (the superclass) anoints this
-(instancetype)initWithNamespaceSupport:(BOOL)namespaceSupport NS_DESIGNATED_INITIALIZER;

While the changes don't seem to break anything at runtime (yet) because [super init] is indeed redirecting back through the designated initializer with -(instancetype)init { return [self initWithNamespaceSupport:NO]; } the whole point of NS_DESIGNATED_INITIALIZER is to make things safer, and it should be adopted completely or not at all.

Here are the rules from the docs:

To clarify the distinction between designated and designated initializers clear, you can add the NS_DESIGNATED_INITIALIZER macro to any method in the init family, denoting it a designated initializer. Using this macro introduces a few restrictions:

  • The implementation of a designated initializer must chain to a superclass init method (with [super init...]) that is a designated initializer for the superclass.
  • The implementation of a convenience initializer (an initializer not marked as a designated initializer within a class that has at least one initializer marked as a designated initializer) must delegate to another initializer (with [self init...]).
  • If a class provides one or more designated initializers, it must implement all of the designated initializers of its superclass.

This problem exists with both the BasicParser and the SoapAction class hierarchy.

[Discussion] Update for more modern network calls

Note: this is a discussion rather than an issue.

Upnpx is currently pretty feature complete and rich, but is starting to show its age a little. One of the biggest components of this is the use of synchronous network calls. I understand why this was used, but I think a more modern approach would be asynchronous.

My biggest issue with synchronous calls is how it blocks the main thread while it waits for a response. This may not be an issue with a small library on a fast local network, it becomes a huge issue when you have an extensive library on an older device such as the WD My Life hard drive running Twonky.

The other advantage to asynchronous calls would be lazy loading table views. We could fetch the first 30 objects and add them to the data source, then further fetch batches as the user scrolls.

Now, this is by no means a trivial task - and could create some API breaking changes, so I suppose the decision needs to be made whether it's advantages outweigh the disadvantages.

Cleartext HTTP (http://) resource load since it is insecure

There is an worning on new XCode 7 and iOS 9.2:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

It shows like a warning, but it causes that the rootDevices array is always empty.

It's due to a new security restrictions about HTTP https://developer.apple.com/videos/play/wwdc2015-711/

A possible solution is to add an exception (just like described in the message) to Info.plist file; however, maybe there's a permanent solution?

Not Getting all UPNP Device

i am trying with media server, but not getting all the media server. Some packets has been lots. Also it take lots of time to brows.
Please help me

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.