Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[videoinfo] get video aspect ration from CDataCacheCore #12703

Merged
merged 1 commit into from Sep 4, 2017

Conversation

BigNoid
Copy link
Member

@BigNoid BigNoid commented Aug 21, 2017

…ect by dividing videowidth by videoheight

I noticed that in recent builds VideoPlayer.VideoAspect returns empty. While I couldn't find the root cause of this, I did find we return empty in case the stream details don't return the videoaspect ratio. This adds a fallback in that case by calculating the aspect ratio from the width and height.

EDIT:
Instead of adding a fallback I changed to PR to pull the aspect from CDataCacheCore instead of m_videoInfo as that is deprecated.

{
if (fAspect == 0.0f)
return "";
// if aspect is zero, aspectratio can be obtained by dividing video width by video height
fAspect = (float)iWidth / (float)iHeight;

This comment was marked as spam.

@BigNoid
Copy link
Member Author

BigNoid commented Aug 21, 2017

@Rechi I addressed your comments. There shouldn't be division by zero possible now.

@BigNoid
Copy link
Member Author

BigNoid commented Aug 22, 2017

ping @FernetMenta as this touches videoplayer

@FernetMenta
Copy link
Contributor

VP does expose DAR in CDataCacheCore:
https://github.com/xbmc/xbmc/search?utf8=%E2%9C%93&q=GetVideoDAR&type=

you should query this

@BigNoid
Copy link
Member Author

BigNoid commented Aug 26, 2017

@FernetMenta I am not sure what to do here. Whenever I debug none of those lines hit and I am sure this area is far beyond my expertise.
Doesn't adding a fallback make sense in any case?

@FernetMenta
Copy link
Contributor

FernetMenta commented Aug 27, 2017

nope, a fallback without having added the normal path does not make sense. the gui has the pull ar from the source I pointed to

@BigNoid
Copy link
Member Author

BigNoid commented Aug 30, 2017

the gui has the pull ar from the source I pointed to

Can you take a look at why it doesn't do that in current master?

@FernetMenta
Copy link
Contributor

m_videoInfo is deprecated. guiInfoManager needs to pull the info from CDataCacheCore

@ksooo
Copy link
Member

ksooo commented Aug 31, 2017

But only for the currently playing video. This only holds for VIDEOPLAYER_VIDEO_ASPECT, not LISTITEM_VIDEO_ASPECT.

@FernetMenta
Copy link
Contributor

m_videoInfo is only for playing video

@ksooo
Copy link
Member

ksooo commented Aug 31, 2017

m_videoInfo is only for playing video

Ha! Then, LISTITEM_VIDEO_ASPECT never was implemented correctly, it seems. Implementation does the same as VIDEOPLAYER_VIDEO_ASPECT, which seems wrong to me.

Good news is that for Estuary, LISTITEM_VIDEO_ASPECT is not used. ;-)

@ksooo
Copy link
Member

ksooo commented Aug 31, 2017

@BigNoid:

diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index b3e62cf7be..81815b4878 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -6207,7 +6207,7 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
   case VIDEOPLAYER_VIDEO_ASPECT:
     if (g_application.m_pPlayer->IsPlaying())
     {
-      strLabel = CStreamDetails::VideoAspectToAspectDescription(m_videoInfo.videoAspectRatio);
+      strLabel = StringUtils::Format("%.2f", CServiceBroker::GetDataCacheCore().GetVideoDAR());
     }
     break;
   case VIDEOPLAYER_AUDIO_CHANNELS:

@BigNoid
Copy link
Member Author

BigNoid commented Sep 1, 2017

thx, will try that!

@ksooo
Copy link
Member

ksooo commented Sep 1, 2017

It works. I have tested that. :-)

@BigNoid
Copy link
Member Author

BigNoid commented Sep 4, 2017

I changed it to @ksooo suggestion, but I had to change it to still run through the description routine to get the values skins expect.

@BigNoid BigNoid changed the title [videoinfo] if aspectratio from streamdetails is 0, calculate the asp… [videoinfo] get video aspect ration from CDataCacheCore Sep 4, 2017
@ksooo
Copy link
Member

ksooo commented Sep 4, 2017

@BigNoid what's the description routine? If the value is different from what it was formerly, we should fix this in the core. So, what exactly is the problem (if any)?

@BigNoid
Copy link
Member Author

BigNoid commented Sep 4, 2017

what's the description routine? If the value is different from what it was formerly, we should fix this in the core. So, what exactly is the problem (if any)?

I mean https://github.com/xbmc/xbmc/blob/master/xbmc/utils/StreamDetails.cpp#L585
Skins are expecting any of the values defined there, many have images for these values to display. In these cases the images are not shown for example for 2.39 DAR.

See https://github.com/BigNoid/Aeon-Nox/tree/master/media/flags/aspectratio for example

@FernetMenta
Copy link
Contributor

looks ok to me

@ksooo
Copy link
Member

ksooo commented Sep 4, 2017

@BigNoid: Yeah, looks good (was a little bit blind, tbh, to dumb to spot the obvious diff between my diff and your code).

@ksooo
Copy link
Member

ksooo commented Sep 4, 2017

jenkins build this please

@ksooo
Copy link
Member

ksooo commented Sep 4, 2017

jenkins errors are unrelated.

@ksooo ksooo merged commit e3f7d7c into xbmc:master Sep 4, 2017
@Rechi Rechi added Type: Fix non-breaking change which fixes an issue Component: GUI engine v18 Leia labels Sep 4, 2017
@Rechi Rechi added this to the L 18.0-alpha1 milestone Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: GUI engine Type: Fix non-breaking change which fixes an issue v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants