"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "srcs/api-java/cpp/HEIFJNI.cpp" between
heif-3.6.0.tar.gz and heif-3.6.1.tar.gz

About: HEIF (High Efficiency Image File Format) is a visual media container format for images and image sequences (MPEG-standard). This HEIF engine demonstrates its powerful features and capabilities (under Nokia HEIF license).

HEIFJNI.cpp  (heif-3.6.0):HEIFJNI.cpp  (heif-3.6.1)
skipping to change at line 39 skipping to change at line 39
#include "OverlayImageItem.h" #include "OverlayImageItem.h"
#include "Sample.h" #include "Sample.h"
#include "Track.h" #include "Track.h"
#include "TransformativeProperty.h" #include "TransformativeProperty.h"
#define CLASS_NAME HEIF #define CLASS_NAME HEIF
extern "C" extern "C"
{ {
JNI_METHOD(void, createInstanceNative) JNI_METHOD(void, createInstanceNative)
{ {
auto *instance = new HEIFPP::Heif(); auto* instance = new HEIFPP::Heif();
setNativeHandle(env, self, (jlong) instance); setNativeHandle(env, self, (jlong) instance);
} }
JNI_METHOD(void, destroyInstanceNative) JNI_METHOD(void, destroyInstanceNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
delete nativeHandle; delete nativeHandle;
setNativeHandle(env, self, 0); setNativeHandle(env, self, 0);
} }
JNI_METHOD_ARG(void, loadNative, jstring filename, jint preloadMode) JNI_METHOD_ARG(void, loadNative, jstring filename, jint preloadMode)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeFilename = env->GetStringUTFChars(filename, nullptr); const char* nativeFilename = env->GetStringUTFChars(filename, nullptr);
HEIFPP::Result error = nativeHandle->load(nativeFilename, static_cast<HE IFPP::Heif::PreloadMode>(preloadMode)); HEIFPP::Result error = nativeHandle->load(nativeFilename, static_cast<HE IFPP::Heif::PreloadMode>(preloadMode));
env->ReleaseStringUTFChars(filename, nativeFilename); env->ReleaseStringUTFChars(filename, nativeFilename);
CHECK_ERROR(error, "Loading failed"); CHECK_ERROR(error, "Loading failed");
} }
JNI_METHOD_ARG(void, loadStreamNative, jobject stream, jint preloadMode) JNI_METHOD_ARG(void, loadStreamNative, jobject stream, jint preloadMode)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
auto *inputStream = new InputStream(env, stream); auto* inputStream = new InputStream(env, stream);
HEIFPP::Result error = nativeHandle->load(inputStream, static_cast<HEIFP P::Heif::PreloadMode>(preloadMode)); HEIFPP::Result error = nativeHandle->load(inputStream, static_cast<HEIFP P::Heif::PreloadMode>(preloadMode));
delete inputStream; delete inputStream;
CHECK_ERROR(error, "Loading failed"); CHECK_ERROR(error, "Loading failed");
} }
JNI_METHOD_ARG(void, saveNative, jstring filename) JNI_METHOD_ARG(void, saveNative, jstring filename)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeFilename = env->GetStringUTFChars(filename, nullptr); const char* nativeFilename = env->GetStringUTFChars(filename, nullptr);
HEIFPP::Result error = nativeHandle->save(nativeFilename); HEIFPP::Result error = nativeHandle->save(nativeFilename);
env->ReleaseStringUTFChars(filename, nativeFilename); env->ReleaseStringUTFChars(filename, nativeFilename);
CHECK_ERROR(error, "Saving failed"); CHECK_ERROR(error, "Saving failed");
} }
JNI_METHOD_ARG(void, saveStreamNative, jobject stream) JNI_METHOD_ARG(void, saveStreamNative, jobject stream)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
auto *outputStream = new OutputStream(env, stream); auto* outputStream = new OutputStream(env, stream);
HEIFPP::Result error = nativeHandle->save(outputStream); HEIFPP::Result error = nativeHandle->save(outputStream);
delete outputStream; delete outputStream;
CHECK_ERROR(error, "Saving failed"); CHECK_ERROR(error, "Saving failed");
} }
JNI_METHOD(jint, getItemCountNative) JNI_METHOD(jint, getItemCountNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
return static_cast<jint>(nativeHandle->getItemCount()); return static_cast<jint>(nativeHandle->getItemCount());
} }
JNI_METHOD_ARG(jobject, getItemNative, jint itemIndex) JNI_METHOD_ARG(jobject, getItemNative, jint itemIndex)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
HEIFPP::Item *item = nativeHandle->getItem(static_cast<uint32_t>(itemInd ex)); HEIFPP::Item* item = nativeHandle->getItem(static_cast<uint32_t>(itemInd ex));
return getJavaItem(env, self, item); return getJavaItem(env, self, item);
} }
JNI_METHOD(jint, getImageCountNative) JNI_METHOD(jint, getImageCountNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
return static_cast<jint>(nativeHandle->getImageCount()); return static_cast<jint>(nativeHandle->getImageCount());
} }
JNI_METHOD_ARG(jobject, getImageNative, jint itemIndex) JNI_METHOD_ARG(jobject, getImageNative, jint itemIndex)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
HEIFPP::ImageItem *item = nativeHandle->getImage(static_cast<uint32_t>(i temIndex)); HEIFPP::ImageItem* item = nativeHandle->getImage(static_cast<uint32_t>(i temIndex));
return getJavaItem(env, self, item); return getJavaItem(env, self, item);
} }
JNI_METHOD(jint, getMasterImageCountNative) JNI_METHOD(jint, getMasterImageCountNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
return static_cast<jint>(nativeHandle->getMasterImageCount()); return static_cast<jint>(nativeHandle->getMasterImageCount());
} }
JNI_METHOD_ARG(jobject, getMasterImageNative, jint itemIndex) JNI_METHOD_ARG(jobject, getMasterImageNative, jint itemIndex)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
HEIFPP::ImageItem *item = nativeHandle->getMasterImage(static_cast<uint3 2_t>(itemIndex)); HEIFPP::ImageItem* item = nativeHandle->getMasterImage(static_cast<uint3 2_t>(itemIndex));
return getJavaItem(env, self, item); return getJavaItem(env, self, item);
} }
JNI_METHOD_ARG(jint, getItemsOfTypeCountNative, jstring type) JNI_METHOD_ARG(jint, getItemsOfTypeCountNative, jstring type)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeString = env->GetStringUTFChars(type, nullptr); const char* nativeString = env->GetStringUTFChars(type, nullptr);
jint itemCount = static_cast<jint>(nativeHandle->getItemsOfTypeCount(HEI F::FourCC(nativeString))); jint itemCount = static_cast<jint>(nativeHandle->getItemsOfTypeCount(HEI F::FourCC(nativeString)));
env->ReleaseStringUTFChars(type, nativeString); env->ReleaseStringUTFChars(type, nativeString);
return static_cast<jint>(itemCount); return static_cast<jint>(itemCount);
} }
JNI_METHOD_ARG(jobject, getItemOfTypeNative, jstring type, jint index) JNI_METHOD_ARG(jobject, getItemOfTypeNative, jstring type, jint index)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeString = env->GetStringUTFChars(type, nullptr); const char* nativeString = env->GetStringUTFChars(type, nullptr);
jobject javaObject = getJavaItem( jobject javaObject = getJavaItem(
env, self, nativeHandle->getItemOfType(HEIF::FourCC(nativeString), s tatic_cast<uint32_t>(index))); env, self, nativeHandle->getItemOfType(HEIF::FourCC(nativeString), s tatic_cast<uint32_t>(index)));
env->ReleaseStringUTFChars(type, nativeString); env->ReleaseStringUTFChars(type, nativeString);
return javaObject; return javaObject;
} }
JNI_METHOD(jobject, getPrimaryItemNative) JNI_METHOD(jobject, getPrimaryItemNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
return getJavaItem(env, self, nativeHandle->getPrimaryItem()); return getJavaItem(env, self, nativeHandle->getPrimaryItem());
skipping to change at line 178 skipping to change at line 178
JNI_METHOD_ARG(jstring, getCompatibleBrandNative, jint index) JNI_METHOD_ARG(jstring, getCompatibleBrandNative, jint index)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
HEIF::FourCC brand = nativeHandle->getCompatibleBrand(static_cast<uint32 _t>(index)); HEIF::FourCC brand = nativeHandle->getCompatibleBrand(static_cast<uint32 _t>(index));
return env->NewStringUTF(brand.value); return env->NewStringUTF(brand.value);
} }
JNI_METHOD_ARG(void, addCompatibleBrandNative, jstring brand) JNI_METHOD_ARG(void, addCompatibleBrandNative, jstring brand)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeBrand = env->GetStringUTFChars(brand, nullptr); const char* nativeBrand = env->GetStringUTFChars(brand, nullptr);
nativeHandle->addCompatibleBrand(HEIF::FourCC(nativeBrand)); nativeHandle->addCompatibleBrand(HEIF::FourCC(nativeBrand));
env->ReleaseStringUTFChars(brand, nativeBrand); env->ReleaseStringUTFChars(brand, nativeBrand);
} }
JNI_METHOD_ARG(void, removeCompatibleBrandNative, jstring brand) JNI_METHOD_ARG(void, removeCompatibleBrandNative, jstring brand)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeBrand = env->GetStringUTFChars(brand, nullptr); const char* nativeBrand = env->GetStringUTFChars(brand, nullptr);
nativeHandle->removeCompatibleBrand(HEIF::FourCC(nativeBrand)); nativeHandle->removeCompatibleBrand(HEIF::FourCC(nativeBrand));
env->ReleaseStringUTFChars(brand, nativeBrand); env->ReleaseStringUTFChars(brand, nativeBrand);
} }
JNI_METHOD(jstring, getMajorBrandNative) JNI_METHOD(jstring, getMajorBrandNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
HEIF::FourCC brand = nativeHandle->getMajorBrand(); HEIF::FourCC brand = nativeHandle->getMajorBrand();
return env->NewStringUTF(brand.value); return env->NewStringUTF(brand.value);
} }
JNI_METHOD_ARG(void, setMajorBrandNative, jstring brand) JNI_METHOD_ARG(void, setMajorBrandNative, jstring brand)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
const char *nativeBrand = env->GetStringUTFChars(brand, nullptr); const char* nativeBrand = env->GetStringUTFChars(brand, nullptr);
nativeHandle->setMajorBrand(HEIF::FourCC(nativeBrand)); nativeHandle->setMajorBrand(HEIF::FourCC(nativeBrand));
env->ReleaseStringUTFChars(brand, nativeBrand); env->ReleaseStringUTFChars(brand, nativeBrand);
} }
JNI_METHOD(jint, getPropertyCountNative) JNI_METHOD(jint, getPropertyCountNative)
{ {
NATIVE_HEIF(nativeHandle, self); NATIVE_HEIF(nativeHandle, self);
return static_cast<jint>(nativeHandle->getPropertyCount()); return static_cast<jint>(nativeHandle->getPropertyCount());
} }
 End of changes. 13 change blocks. 
13 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)