在issues中找到了这个子资料,但还是没清楚extendAvailableConfigurations 中的配置规则,假如我需要新增800x600的分辨率,是不是这样加呀

 

原有配置:
basicAvailableConfigurations = [1, 1920, 1080, 4, 1920, 1080];
extendAvailableConfigurations = [0, 0, 1, 1920, 1080, 0, -1, 1, 1, 1920, 1080, 30, -1, 2, 4, 1920, 1080, 0, -1, -1];

新增800x600分辨率
basicAvailableConfigurations = [1, 1920, 1080, 1, 800, 600, 4, 1920, 1080];
extendAvailableConfigurations = [0, 0, 1, 1920, 1080, 0, -1, 0, 0, 1, 800, 600, 0, -1, 1, 1, 1920, 1080, 30, -1, 2, 4, 1920, 1080, 0, -1, -1];
 

经过查代码,终于知道配置规则了

        fpsValue = it.fmtdesc.fps.denominator / it.fmtdesc.fps.numerator;
        if (fpsValue > MINIMUM_FPS) {
            formatVector.push_back(FORMAT);
            formatVector.push_back(it.fmtdesc.width);
            formatVector.push_back(it.fmtdesc.height);
            formatVector.push_back(fpsValue);
            formatVector.push_back(END_SYMBOL);
        }
    }
    formatVector.push_back(END_SYMBOL);

    std::vector<int32_t> streamAvailableExtendConfigurationsVector;
    streamAvailableExtendConfigurationsVector.push_back(0);
    streamAvailableExtendConfigurationsVector.push_back(PREVIEW_STREAM);
    streamAvailableExtendConfigurationsVector.insert(streamAvailableExtendConfigurationsVector.end(),
                                                     formatVector.begin(), formatVector.end());
    streamAvailableExtendConfigurationsVector.push_back(CAPTURE_STREAM);
    streamAvailableExtendConfigurationsVector.insert(streamAvailableExtendConfigurationsVector.end(),
                                                     formatVector.begin(), formatVector.end());
    streamAvailableExtendConfigurationsVector.push_back(VIDEO_STREAM);
    streamAvailableExtendConfigurationsVector.insert(streamAvailableExtendConfigurationsVector.end(),
                                                     formatVector.begin(), formatVector.end());
    streamAvailableExtendConfigurationsVector.push_back(END_SYMBOL);
    AddOrUpdateOhosTag(metadata, OHOS_ABILITY_STREAM_AVAILABLE_EXTEND_CONFIGURATIONS,
                       streamAvailableExtendConfigurationsVector);

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐