Kodi Community Forum
parsing layer from mpeg audio header - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: PVR & Live TV Support (https://forum.kodi.tv/forumdisplay.php?fid=167)
+---- Forum: VDR (https://forum.kodi.tv/forumdisplay.php?fid=169)
+---- Thread: parsing layer from mpeg audio header (/showthread.php?tid=163351)



parsing layer from mpeg audio header - sirwio - 2013-04-26

While troubleshooting some issues with mpeg audio on the vompclient raspberry port (using the vompserver vdr plugin) I compared sources withe the vnsi plugin.

It appears as if the layer description parsed from the mpeg audio header is done wrong in the vnsi plugin. In line 109 of:

https://github.com/FernetMenta/xbmc-pvr-addons/blob/frodo/addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver/parser_MPEGAudio.c

the layer is calculated as:
Code:
int layer = bs.readBits(2);
  if (layer == 0)
    return 0;

The layer should rather be calculated as:
Code:
int layer = bs.readBits(2);
   if (layer == 0)
      return 0;
   layer = 4 - layer;

I guess the impact is not that severe since most of the times the layer description is 2 and 4 - 2 = 2
For robustness though I think the calculation shall be corrected.


RE: parsing layer from mpeg audio header - FernetMenta - 2013-04-26

Thanks, I will fix it or you send me a pull request Smile