diff options
author | Benoit Goby <benoit@android.com> | 2014-05-14 23:47:13 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-14 23:47:13 +0000 |
commit | c389ca420d3df05dedcdcfb12b7e7543df837f0d (patch) | |
tree | 64286cb447fdd7947774501d3c383eb397a35019 /cmds/screenrecord/FrameOutput.cpp | |
parent | 3425fd5a55dd31e261d2f2a9590c762d6d0a6b79 (diff) | |
parent | 4b7c5444f8af79f1f3e04e09bd03b84dec26facf (diff) | |
download | frameworks_av-c389ca420d3df05dedcdcfb12b7e7543df837f0d.zip frameworks_av-c389ca420d3df05dedcdcfb12b7e7543df837f0d.tar.gz frameworks_av-c389ca420d3df05dedcdcfb12b7e7543df837f0d.tar.bz2 |
am 4b7c5444: am e32106fd: screenrecord: Add raw frames output format
* commit '4b7c5444f8af79f1f3e04e09bd03b84dec26facf':
screenrecord: Add raw frames output format
Diffstat (limited to 'cmds/screenrecord/FrameOutput.cpp')
-rw-r--r-- | cmds/screenrecord/FrameOutput.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cmds/screenrecord/FrameOutput.cpp b/cmds/screenrecord/FrameOutput.cpp index 06b1f70..4da16bc 100644 --- a/cmds/screenrecord/FrameOutput.cpp +++ b/cmds/screenrecord/FrameOutput.cpp @@ -87,7 +87,7 @@ status_t FrameOutput::createInputSurface(int width, int height, return NO_ERROR; } -status_t FrameOutput::copyFrame(FILE* fp, long timeoutUsec) { +status_t FrameOutput::copyFrame(FILE* fp, long timeoutUsec, bool rawFrames) { Mutex::Autolock _l(mMutex); ALOGV("copyFrame %ld\n", timeoutUsec); @@ -152,16 +152,20 @@ status_t FrameOutput::copyFrame(FILE* fp, long timeoutUsec) { (endWhenNsec - pixWhenNsec) / 1000000.0); } - // Fill out the header. - size_t headerLen = sizeof(uint32_t) * 5; size_t rgbDataLen = width * height * kOutBytesPerPixel; - size_t packetLen = headerLen - sizeof(uint32_t) + rgbDataLen; - uint8_t header[headerLen]; - setValueLE(&header[0], packetLen); - setValueLE(&header[4], width); - setValueLE(&header[8], height); - setValueLE(&header[12], width * kOutBytesPerPixel); - setValueLE(&header[16], HAL_PIXEL_FORMAT_RGB_888); + + if (!rawFrames) { + // Fill out the header. + size_t headerLen = sizeof(uint32_t) * 5; + size_t packetLen = headerLen - sizeof(uint32_t) + rgbDataLen; + uint8_t header[headerLen]; + setValueLE(&header[0], packetLen); + setValueLE(&header[4], width); + setValueLE(&header[8], height); + setValueLE(&header[12], width * kOutBytesPerPixel); + setValueLE(&header[16], HAL_PIXEL_FORMAT_RGB_888); + fwrite(header, 1, headerLen, fp); + } // Currently using buffered I/O rather than writev(). Not expecting it // to make much of a difference, but it might be worth a test for larger @@ -169,7 +173,6 @@ status_t FrameOutput::copyFrame(FILE* fp, long timeoutUsec) { if (kShowTiming) { startWhenNsec = systemTime(CLOCK_MONOTONIC); } - fwrite(header, 1, headerLen, fp); fwrite(mPixelBuf, 1, rgbDataLen, fp); fflush(fp); if (kShowTiming) { |