Page 1 of 5

AVRemote 0.4.1

PostPosted: Fri Apr 15, 2011 8:31 am
by jaromil
re all

A new software component for media players is available, called AVRemote

AVRemote official homepage is on http://syncstarter.org/avremote

The latest release 0.4.1 is out since 13 March and adds the feature of playback of FTP URLs, fixes discovery and correct error return and renames the 'get' command to 'status'.

Terminal snapshot:
Code: Select all
AVRemote 0.4.1 - send AVTransport commands to UPNP media services

Syntax: avremote [options] [command] [args...]

Commands:

discover    scan for upnp devices on the network
load        load a file and prepare it for playback
mode        set playback mode (NORMAL or REPEAT_ONE)
play        start playing the selected file
pause       pause currently running playback
stop        stop playback and return to menu
status      print the current status of the device
jump        seek to a position in time (00:00:00)

none means load and play URL, or use - to read xml from stdin

Options:

-s          network address or hostname of the media server
-p          port on which the UPNP AVTransport daemon is listening
-t          dry run to test without a server (print out rendered xml)

-h          print this help
-v          version information for this tool


AVRemote aims to provide a free and open source (GNU GPL) minimalist (C language) and portable (x86 and MIPS targets) implementation for a commandline tool that sends AVTransport commands to UPNP media player services. Rather than using XML parsing, this software uses a string template approach to produce commands as fast as possible, to lower latency and make it possible to synchronize operations.

AVRemote is not a graphical application, but it can be freely used by GUI developers for their creations:
for instance in shell scripts, PHP, mobile phone devices and what not...

Freshmeat project page: http://freshmeat.net/projects/avremote

Stable releases and binaries: http://files.dyne.org/avremote

Code repository: http://code.dyne.org/avremote

Bug tracker, issues, contributions welcome on GitHub and this forum.

Thanks go to Zoster for upnp-cmd, B-Rad for...ever, Recliq for debugging and the whole WDLXTV community for useful pointers found right on these forums.

ciao

Re: AVRemote 0.1

PostPosted: Sat Apr 16, 2011 2:41 am
by recliq
This looks nice, going to test it later today.

Thanks for another neat app!

I'm curious if this is noticable faster than upnp-cmd... ;)

Re: AVRemote 0.1

PostPosted: Sat Apr 16, 2011 3:29 am
by jaromil
Cheers recliq

you'll see speed is there 8-) mostly because execution of a small binary with no library dependencies and compiled from C is taking way less time to fire up than a php-cli interpreter on a script.
For HDSync i need even more responsiveness to achieve synced playback on multiple players: for that i think i'll use the good ol' play/pause/play trick inside the same C code, so there is no reopening of a tcp socket, which is also a bottleneck.

All in all I have no big plans for AVRemote, but I'm happy to maintain it and integrate fixes, maybe even make it into a library so that people can embed it in other software.
One more thing I'd love to see in it is the possibility to load stream URIs: hints on code/scripts to generate valid meta tags for their AVTransportURI is very welcome.
Also I did not manage to make Seek work, not even using upnp-cmd: again clues are very welcome, I've seen a plugin MediaControl2 which can do seek but still need to look into its code.

At last by testing AVRemote I've finally understood how to make UPNP commands work from start: just kill dmaosd :twisted:
Maybe you knew this already, yet it took me a while to realize how to get rid of that. Now i guess my Invisible OSD is obsolete.

p.s. for your testing convenience i'm uploading just now a MIPSel binary to be run from a shell on the WDLXTV, you'll find it on the FTP repository.

Re: AVRemote 0.1

PostPosted: Sat Apr 16, 2011 4:31 am
by recliq
I get a 403 Forbidden on the binary...

As for your problems with playing files when dmaosd is running...
You have to set metainfo for movies to get played in foreground. Have a look at upnp-meta script.

PS: Haven't had a look at your code yet, if you already do this ignore this comment ;)

PPS: regarding the seek problem, have you tried experimenting with different ip for sending requests? sometimes it can make a difference if the reqest is sent from 127.0.0.1 (localhost) or actual network ip... (also just a guess)

Re: AVRemote 0.1

PostPosted: Sat Apr 16, 2011 5:06 am
by jaromil
re: metainfo - yes i do that already using the UPNP_META_FORMAT template you see in http://code.dyne.org/index.cgi?url=avremote/tree/src/avremote.h which is coming from upnp-meta indeed. still the OSD won't go away and the movie will play in background. FWIW I've noticed that, if I play a video using the remote right after boot, subsequent UPNP play commands will make the OSD go away. however this is just to mention the issue, it doesn't affects me at all since i simply want no OSD at all.

re: seek yes i've tried both from localhost and remote

Re: AVRemote 0.1

PostPosted: Sat Apr 16, 2011 5:27 am
by recliq
Bugreport:
Long file paths cause truncated meta info in <CurrentURI> tag.

Example:
Code: Select all
# ./avremote -t load /tmp/media/usb/Movies/english/The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD/The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD-CD1.avi
dry run: printint out rendered upnp message without establishing connection
send upnp header wrote only 4294967295 of 228 bytessend upnp message wrote only 4294967295 of 1353 bytesheader (228 bytes):

POST /MediaRenderer_AVTransport/control HTTP/1.0
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
CONTENT-TYPE: text/xml ; charset="utf-8"
HOST: dry run:0
Connection: close
Content-Length: 1353

message (1353 bytes):

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
<InstanceID>0</InstanceID>
<CurrentURI>file:///tmp/media/usb/Movies/english/The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD/The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD-CD1.avi</CurrentURI><CurrentURIMetaData><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/"><item id="2The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD-CD1.avi" parentID="2/tmp/media/usb/Movies/english/The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD" restricted="0"><dc:title>The.Chronicles.Of.Riddick.2004.UNRATED.DVDRip.XviD-CD1.avi</dc:title><dc:date></dc:date><upnp:class>object.item.imageItem</upnp:class><dc:creator></dc:creator><upnp:genre></upnp:genre><upnp:artist></upnp:artist><upnp:album></upnp:album><res protocolInfo="file-get:*:*:*:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=00000000001000000000000000000000" protection="" tokenType="0" bitrate="0" duration="" size="734838784" colorDepth="0" ifoFileURI="" resolution="">file:///tmp/media/usb/Mo
</u:SetAVTransportURI>
</s:Body>
</s:Envelope>


EDIT:
Here's the patch :ugeek:
Code: Select all
--- src/avremote.c      2011-04-15 16:05:28.000000000 +0200
+++ src/avremote.c.patched      2011-04-16 15:59:31.000000000 +0200
@@ -54,7 +54,7 @@
   upnp->hdr = (char*) calloc(512,sizeof(char));
   upnp->hdrlen = 0;
   upnp->res = (char*) calloc(1401,sizeof(char));
-  upnp->meta = (char*) calloc(1024,sizeof(char));
+  upnp->meta = (char*) calloc(2048,sizeof(char));

   return(upnp);
}
@@ -141,7 +141,7 @@
   snprintf(url,1023,"file://%s",path);


-  snprintf(upnp->meta,1023,UPNP_META_FORMAT, url,
+  snprintf(upnp->meta,2047,UPNP_META_FORMAT, url,
           pfile, pdir, pfile, filesize, url);


Re: AVRemote 0.2

PostPosted: Tue Apr 19, 2011 2:29 am
by jaromil
Patch included, thanks 8-)

a new 0.2 release is out which also adds support for auto-detection of UPNP AVTransport devices present on the same network (using miniupnpc); a MIPS binary is provided on FTP at your convenience.

ciao

Re: AVRemote 0.2

PostPosted: Tue Apr 19, 2011 3:20 am
by recliq
i found another issue when playing around with this tool.
It seems to not set meta info correctly, i played around with it and it seems that the whole meta info
(<DIDL ... </DIDL>) needs to be html encoded... (< = &lt;, > = &gt;, " = &quot;)

Re: AVRemote 0.2

PostPosted: Tue Apr 19, 2011 3:46 am
by jaromil
recliq wrote:i found another issue when playing around with this tool.
It seems to not set meta info correctly, i played around with it and it seems that the whole meta info
(<DIDL ... </DIDL>) needs to be html encoded... (< = &lt;, > = &gt;, " = &quot;)


ATM avremote sends well formed XML via tcp socket: such commands are accepted by the UPNP daemon (i'm using the load command without problems on two devices here).
If you use its "dry run" output inside a PHP string then surely you need to escape the html, but then avremote itself is fine as it is, since it is supposed to communicate directly with the devices.

Re: AVRemote 0.2

PostPosted: Tue Apr 19, 2011 4:41 am
by recliq
Well I came to this conclusion when i compared the console output via serial (from DMAOSD, etc..)of avremote load and upnp-cmd SetAVTransportURI.

I don't have access to my wd right now, but i will post some more info on this the next days...