Loading media/libstagefright/AwesomePlayer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -876,6 +876,17 @@ void AwesomePlayer::notifyVideoSize_l() { cropLeft, cropTop, cropRight, cropBottom); } int32_t displayWidth; if (meta->findInt32(kKeyDisplayWidth, &displayWidth)) { LOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth); mDisplayWidth = displayWidth; } int32_t displayHeight; if (meta->findInt32(kKeyDisplayHeight, &displayHeight)) { LOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight); mDisplayHeight = displayHeight; } int32_t usableWidth = cropRight - cropLeft + 1; int32_t usableHeight = cropBottom - cropTop + 1; if (mDisplayWidth != 0) { Loading media/libstagefright/OMXCodec.cpp +38 −3 Original line number Diff line number Diff line Loading @@ -2215,13 +2215,15 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { if (data2 == 0 || data2 == OMX_IndexParamPortDefinition) { onPortSettingsChanged(data1); } else if (data1 == kPortIndexOutput && data2 == OMX_IndexConfigCommonOutputCrop) { } else if (data1 == kPortIndexOutput && (data2 == OMX_IndexConfigCommonOutputCrop || data2 == OMX_IndexConfigCommonScale)) { sp<MetaData> oldOutputFormat = mOutputFormat; initOutputFormat(mSource->getFormat()); if (formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) { if (data2 == OMX_IndexConfigCommonOutputCrop && formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) { mOutputPortSettingsHaveChanged = true; if (mNativeWindow != NULL) { Loading @@ -2240,6 +2242,39 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { // already invalid, we'll know soon enough. native_window_set_crop(mNativeWindow.get(), &crop); } } else if (data2 == OMX_IndexConfigCommonScale) { OMX_CONFIG_SCALEFACTORTYPE scale; InitOMXParams(&scale); scale.nPortIndex = kPortIndexOutput; // Change display dimension only when necessary. if (OK == mOMX->getConfig( mNode, OMX_IndexConfigCommonScale, &scale, sizeof(scale))) { int32_t left, top, right, bottom; CHECK(mOutputFormat->findRect(kKeyCropRect, &left, &top, &right, &bottom)); // The scale is in 16.16 format. // scale 1.0 = 0x010000. When there is no // need to change the display, skip it. LOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx", scale.xWidth, scale.xHeight); if (scale.xWidth != 0x010000) { mOutputFormat->setInt32(kKeyDisplayWidth, ((right - left + 1) * scale.xWidth) >> 16); mOutputPortSettingsHaveChanged = true; } if (scale.xHeight != 0x010000) { mOutputFormat->setInt32(kKeyDisplayHeight, ((bottom - top + 1) * scale.xHeight) >> 16); mOutputPortSettingsHaveChanged = true; } } } } break; Loading Loading
media/libstagefright/AwesomePlayer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -876,6 +876,17 @@ void AwesomePlayer::notifyVideoSize_l() { cropLeft, cropTop, cropRight, cropBottom); } int32_t displayWidth; if (meta->findInt32(kKeyDisplayWidth, &displayWidth)) { LOGV("Display width changed (%d=>%d)", mDisplayWidth, displayWidth); mDisplayWidth = displayWidth; } int32_t displayHeight; if (meta->findInt32(kKeyDisplayHeight, &displayHeight)) { LOGV("Display height changed (%d=>%d)", mDisplayHeight, displayHeight); mDisplayHeight = displayHeight; } int32_t usableWidth = cropRight - cropLeft + 1; int32_t usableHeight = cropBottom - cropTop + 1; if (mDisplayWidth != 0) { Loading
media/libstagefright/OMXCodec.cpp +38 −3 Original line number Diff line number Diff line Loading @@ -2215,13 +2215,15 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { if (data2 == 0 || data2 == OMX_IndexParamPortDefinition) { onPortSettingsChanged(data1); } else if (data1 == kPortIndexOutput && data2 == OMX_IndexConfigCommonOutputCrop) { } else if (data1 == kPortIndexOutput && (data2 == OMX_IndexConfigCommonOutputCrop || data2 == OMX_IndexConfigCommonScale)) { sp<MetaData> oldOutputFormat = mOutputFormat; initOutputFormat(mSource->getFormat()); if (formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) { if (data2 == OMX_IndexConfigCommonOutputCrop && formatHasNotablyChanged(oldOutputFormat, mOutputFormat)) { mOutputPortSettingsHaveChanged = true; if (mNativeWindow != NULL) { Loading @@ -2240,6 +2242,39 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { // already invalid, we'll know soon enough. native_window_set_crop(mNativeWindow.get(), &crop); } } else if (data2 == OMX_IndexConfigCommonScale) { OMX_CONFIG_SCALEFACTORTYPE scale; InitOMXParams(&scale); scale.nPortIndex = kPortIndexOutput; // Change display dimension only when necessary. if (OK == mOMX->getConfig( mNode, OMX_IndexConfigCommonScale, &scale, sizeof(scale))) { int32_t left, top, right, bottom; CHECK(mOutputFormat->findRect(kKeyCropRect, &left, &top, &right, &bottom)); // The scale is in 16.16 format. // scale 1.0 = 0x010000. When there is no // need to change the display, skip it. LOGV("Get OMX_IndexConfigScale: 0x%lx/0x%lx", scale.xWidth, scale.xHeight); if (scale.xWidth != 0x010000) { mOutputFormat->setInt32(kKeyDisplayWidth, ((right - left + 1) * scale.xWidth) >> 16); mOutputPortSettingsHaveChanged = true; } if (scale.xHeight != 0x010000) { mOutputFormat->setInt32(kKeyDisplayHeight, ((bottom - top + 1) * scale.xHeight) >> 16); mOutputPortSettingsHaveChanged = true; } } } } break; Loading