Skip to content

Commit

Permalink
Fix video pixel aspect ratio (brianwernick#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro authored and brianwernick committed Apr 4, 2018
1 parent 445a1c8 commit cbdf0ee
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ interface OnSurfaceSizeChanged {

void setListenerMux(ListenerMux listenerMux);

void onVideoSizeChanged(int width, int height);
void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio);

void setRepeatMode(@Player.RepeatMode int repeatMode);
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ public void setListenerMux(ListenerMux listenerMux) {
}

@Override
public void onVideoSizeChanged(int width, int height) {
if (updateVideoSize(width, height)) {
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) {
if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) {
requestLayout();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ public void setListenerMux(ListenerMux listenerMux) {
}

@Override
public void onVideoSizeChanged(int width, int height) {
if (updateVideoSize(width, height)) {
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) {
if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) {
requestLayout();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ public void setListenerMux(ListenerMux listenerMux) {
}

@Override
public void onVideoSizeChanged(int width, int height) {
if (updateVideoSize(width, height)) {
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) {
if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) {
requestLayout();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public void setListenerMux(ListenerMux listenerMux) {
}

@Override
public void onVideoSizeChanged(int width, int height) {
if (updateVideoSize(width, height)) {
public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) {
if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) {
requestLayout();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ public interface OnVideoSizeChangedListener {
* @param intrinsicWidth The intrinsic (unscaled) width of the video currently in playback
* @param intrinsicHeight The intrinsic (unscaled) height of the video currently in playback
*/
void onVideoSizeChanged(int intrinsicWidth, int intrinsicHeight);
void onVideoSizeChanged(int intrinsicWidth, int intrinsicHeight, float pixelWidthHeightRatio);
}
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,10 @@ public void onSeekComplete() {
public void onVideoSizeChanged(int width, int height, int unAppliedRotationDegrees, float pixelWidthHeightRatio) {
//NOTE: Android 5.0+ will always have an unAppliedRotationDegrees of 0 (ExoPlayer already handles it)
videoViewImpl.setVideoRotation(unAppliedRotationDegrees, false);
videoViewImpl.onVideoSizeChanged(width, height);
videoViewImpl.onVideoSizeChanged(width, height, pixelWidthHeightRatio);

if (videoSizeChangedListener != null) {
videoSizeChangedListener.onVideoSizeChanged(width, height);
videoSizeChangedListener.onVideoSizeChanged(width, height, pixelWidthHeightRatio);
}
}

Expand Down

0 comments on commit cbdf0ee

Please sign in to comment.