juhovh / shairplay

Apple airplay and raop protocol server
Other
1.35k stars 228 forks source link

Playback Progress #14

Closed yallah closed 9 years ago

yallah commented 11 years ago

Hi, I need some feature about time position for sound track.

I say perhaps completly stupid and wrong (I m not developper) but when I look unofficial docs about airplay ( http://nto.github.io/AirPlay.html ). I find in metadatapart (in Audio area) Track Informations, Cover Artwork and Playback Progress with :

Playback Progress

Playback progress is sent as text/parameters, with a progress parameter representing three absolute RTP timestamps values: start/curr/end.

timestamp description start beginning of the current track curr current playback position end end of the current track The relative position and track duration can be computed as follows:

position = rtptime_to_sec(curr - start) duration = rtptime_to_sec(end - start) Example: send playback progress

client → server SET_PARAMETER rtsp://fe80::217:f2ff:fe0f:e0f6/3413821438 RTSP/1.0 CSeq: 10 Session: 1 Content-Type: text/parameters Content-Length: 44 User-Agent: iTunes/10.6 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/535.18.5 Client-Instance: 56B29BB6CB904862 DACP-ID: 56B29BB6CB904862 Active-Remote: 1986535575

progress: 1146221540/1146549156/1195701740 server → client RTSP/1.0 200 OK Server: AirTunes/130.14 CSeq: 10

Regards

juhovh commented 11 years ago

Thanks for your comment, this is something that would definitely be nice to have as supported. I'll make some tests and see how it works.

juhovh commented 11 years ago

I checked this out and unfortunately this SET_PARAMETER packet is only sent in the beginning of the stream. For it to be useful, you would at least need the "Sync packets" (section 5.2) to update the progress in real time. But actually I've had the idea to break the libshairplay API in order to include RTP timestamp for all audio packets. This would fix this issue more correctly, since sync packets are meant to only sync NTP and RTP timestamps. So let me think about this a bit more.

yallah commented 11 years ago

Thanks for your work !! I will wait :) Also I think when you will include NTP and RTP, the cover art will be update better.

yallah commented 11 years ago

thx for your progress branch. When you can push in master branch ?

juhovh commented 11 years ago

I wrote the progress branch to test the RTP timestamps of audio packets against the values in progress parameters. However I didn't get quite accurate values, the total progress seemed to be off for about 4 seconds sometimes. I'm hoping to get some time to figure out how to get exact progress values before merging with master. Currently it is not very useful...

yallah commented 11 years ago

Oh ok no prob.

juhovh commented 9 years ago

The change is now merged in a pull request https://github.com/juhovh/shairplay/pull/38