xbmc/xbmc — pull request #3701 by jmac-burgh (2013-11-22 23:46:16+00:00)
Title: Commit will prevent invalid Aspect Ratio value writes to xbmc movie info...

... database

The genesis for the problem addressed in this commit is the bluray spec. It
includes the black bars of a scope movie in the blu ray disc movie files.
When a user creates a 1:1 unencoded rip of a bluray disc to use with xbmc the video file
also has the black bars. The algorithm used to calculate the Aspect Ratio by the default video player in xbmc
uses the entire video file, black bars with the movie content, thus causing all scope movies (2.35, 2.40, etc..)
to have a 1.778 calculated Aspect Ratio value. This incorrect value is written to xbmc's
movie information database, overwriting any valid scope Aspect Ratio already there from a movie.nfo file.
To be clear this issue does not effect how a movie is displayed, only what is displayed in the
movie information areas of xbmc during and after playback. It goes without saying the
code used to fix this problem is not the optimum way to address the problem, it is a temporary
fix to be used until a developer familiar with the code used to calculate the Aspect Ratio
in xbmc player is able to modify it to become "black bar aware". One suggestion was to check if
the code used to crop black bars in xbmc can be re-used to make the Aspect Ratio algorithm
"black bar aware".

The feature/bug request addressed in this patch to xbmc/GUIInfoManager.cpp is described in
these xbmc forum threads:

http://forum.xbmc.org/showthread.php?tid=159942&highlight=Aspect+Ratio
http://forum.xbmc.org/showthread.php?tid=171173&highlight=aspect+ratio

I created the first thread to discuss possible solutions, track progress of mods done in
xbmc-12.0 source code, and highlight difficulties in porting the working solution in xbmc-12.0
to xbmc-13.0. Significant progress was recently made in porting the fix to xbmc-13.0, this commit
was created for the xbmc master branch developers to review for inclusion to the xbmc-13.0 source code.

Below is a cut from comment lines added to xbmc/GUIInfoManager.cpp describing the source code changes:

File has been modified to prevent overwrites of valid Aspect Ratios taken from nfo files
when available. To activate the new code it requires user intervention to create a flag file, typically done
from a simple xbmc python add-on, but can be done manually if the user creates the file.
When the flag/file is removed, either by the python add-on script, or manual deletion by a user
the original code is used.

The code changes consisted of adding a function, getAspect_Ratio_nfo, to parse the Aspect ratio
from the nfo file, adding lines to define the active movie path within the function CGUIInfoManager::GetItemLabel,
and lines added to two case statements VIDEOPLAYER_VIDEO_ASPECT, to write the Aspect Ratio of the nfo file
to the database so it is displayed correctly in the information menus within video player during playback
and LISTITEM_VIDEO_ASPECT to write the Aspect Ratio of the nfo file to the info database so it is persistent after stopping playback.

xbmc/stop_Aspect_Ratio_overwrites.patch is the patch file for xbmc/GUIINfoManager.cpp to implement the feature/bug fix.

One additonal note. Skins for xmbc need to be modified to include png files that will display the correct icon for scope
movies (2.35, 2.40. 2.55, etc..). It looks like the user ronnie's pull request 3182 to include the icons in the default
confluence skin, and common Aspect Ratios in xbmc/utils/StreamDetails.cpp was merged into the branch in 08 2013.