-rw-r--r--[-rwxr-xr-x] | inc/mjpeg/defs.h | 2 | ||||
-rw-r--r-- | v3/Android.mk | 5 | ||||
-rw-r--r-- | v3/fake-pipeline2/Sensor.cpp | 12 |
3 files changed, 18 insertions, 1 deletions
diff --git a/v3/fake-pipeline2/Sensor.cpp b/v3/fake-pipeline2/Sensor.cpp index 1338a14..c8d4c56 100644 --- a/v3/fake-pipeline2/Sensor.cpp +++ b/v3/fake-pipeline2/Sensor.cpp @@ -41,6 +41,10 @@ #include <sys/time.h> +extern "C"{ + #include "jutils.h" +} + #define ARRAY_SIZE(x) (sizeof((x))/sizeof(((x)[0]))) @@ -1980,9 +1984,13 @@ void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t stride) { ALOGE("new buffer failed!\n"); return; } +#if ANDROID_PLATFORM_SDK_VERSION > 23 + if (jpeg_decode(&tmp_buffer, src, width, height, V4L2_PIX_FMT_NV21) != 0) { +#else if (ConvertMjpegToNV21(src, vinfo->picture.buf.bytesused, tmp_buffer, width, tmp_buffer + width * height, (width + 1) / 2, width, height, width, height, libyuv::FOURCC_MJPG) != 0) { +#endif DBG_LOGA("Decode MJPEG frame failed\n"); putback_picture_frame(vinfo); usleep(5000); @@ -2240,9 +2248,13 @@ void Sensor::captureNV21(StreamBuffer b, uint32_t gain) { uint32_t width = vinfo->preview.format.fmt.pix.width; uint32_t height = vinfo->preview.format.fmt.pix.height; memset(mTemp_buffer, 0 , width * height * 3/2); +#if ANDROID_PLATFORM_SDK_VERSION > 23 + if (jpeg_decode(&mTemp_buffer, src, width, height, V4L2_PIX_FMT_NV21) != 0) { +#else if (ConvertMjpegToNV21(src, vinfo->preview.buf.bytesused, mTemp_buffer, width, mTemp_buffer + width * height, (width + 1) / 2, width, height, width, height, libyuv::FOURCC_MJPG) != 0) { +#endif putback_frame(vinfo); ALOGE("%s , %d , Decode MJPEG frame failed \n", __FUNCTION__ , __LINE__); continue; |