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);
}
网友评论