Page 1 of 1

[CDS API] - Playing back transcoded Audio

PostPosted: Tue Sep 04, 2012 6:29 pm
by will
First question, is the content length for transcoded audio always 900000000 (I need to detect whether I can give a progress update based on percentage)

Second question is more implementation, what is the best way to detect when I have finished downloading the complete audio file?

I have the following in a loop, but inputStream.read(buf) doesn't return on the final (or I suppose final+1) read. Looking online, I either need to know the content length, which won't happen, or the server needs to close the connection.
  Code:
while (true) {
   int numread = inputStream.read(buf);   
   if (numread <= 0) {
      success = true;
      break;
   }

   fileStream.write(buf, 0, numread);
   mTotalBytes += numread;
   ...
   update progress
   ...
}

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Wed Sep 05, 2012 9:15 pm
by zip
The 90000000 is a randon length, needed by Http 1.0 DLNA renderers, who don't support chunked encoding. I *think* the connection should close, can you try with wget or similar?

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Wed Sep 05, 2012 9:21 pm
by will
Ok, I don't mind what it is, I just need a consistent way to tell if the file is being transcoded right now, or if it is native/from an already transcoded file. Is there a better way to detect it?

I'll try wget in the morning to see if that sheds any light. (The code works fine for non transcoded audio)

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Wed Sep 05, 2012 9:24 pm
by zip
For DLNA Serviio sends CI value of 1 in the protocol info for file that is being transcoded and 0 for file that is played natively or already is fully transcoded. I guess I could add another attribute to the API to mimick this.

We can talk about it later. For now you can check for the 900000... value, as a hack.

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Thu Sep 06, 2012 8:35 pm
by will
Doesn't look like it closes the connection, wget downloads the file then hangs.
  Code:
wget http://192.168.15.100:23424/cds/resource/17962/MEDIA_ITEM/MP3-0/ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7
--2012-09-06 21:26:07--  http://192.168.15.100:23424/cds/resource/17962/MEDIA_ITEM/MP3-0/ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7
Connecting to 192.168.15.100:23424... connected.
HTTP request sent, awaiting response... 200 OK
Length: 900000000 (858M) [audio/mpeg]
Saving to: `ORIGINAL,serviigo?authToken=3b35f135f2c3425c88e363f2780445d7.2'

 0% [>                                                                                                                  ] 5,383,131   --.-K/s  eta 2h 28m

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Thu Sep 06, 2012 11:34 pm
by zip
I have now fixed this, hopefully not breaking anything else ;-) Do you need a build? I'm away for the weekend but could send you one next week.

Re: [CDS API] - Playing back transcoded Audio

PostPosted: Fri Sep 07, 2012 6:50 am
by will
A build next week would be good, thanks.