Skip to content

Commit

Permalink
SGVideoFrame: Use presentation size to generate image.
Browse files Browse the repository at this point in the history
  • Loading branch information
libobjc committed Nov 5, 2019
1 parent a03e5ea commit 4f8da84
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions SGPlayer/Classes/Core/SGData/SGVideoFrame.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,15 @@ - (SGPLFImage *)image
SGVideoDescriptor *inputDescriptor = [self->_descriptor copy];
SGVideoDescriptor *outputDescriptor = [self->_descriptor copy];
outputDescriptor.format = AV_PIX_FMT_RGB24;
outputDescriptor.width = self->_descriptor.presentationSize.num;
outputDescriptor.height = self->_descriptor.presentationSize.den;

const uint8_t *src_data[SGFramePlaneCount] = {nil};
uint8_t *dst_data[SGFramePlaneCount] = {nil};
int src_linesize[SGFramePlaneCount] = {0};
int dst_linesize[SGFramePlaneCount] = {0};

if (inputDescriptor.format == AV_PIX_FMT_VIDEOTOOLBOX) {
if (!self->_pixelBuffer) {
return nil;
}
if (self->_pixelBuffer) {
OSType type = CVPixelBufferGetPixelFormatType(self->_pixelBuffer);
inputDescriptor.format = SGPixelFormatAV2FF(type);

Expand Down

0 comments on commit 4f8da84

Please sign in to comment.