美文网首页
android R c/cpp dump buffer方法

android R c/cpp dump buffer方法

作者: Ed_Lannister | 来源:发表于2022-06-27 15:58 被阅读0次
    RTC_LOG(LS_INFO) << "ELSCU ScreenCapUtil outBuffer->lock";
    result = outBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, &base);
    if (base == nullptr || result != 0) {
        return;
    }

    w = outBuffer->getWidth();
    h = outBuffer->getHeight();
    s = outBuffer->getStride();
    f = outBuffer->getPixelFormat();
    size = s * h * bytesPerPixel(f);
    RTC_LOG(LS_INFO) << "ELSCU buffer w="<<w<<", h="<<h<<",stride= "<<s<<",pixelformat="<<f<<",size="<<size;

    RTC_LOG(LS_INFO) << "ELSCU begin to write file";
    std::fstream ifs;
    ifs.open("/sdcard/capturedbuff.yuv", std::ios::out|std::ios::binary);
    ifs.write(reinterpret_cast<const char *>(base), size);
    ifs.close();

    RTC_LOG(LS_INFO) << "ELSCU begin to write file2";
    FILE* file = fopen("/sdcard/capturebuff2.yuv","wb+");
    if(file !=NULL){
        RTC_LOG(LS_INFO) << "ELSCU FILE";
        fwrite(base,size,1,file);
        fclose(file);
    }

相关文章

网友评论

      本文标题:android R c/cpp dump buffer方法

      本文链接:https://www.haomeiwen.com/subject/ooxovrtx.html