Loading media/libmedia/include/media/omx/1.0/Conversion.h +6 −21 Original line number Diff line number Diff line Loading @@ -606,16 +606,8 @@ inline void wrapAs(AnwBuffer* t, GraphicBuffer const& l) { t->attr.height = l.getHeight(); t->attr.stride = l.getStride(); t->attr.format = static_cast<PixelFormat>(l.getPixelFormat()); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint64_t usage = l.getUsage(); uint32_t usageHigh = (usage >> 32); uint32_t usageLow = (0xFFFFFFFF & usage); uint32_t layerLow = l.getLayerCount(); t->attr.layerCount = ((uint64_t(usageHigh) << 32) | layerLow); t->attr.usage = usageLow; t->attr.layerCount = l.getLayerCount(); t->attr.usage = l.getUsage(); t->attr.id = l.getId(); t->attr.generationNumber = l.getGenerationNumber(); t->nativeHandle = hidl_handle(l.handle); Loading Loading @@ -645,37 +637,30 @@ inline bool convertTo(GraphicBuffer* l, AnwBuffer const& t) { } } size_t const numInts = 13 + (handle ? handle->numInts : 0); size_t const numInts = 12 + (handle ? handle->numInts : 0); int32_t* ints = new int32_t[numInts]; size_t numFds = static_cast<size_t>(handle ? handle->numFds : 0); int* fds = new int[numFds]; ints[0] = 'GB01'; ints[0] = 'GBFR'; ints[1] = static_cast<int32_t>(t.attr.width); ints[2] = static_cast<int32_t>(t.attr.height); ints[3] = static_cast<int32_t>(t.attr.stride); ints[4] = static_cast<int32_t>(t.attr.format); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint32_t layer = (0xFFFFFFFF & t.attr.layerCount); uint32_t usageHigh = (t.attr.layerCount >> 32); ints[5] = layer; ints[5] = static_cast<int32_t>(t.attr.layerCount); ints[6] = static_cast<int32_t>(t.attr.usage); ints[7] = static_cast<int32_t>(t.attr.id >> 32); ints[8] = static_cast<int32_t>(t.attr.id & 0xFFFFFFFF); ints[9] = static_cast<int32_t>(t.attr.generationNumber); ints[10] = 0; ints[11] = 0; ints[12] = usageHigh; if (handle) { ints[10] = static_cast<int32_t>(handle->numFds); ints[11] = static_cast<int32_t>(handle->numInts); int* intsStart = handle->data + handle->numFds; std::copy(handle->data, intsStart, fds); std::copy(intsStart, intsStart + handle->numInts, &ints[13]); std::copy(intsStart, intsStart + handle->numInts, &ints[12]); } void const* constBuffer = static_cast<void const*>(ints); Loading media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h +2 −10 Original line number Diff line number Diff line Loading @@ -425,16 +425,8 @@ inline CodecBuffer *wrapAs(CodecBuffer *t, sp<GraphicBuffer> const& graphicBuffe t->attr.anwBuffer.stride = graphicBuffer->getStride(); t->attr.anwBuffer.format = static_cast<PixelFormat>( graphicBuffer->getPixelFormat()); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint64_t usage = graphicBuffer->getUsage(); uint32_t usageHigh = (usage >> 32); uint32_t usageLow = (0xFFFFFFFF & usage); uint32_t layerLow = graphicBuffer->getLayerCount(); t->attr.anwBuffer.layerCount = ((uint64_t(usageHigh) << 32) | layerLow); t->attr.anwBuffer.usage = usageLow; t->attr.anwBuffer.layerCount = graphicBuffer->getLayerCount(); t->attr.anwBuffer.usage = graphicBuffer->getUsage(); t->nativeHandle = graphicBuffer->handle; return t; } Loading Loading
media/libmedia/include/media/omx/1.0/Conversion.h +6 −21 Original line number Diff line number Diff line Loading @@ -606,16 +606,8 @@ inline void wrapAs(AnwBuffer* t, GraphicBuffer const& l) { t->attr.height = l.getHeight(); t->attr.stride = l.getStride(); t->attr.format = static_cast<PixelFormat>(l.getPixelFormat()); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint64_t usage = l.getUsage(); uint32_t usageHigh = (usage >> 32); uint32_t usageLow = (0xFFFFFFFF & usage); uint32_t layerLow = l.getLayerCount(); t->attr.layerCount = ((uint64_t(usageHigh) << 32) | layerLow); t->attr.usage = usageLow; t->attr.layerCount = l.getLayerCount(); t->attr.usage = l.getUsage(); t->attr.id = l.getId(); t->attr.generationNumber = l.getGenerationNumber(); t->nativeHandle = hidl_handle(l.handle); Loading Loading @@ -645,37 +637,30 @@ inline bool convertTo(GraphicBuffer* l, AnwBuffer const& t) { } } size_t const numInts = 13 + (handle ? handle->numInts : 0); size_t const numInts = 12 + (handle ? handle->numInts : 0); int32_t* ints = new int32_t[numInts]; size_t numFds = static_cast<size_t>(handle ? handle->numFds : 0); int* fds = new int[numFds]; ints[0] = 'GB01'; ints[0] = 'GBFR'; ints[1] = static_cast<int32_t>(t.attr.width); ints[2] = static_cast<int32_t>(t.attr.height); ints[3] = static_cast<int32_t>(t.attr.stride); ints[4] = static_cast<int32_t>(t.attr.format); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint32_t layer = (0xFFFFFFFF & t.attr.layerCount); uint32_t usageHigh = (t.attr.layerCount >> 32); ints[5] = layer; ints[5] = static_cast<int32_t>(t.attr.layerCount); ints[6] = static_cast<int32_t>(t.attr.usage); ints[7] = static_cast<int32_t>(t.attr.id >> 32); ints[8] = static_cast<int32_t>(t.attr.id & 0xFFFFFFFF); ints[9] = static_cast<int32_t>(t.attr.generationNumber); ints[10] = 0; ints[11] = 0; ints[12] = usageHigh; if (handle) { ints[10] = static_cast<int32_t>(handle->numFds); ints[11] = static_cast<int32_t>(handle->numInts); int* intsStart = handle->data + handle->numFds; std::copy(handle->data, intsStart, fds); std::copy(intsStart, intsStart + handle->numInts, &ints[13]); std::copy(intsStart, intsStart + handle->numInts, &ints[12]); } void const* constBuffer = static_cast<void const*>(ints); Loading
media/libstagefright/omx/include/media/stagefright/omx/1.0/Conversion.h +2 −10 Original line number Diff line number Diff line Loading @@ -425,16 +425,8 @@ inline CodecBuffer *wrapAs(CodecBuffer *t, sp<GraphicBuffer> const& graphicBuffe t->attr.anwBuffer.stride = graphicBuffer->getStride(); t->attr.anwBuffer.format = static_cast<PixelFormat>( graphicBuffer->getPixelFormat()); // HACK // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes // anwBuffer.usage 4 bytes : GraphicBuffer::usage 8 bytes // We would like to retain high part of usage with high part of layerCount uint64_t usage = graphicBuffer->getUsage(); uint32_t usageHigh = (usage >> 32); uint32_t usageLow = (0xFFFFFFFF & usage); uint32_t layerLow = graphicBuffer->getLayerCount(); t->attr.anwBuffer.layerCount = ((uint64_t(usageHigh) << 32) | layerLow); t->attr.anwBuffer.usage = usageLow; t->attr.anwBuffer.layerCount = graphicBuffer->getLayerCount(); t->attr.anwBuffer.usage = graphicBuffer->getUsage(); t->nativeHandle = graphicBuffer->handle; return t; } Loading