From 48a9c414f90492d82502d16ea5722e9e7073e7e4 Mon Sep 17 00:00:00 2001 From: cjl_macbook Date: Wed, 11 Mar 2020 12:55:37 +0800 Subject: [PATCH] Ios hardware decode --- .../ios/pipeline/IJKVideoToolBoxSync.m | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijkplayer/ios/pipeline/IJKVideoToolBoxSync.m b/ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijkplayer/ios/pipeline/IJKVideoToolBoxSync.m index f7c40cdf..bdafb91e 100755 --- a/ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijkplayer/ios/pipeline/IJKVideoToolBoxSync.m +++ b/ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijkplayer/ios/pipeline/IJKVideoToolBoxSync.m @@ -311,7 +311,9 @@ static void VTDecoderCallback(void *decompressionOutputRefCon, #endif OSType format_type = CVPixelBufferGetPixelFormatType(imageBuffer); - if (format_type != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) { + //modify for flutter + //if (format_type != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) { + if (format_type != kCVPixelFormatType_32BGRA) { ALOGI("format_type error \n"); goto failed; } @@ -423,11 +425,18 @@ static VTDecompressionSessionRef vtbsession_create(Ijk_VideoToolBox_Opaque* cont ret = vtbformat_init(&context->fmt_desc, context->codecpar); - if (ffp->vtb_max_frame_width > 0 && width > ffp->vtb_max_frame_width) { - double w_scaler = (float)ffp->vtb_max_frame_width / width; - width = ffp->vtb_max_frame_width; - height = height * w_scaler; - } + //modify for flutter + /*if (ffp->vtb_max_frame_width > 0 && width > ffp->vtb_max_frame_width) { + double w_scaler = (float)ffp->vtb_max_frame_width / width; + width = ffp->vtb_max_frame_width; + height = height * w_scaler; + }*/ + if (ffp->vtb_frame_width_default > 0 && ffp->vtb_max_frame_width > 0 && width > ffp->vtb_max_frame_width) { + double w_scaler = (float)ffp->vtb_max_frame_width / width; + width = ffp->vtb_max_frame_width; + height = height * w_scaler; + } + //end ALOGI("after scale width %d height %d \n", width, height); @@ -436,8 +445,12 @@ static VTDecompressionSessionRef vtbsession_create(Ijk_VideoToolBox_Opaque* cont 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + + //modify for flutter + //CFDictionarySetSInt32(destinationPixelBufferAttributes, + // kCVPixelBufferPixelFormatTypeKey, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); CFDictionarySetSInt32(destinationPixelBufferAttributes, - kCVPixelBufferPixelFormatTypeKey, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); + kCVPixelBufferPixelFormatTypeKey, kCVPixelFormatType_32BGRA); CFDictionarySetSInt32(destinationPixelBufferAttributes, kCVPixelBufferWidthKey, width); CFDictionarySetSInt32(destinationPixelBufferAttributes, -- Gitee