Merge lp:~shockone89/audience/aspect-ratio into lp:~audience-members/audience/trunk

Proposed by Volodymyr Shatsky
Status: Merged
Approved by: Cody Garver
Approved revision: 337
Merged at revision: 410
Proposed branch: lp:~shockone89/audience/aspect-ratio
Merge into: lp:~audience-members/audience/trunk
Diff against target: 38 lines (+19/-1)
1 file modified
src/Widgets/VideoPlayer.vala (+19/-1)
To merge this branch: bzr merge lp:~shockone89/audience/aspect-ratio
Reviewer Review Type Date Requested Status
Danielle Foré Needs Fixing
Review via email: mp+218216@code.launchpad.net

Commit message

Better detect aspect ratio

Description of the change

Fixed.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

I played a_bout_de_souffle.m4v using this branch, mpv, and Totem and they all displayed a different AR. I didn't have time to do screenshots and measure the pixels though, which do you think is displaying it correctly?

Revision history for this message
Danielle Foré (danrabbit) wrote :

Okay, so from what I can tell the aspect ratio is still wrong with this branch.

Totem and Chrome both play the video at 4:3, and Audience is showing 1.4:1

review: Needs Fixing
Revision history for this message
Danielle Foré (danrabbit) wrote :

Way closer than trunk though. We can probably just merge

Revision history for this message
Volodymyr Shatsky (shockone89) wrote :

The video is broken. Its width and height metadata are set to 1px. But PAR is correct. We deduce the original resolution from it. Maybe the players you mentioned just fall back to 4:3.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/VideoPlayer.vala'
2--- src/Widgets/VideoPlayer.vala 2014-04-28 12:58:09 +0000
3+++ src/Widgets/VideoPlayer.vala 2014-05-04 13:33:40 +0000
4@@ -93,8 +93,8 @@
5 var video = info.get_video_streams ();
6 if (video.data != null) {
7 var video_info = (Gst.PbUtils.DiscovererVideoInfo)video.data;
8- video_width = video_info.get_width ();
9 video_height = video_info.get_height ();
10+ video_width = get_video_width (video_info);
11 }
12 } catch (Error e) {
13 error ();
14@@ -592,5 +592,23 @@
15 }
16 } catch (Error e) { warning (e.message); }
17 }
18+
19+ uint get_video_width (Gst.PbUtils.DiscovererVideoInfo video_info) {
20+ var par = get_video_par (video_info);
21+ if (par == -1) {
22+ return video_info.get_width ();
23+ }
24+ return (uint)(video_height * par);
25+ }
26+
27+ //pixel aspect ratio
28+ double get_video_par (Gst.PbUtils.DiscovererVideoInfo video_info) {
29+ var num = video_info.get_par_num ();
30+ var denom = video_info.get_par_denom ();
31+ if (num == 1 && denom == 1) {
32+ return -1; //Error.
33+ }
34+ return num / (double)denom;
35+ }
36 }
37 }
38\ No newline at end of file

Subscribers

People subscribed via source and target branches