PANASONIC TV with enabled MediaInfo doesn't work

Discuss alternative media renderers (not PS3) supported by PS3 Media Server (e.g. Xbox 360, TVs &c.)

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Fri Feb 18, 2011 6:17 pm

You are the man tomeko!!!!!
It works! I was able to browse folders, I saw them :lol:
For now it was only one empty folder with one empty subfolder and virtual folder ##VIDEO SETTINGS# but I saw them.
Hopefully no errors in attached debug.log. But I suppose if I saw folders it should work. Will test later.
Now I tested also PS3 and it works also there 8-)
Many thanks
ExSport
EDIT:
It is buggy :(
Attachments
debug-working.zip
Debug.log from working tomeko mod
(7.99 KiB) Downloaded 76 times
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Fri Feb 18, 2011 7:36 pm

So I found problem like said above.
I shared only empty folders with this structure:
Code: Select all
!\FOLDER\
         01
         02
         03 until
         25

Now I can see folders so I listed down but it ended at folder 20.
It seems TV tried to refresh list but no new folder visible, last was 20.
TV supports go UP on first folder so current position(1.) is moved to the end of list. So I did it.
Now browser is blinking and empty, only last folder at bottom is visible. Visible folder name is 21 and TV refresh list in endless circle but only bottom line refreshed(blinking).
TV request is 20 by 20. So I removed some folders so last one was 18. Now it works!!! TV scrolls list correctly,all 18 folders visible.
So it seems 20 (requested number by TV) is root cause. Some mathematical bug are there :)
Debug log with 25 folders attached.
EDIT:
From your PDF:
Code: Select all
If the CDS cannot compute TotalMatches and NumberReturned is equal
to zero, then the CDS should return an error code 720
When 300 files, last packets are:
Code: Select all
startindex 280
reqestcount 20
numreturned 20
totalmatches 301
----------------------
startindex 300
reqestcount 20
numreturned 0
totalmatches 300

So it seems TV return some error maybe :?
What about to use this as last packet? (In words startindex=totalmatches and numreturned is not zero to avoid violations???)
Code: Select all
startindex 300
reqestcount 20
numreturned 20 (or nonzero?)
totalmatches 300
Attachments
debug-bug.zip
Mathematical bug
(30.67 KiB) Downloaded 71 times
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Sat Feb 19, 2011 1:33 pm

Hi tomeko, for your latest patch I uploaded only debug.log where is nothing so here is Wireshark capture:
http://www.mediafire.com/?fe62f5ue8fg76a6
It seems that TV is weird:
it sends:
startindex 0
requestedcount 20
PMS responds:
numreturned 20
totalmatches 21
So TV asks again:
startindex 20
requestedcount 20
PMS answers:
numreturned 20
totalmatches 41
Now weird thing, TV starts asking from beginning:
startindex 0
requestedcount 20
Do you have some guess?
Many thanks!
P.S.
Definitelly true that TV don't like totalmatches=0 as unknown number(from your PDF - ContentDirectory:1) When I forced it it never responded back when received totalmatches=0
Also tried to find something in ContentDirectory:2 document and nothing new there :?
I think it will not be fixable so this TV is limited to MediaInfo=false (ffmpeg file detection) :cry:
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby tomeko » Sat Feb 19, 2011 2:25 pm

Your TV did'n like cheating... It looks like PANASONIC require real TotalMatches value. Try to permanent set TotalMaches = 1000 (for tests purpose only)
Code: Select all
response.append("<TotalMatches>1000</TotalMatches>");

So, maybe should be new option in renderer conf file, that allow force compute DLNA tree at first folder browse request, when mediainfo=true.
tomeko
Project Member
 
Posts: 154
Joined: Sat Jun 06, 2009 11:02 am

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Sat Feb 19, 2011 3:59 pm

Mant thanks, will try it.
1000 is some limit or if I will use 10000 will it be no problem? I think if it is not DLNA violation or if bigger number = slower listing or if TV will not ask again and again when starting index will be much smaller also in case numberreturned will be 0. But this I will se when I will compile it 8-)
Will let you know.
Anyway you are talking about cheating but it seems TV don't like also DLNA specification TotalMatches=0, quite bad :?
EDIT:
I maybe found root cause why it is happening. TV shows total number of files when every folder browsed.
This number is stored and taken as fixed so when scrolled to 21st file, PMS sends next 20 but TV tries to go back to first one because current position is 20, fixed number is 20 so go down action on TV tries to go back to first one so it asks again for startindex 0, requestedcount 20 also at time when PMS sends next startindex and another 20 files. At this point it will stuck again.
Stupid function, not dlna compliant :(
Theoretically in this case fixed TotalMatches should work(I suppose "go up when currently at bottom" function will stop to work :) ). Will test tomorrow and let you know.
So first answer to the TV with fake TotalMatches=1000 and all other responses with non-fake TotalMatches should work (if it will be "real" one or "startingindex + requestcount + 1")
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Sun Feb 20, 2011 1:44 am

So I made new test build, will test it morning and will post results:
Code: Select all
int totalCount = startingIndex + requestCount + 1; // returns 11 when 10 asked
if (filessize - minus <= 0) // if no more elements, send the startingIndex
   totalCount = startingIndex;
if (mediaRenderer.getCustomTotalMatches() >= 0) //always set TotalMatches to custom static value
   totalCount = mediaRenderer.getCustomTotalMatches();
if (mediaRenderer.getCustomTotalMatches() == -1) //set TotalMatches to 9999 in first reply only
   if (startingIndex == 0) totalCount = 9999;
if (mediaRenderer.getCustomTotalMatches() == -2) //set TotalMatches to 9999 except last reply
   if (filessize - minus > 0) totalCount = 9999;
response.append("<TotalMatches>" + totalCount + "</TotalMatches>");
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Sun Feb 20, 2011 3:54 pm

Results (27 files in root):
When CustomTotalMatches = -1
Code: Select all
StartIndex, RequestedCount / NumberReturned, TotalMatches
00, 20 / 20, 9999
20, 20 / 07, 41
27, 13 / 00, 27
00, 20 / 20, 9999
Endless cycle so no files visible ==> doesn't work!

When CustomTotalMatches = -2
Code: Select all
StartIndex, RequestedCount / NumberReturned, TotalMatches
00, 20 / 20, 9999
20, 20 / 07, 9999
27, 13 / 00, 27
00, 20 / 20, 9999
Endless cycle so no files visible ==> doesn't work!

When CustomTotalMatches = 112
Code: Select all
StartIndex, RequestedCount / NumberReturned, TotalMatches
00, 20 / 20, 112
20, 20 / 07, 112
27, 13 / 00, 112
40, 20 / 00, 112
Files visible ==> it does work!
Now TV shows 112(or other defined fixed value) as SUM of all files and I can browse!
When I am on file 27 and will try to scroll down, TV shows empty lines until it reaches 112 and then goes back to first one 8-)
When I will scroll up from top it will jump to 112th empty line so I have to scroll up until 27th item is visible.
With this behavior I can live :lol:
So only solution is to set fixed value which can't be changed/updated in next steps. If value will change, TV jumps to beginning and will ask for first portion of file ==> it will stuck again.
Maybe it can be added to the official version for better debuging without needs of recompiling.
It is easy to change one parameter in Renderer.conf to define how it should work :mrgreen:
Tomeko, many thanks for your help, much appreciated(also for this upnp doc).
Hope it will help others with nonstandart renderer as all Panasonic TVs are :shock:
What I added to Panasonic.conf file(will not work with official build!):
Code: Select all
# -1 sets TotalMatches to 9999 in first reply only
# -2 sets TotalMatches to 9999 except last reply
# ? sets TotalMatches to ? (static and fixed value all the time)
CustomTotalMatches=9999
MediaInfo=true
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby tomeko » Mon Feb 21, 2011 9:59 pm

Hi ExSport.
Try this patch:
Code: Select all
Index: net/pms/dlna/DLNAResource.java
===================================================================
--- net/pms/dlna/DLNAResource.java   (wersja 507)
+++ net/pms/dlna/DLNAResource.java   (kopia robocza)
@@ -456,7 +456,7 @@
                if (!resource.discovered) {
                   resource.discoverChildren();
                   boolean ready = true;
-                  if (renderer.isMediaParserV2())
+                  if (renderer.isMediaParserV2() && !renderer.isAnalizeFolderAllFiles())
                      ready = resource.analyzeChildren(count);
                   else
                      ready = resource.analyzeChildren(-1);
Index: net/pms/configuration/RendererConfiguration.java
===================================================================
--- net/pms/configuration/RendererConfiguration.java   (wersja 507)
+++ net/pms/configuration/RendererConfiguration.java   (kopia robocza)
@@ -295,12 +295,13 @@
    private static final String MEDIAPARSERV2_THUMB="MediaParserV2_ThumbnailGeneration";
    private static final String SUPPORTED="Supported";
    private static final String CUSTOM_MENCODER_QUALITYSETTINGS="CustomMencoderQualitySettings";
-   
+   private static final String ANALIZE_ALL_FILES="AnalizeFolderAllFiles";
    // Ditlew
    private static final String SHOW_DVD_TITLE_DURATION="ShowDVDTitleDuration";
    private static final String CBR_VIDEO_BITRATE="CBRVideoBitrate";
    private static final String BYTE_TO_TIMESEEK_REWIND_SECONDS="ByteToTimeseekRewindSeconds";
    
+   
    // Ditlew
    public int getByteToTimeseekRewindSeconds() {
       return getInt(BYTE_TO_TIMESEEK_REWIND_SECONDS, 0);
@@ -689,4 +690,8 @@
       return getBoolean(MEDIAPARSERV2_THUMB, false) && MediaInfoParser.isValid();
    }
 
+   public boolean isAnalizeFolderAllFiles() {
+      return getBoolean(ANALIZE_ALL_FILES, true) && MediaInfoParser.isValid();
+   }
+
 }
Index: renderers/Bravia5500.conf
===================================================================
--- renderers/Bravia5500.conf   (wersja 507)
+++ renderers/Bravia5500.conf   (kopia robocza)
@@ -30,6 +30,7 @@
 #Better/faster codec detection method ! true to enable it
 #Need testing !
 MediaInfo=true
+AnalizeFolderAllFiles = false
 # temporary removed lpcm
 Supported = f:mpegps|mpegts    v:mpeg2|h264    a:ac3|aac|mpa   m:video/mpeg
 Supported = f:mp3   m:audio/mpeg
Index: net/pms/network/RequestV2.java
===================================================================
--- net/pms/network/RequestV2.java   (wersja 507)
+++ net/pms/network/RequestV2.java   (kopia robocza)
@@ -278,7 +278,7 @@
             if (!mediaRenderer.isPS3()) {
                // hacky stuff. replace the png icon by a jpeg one. Like mpeg2 remux, really need a proper format compatibility list by renderer
                s = s.replace("<mimetype>image/png</mimetype>", "<mimetype>image/jpeg</mimetype>");
-               s = s.replace("/images/thumbnail-256.png", "/images/thumbnail-120.jpg");
+               s = s.replace("/images/icon-256.png", "/images/thumbnail-120.jpg");
                s = s.replace(">256<", ">120<");
             }
             response.append(s);
@@ -439,7 +439,7 @@
             DLNAResource parentFolder = null;
             if (files != null && filessize > 0)
                parentFolder = files.get(0).getParent();
-            if (browseFlag!=null&&browseFlag.equals("BrowseDirectChildren") && mediaRenderer.isMediaParserV2()) {
+            if (browseFlag!=null&&browseFlag.equals("BrowseDirectChildren") && mediaRenderer.isMediaParserV2() && !mediaRenderer.isAnalizeFolderAllFiles()) {
                // with the new parser, files are parsed and analyzed *before* creating the DLNA tree, every 10 items (the ps3 asks 10 by 10),
                // so we do not know exactly the total number of items in the DLNA folder to send
                // (regular files, plus the #transcode folder, maybe the #imdb one, also files can be invalidated and hidden if format is broken or encrypted, etc.).
@@ -448,8 +448,10 @@
                if (filessize - minus <= 0) // if no more elements, send the startingIndex
                   totalCount = startingIndex;
                response.append("<TotalMatches>" + totalCount + "</TotalMatches>");
-            } else
+            } else if(browseFlag!=null && browseFlag.equals("BrowseDirectChildren"))
                response.append("<TotalMatches>" + (((parentFolder!=null)?parentFolder.childrenNumber():filessize) - minus) + "</TotalMatches>");
+            else //from upnp spec: If BrowseMetadata is specified in the BrowseFlags then TotalMatches = 1,
+               response.append("<TotalMatches>1</TotalMatches>");
             response.append(CRLF);
             response.append("<UpdateID>");
             if (parentFolder != null)
Index: renderers/PS3.conf
===================================================================
--- renderers/PS3.conf   (wersja 507)
+++ renderers/PS3.conf   (kopia robocza)
@@ -111,6 +111,8 @@
 # 3- The server will skip badly parsed, corrupted files or wrong coding, preventing potential playback errors
 # 4- Faster browsing, due to the launch of ffmpeg/mplayer first thumbnailer process with each http client request, rather than in the browse DLNA request
 MediaInfo=true
+# Analize all files in folder (slower, more compatibile with other renderers)
+AnalizeFolderAllFiles = false
 # The media parser and this configuration file will recognize the following formats/codecs (lowercase only, regex supported):
 # Chosen from the most common used and supported formats/codecs (no need to manage ADPCM, nobody cares)
 #        mpegps      (mpeg presentation stream, used in DVD Videos, VCDs, etc.)

Add to Your conf file:
Code: Select all
MediaInfo=true
AnalizeFolderAllFiles = true

I've tested this path with Samsung BD-C6500 that has problem with fake TotalMatches
tomeko
Project Member
 
Posts: 154
Joined: Sat Jun 06, 2009 11:02 am

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Tue Feb 22, 2011 9:43 am

Many thanks tomeko. Will try it but maybe I will not be able to test it now. Leaving for 3 weeks.
Code: Select all
//from upnp spec: If BrowseMetadata is specified in the BrowseFlags then TotalMatches = 1,

I saw this note in PDF but didn't found packets with "BrowseMetadata" but "BrowseDirectChildren" only so I ignored this part 8-)
Code: Select all
# Analize all files in folder (slower, more compatibile with other renderers)

It is possible that renderer will return timeout because PMS will don't send anything until it knows totalmatches?
If there will be 500 files and all are needed to be parsed with MediaInfo or ffmpeg etc. I suppose it will take much time so renderer will timeout, or not?
Thanks
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

Re: PANASONIC TV with enabled MediaInfo doesn't work

Postby ExSport » Sun Mar 27, 2011 5:50 pm

Finally I found time to test your patch tomeko and it works! 8-)
As I said in earlier post it has problem with folders with lot of files so TV will lost connection to the server but it seems PMS continues in caching of all files so when I repeated browsing to this folder in 5minutes I immediately saw all files :mrgreen:
Many thanks for this patch!!!
Also one typo I found:
Code: Select all
AnalizeFolderAllFiles = true

Correctly should be:
Code: Select all
AnalyzeFolderAllFiles = true

Also it will be good to change default value to false(so default behavior will be used for other renderers) and changing analysefolderallfiles to something more descriptive.
Something like:
Code: Select all
AnalyzeAllBeforeFolderShown

From old name it is very hard to know whatis going on 8-)
Again, many thanks for working patch.
ExSport
 
Posts: 2168
Joined: Mon Jan 19, 2009 5:40 pm

PreviousNext

Return to Alternative Media Renderers

Who is online

Users browsing this forum: No registered users and 2 guests