Skip to content

Commit

Permalink
SGPlayer: scalingMode.
Browse files Browse the repository at this point in the history
  • Loading branch information
libobjc committed Jun 27, 2019
1 parent 1744d1a commit 6b48b21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions SGPlayer/Classes/Core/SGDefine/SGMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#import <Foundation/Foundation.h>
#import "SGGLTextureUploader.h"
#import "SGVideoRenderer.h"
#import "SGGLViewport.h"
#import "SGMetalViewport.h"
#import "SGGLProgram.h"
#import "SGGLModel.h"
#import "SGFFmpeg.h"

// FF/SG -> GL
SGGLModelType SGDisplay2Model(SGDisplayMode displayMode);
SGGLProgramType SGFormat2Program(enum AVPixelFormat format, CVPixelBufferRef pixelBuffer);
SGGLViewportMode SGScaling2Viewport(SGScalingMode scalingMode);
SGMetalViewportMode SGScaling2Viewport(SGScalingMode scalingMode);

// FF <-> SG
SGMediaType SGMediaTypeFF2SG(enum AVMediaType mediaType);
Expand Down
10 changes: 5 additions & 5 deletions SGPlayer/Classes/Core/SGDefine/SGMapping.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ SGGLProgramType SGFormat2Program(enum AVPixelFormat format, CVPixelBufferRef pix
}
}

SGGLViewportMode SGScaling2Viewport(SGScalingMode scalingMode)
SGMetalViewportMode SGScaling2Viewport(SGScalingMode scalingMode)
{
switch (scalingMode) {
case SGScalingModeResize:
return SGGLViewportModeResize;
return SGMetalViewportModeResize;
case SGScalingModeResizeAspect:
return SGGLViewportModeResizeAspect;
return SGMetalViewportModeResizeAspect;
case SGScalingModeResizeAspectFill:
return SGGLViewportModeResizeAspectFill;
return SGMetalViewportModeResizeAspectFill;
}
return SGGLViewportModeResizeAspect;
return SGMetalViewportModeResizeAspect;
}

SGMediaType SGMediaTypeFF2SG(enum AVMediaType mediaType)
Expand Down
2 changes: 1 addition & 1 deletion SGPlayer/Classes/Core/SGRenderer/SGVideoRenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ - (void)drawInMTKView:(MTKView *)view
switch (displayMode) {
case SGDisplayModePlane: {
((SGMetalUniforms *)self->_uniformBuffer1.contents)->mvp = matrix_identity_float4x4;
viewports[0] = [SGMetalViewport viewportWithLayerSize:layerSize textureSize:textureSize mode:SGMetalViewportModeResizeAspect];
viewports[0] = [SGMetalViewport viewportWithLayerSize:layerSize textureSize:textureSize mode:SGScaling2Viewport(self->_scalingMode)];
uniforms = @[self->_uniformBuffer1];
}
break;
Expand Down

0 comments on commit 6b48b21

Please sign in to comment.