android_frameworks_base/media/jni/android_media_Utils.h
Jooyung Han cb1e896d57 Extract android_media_Utils.cpp as a lib
This is a part of job to cut dependency from libmediandk
to libandroid_runtime. As a LL-NDK, libmediandk desn't have
to depend on libandroid_runtime.

dependency: libmediandk -> libmedia_jni -> libandroid_runtime

Libmediandk calls three utility functions defined in
android_media_Utils.cpp. But these functions are independent
from libandroid_runtime.

By extracting those utility functions into its own shared library
(libmedia_jni_utils), the dependency from libmediandk to
libmedia_jni is cut down.

However, some classes and other functions in android_media_Utils.cpp
are moved into new file, android_media_Streams.cpp since they
depend on libandroid_runtime.

Bug: 124268753
Test: m -j
Change-Id: I1e1ea4bc1ff7022d8d9c42785c8c00e3ca153a50
2019-02-22 08:47:24 +00:00

54 lines
1.7 KiB
C++

/*
* Copyright 2011, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ANDROID_MEDIA_UTILS_H_
#define _ANDROID_MEDIA_UTILS_H_
#include <gui/CpuConsumer.h>
namespace android {
// -----------Utility functions used by ImageReader/Writer JNI-----------------
typedef CpuConsumer::LockedBuffer LockedImage;
bool usingRGBAToJpegOverride(int32_t imageFormat, int32_t containerFormat);
int32_t applyFormatOverrides(int32_t imageFormat, int32_t containerFormat);
uint32_t Image_getBlobSize(LockedImage* buffer, bool usingRGBAOverride);
bool isFormatOpaque(int format);
bool isPossiblyYUV(PixelFormat format);
status_t getLockedImageInfo(LockedImage* buffer, int idx, int32_t containerFormat,
uint8_t **base, uint32_t *size, int *pixelStride, int *rowStride);
status_t lockImageFromBuffer(sp<GraphicBuffer> buffer, uint32_t inUsage,
const Rect& rect, int fenceFd, LockedImage* outputImage);
status_t lockImageFromBuffer(BufferItem* bufferItem, uint32_t inUsage,
int fenceFd, LockedImage* outputImage);
int getBufferWidth(BufferItem *buffer);
int getBufferHeight(BufferItem *buffer);
}; // namespace android
#endif // _ANDROID_MEDIA_UTILS_H_