Moved java bindings to experimental
This commit is contained in:
123
experimental/java-libburnia/src/jni/libburn/BindingsUtil.c
Normal file
123
experimental/java-libburnia/src/jni/libburn/BindingsUtil.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* BindingsUtil.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#define JAVA_LIBBURN_JNI_VERSION JNI_VERSION_1_4
|
||||
|
||||
static JavaVM* cachedJavaVM;
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
JNI_OnLoad
|
||||
(
|
||||
JavaVM *jvm,
|
||||
void *reserved
|
||||
)
|
||||
{
|
||||
if (jvm == NULL) {
|
||||
perror("null JavaVM pointer");
|
||||
}
|
||||
cachedJavaVM = jvm;
|
||||
return JAVA_LIBBURN_JNI_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TocEntry java class from a burn_toc_entry C struct
|
||||
*/
|
||||
jobject java_libburn_toc_entry_c2java
|
||||
(
|
||||
JNIEnv *env, struct burn_toc_entry *entry
|
||||
)
|
||||
{
|
||||
static jclass tocEntryCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
jobject result;
|
||||
|
||||
if ( tocEntryCls == NULL ) {
|
||||
tocEntryCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/TocEntry");
|
||||
if ( tocEntryCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, tocEntryCls, "<init>", "(BBBBBBBBBBBBBBBII)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
result = (*env)->NewObject(env, tocEntryCls, cid, entry->session, entry->adr, entry->control,
|
||||
entry->tno, entry->point, entry->min, entry->sec, entry->frame, entry->zero, entry->pmin,
|
||||
entry->psec, entry->pframe, entry->extensions_valid, entry->session_msb,
|
||||
entry->point_msb, entry->start_lba, entry->track_blocks);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void java_libburn_throw_burn_exception
|
||||
(
|
||||
JNIEnv *env, const char *msg
|
||||
)
|
||||
{
|
||||
static jclass cls = NULL;
|
||||
|
||||
if ( cls == NULL) {
|
||||
cls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/BurnException");
|
||||
}
|
||||
(*env)->ThrowNew(env, cls, msg);
|
||||
}
|
||||
|
||||
jclass java_libburn_find_class
|
||||
(
|
||||
JNIEnv *env, const char *name
|
||||
)
|
||||
{
|
||||
jclass localRefCls = (*env)->FindClass(env, name);
|
||||
if (localRefCls == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
|
||||
jclass globalRef = (*env)->NewWeakGlobalRef(env, localRefCls);
|
||||
|
||||
(*env)->DeleteLocalRef(env, localRefCls);
|
||||
|
||||
return globalRef; //can be NULL on error, need to be checked!!
|
||||
}
|
||||
|
||||
JNIEnv* java_libburn_get_env()
|
||||
{
|
||||
JNIEnv* env;
|
||||
jint result;
|
||||
|
||||
result = (*cachedJavaVM)->GetEnv(cachedJavaVM, (void **) &env, JAVA_LIBBURN_JNI_VERSION);
|
||||
if ( result != JNI_OK) {
|
||||
switch (result) {
|
||||
case JNI_EDETACHED:
|
||||
perror("[DEBUG] Current thread is not attached. Attaching...");
|
||||
|
||||
JavaVMAttachArgs args;
|
||||
args.version = JAVA_LIBBURN_JNI_VERSION;
|
||||
args.name = "Signal handler callback";
|
||||
args.group = NULL;
|
||||
(*cachedJavaVM)->AttachCurrentThread(cachedJavaVM, (void **)&env, &args);
|
||||
return env;
|
||||
break;
|
||||
case JNI_EVERSION:
|
||||
g_error("Specified version is not supported.");
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return env;
|
||||
}
|
37
experimental/java-libburnia/src/jni/libburn/BindingsUtil.h
Normal file
37
experimental/java-libburnia/src/jni/libburn/BindingsUtil.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* BindingsUtil.h
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
#ifndef _Bindings_Util
|
||||
#define _Bindings_Util
|
||||
|
||||
/**
|
||||
* Creates a new TocEntry java class from a burn_toc_entry C struct
|
||||
*/
|
||||
jobject java_libburn_toc_entry_c2java(JNIEnv *env, struct burn_toc_entry *entry);
|
||||
|
||||
/** throws a new BurnException */
|
||||
void java_libburn_throw_burn_exception(JNIEnv *env, const char *msg);
|
||||
|
||||
/**
|
||||
* Get a reference for a class.
|
||||
* Reference is a global weak ref, so it can be cached.
|
||||
*/
|
||||
jclass java_libburn_find_class(JNIEnv *env, const char *name);
|
||||
|
||||
/** get a JNIEnv */
|
||||
JNIEnv* java_libburn_get_env();
|
||||
|
||||
#endif
|
521
experimental/java-libburnia/src/jni/libburn/Burn.c
Normal file
521
experimental/java-libburnia/src/jni/libburn/Burn.c
Normal file
@ -0,0 +1,521 @@
|
||||
/*
|
||||
* Burn.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Burn.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
static struct burn_drive_info *drive_infos = NULL;
|
||||
|
||||
static int java_libburn_signal_handler(void *handle, int signum, int flag);
|
||||
static int java_libburn_pacifier_func(void *handle, int patience, int elapsed);
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_initialize
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1initialize
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
return burn_initialize();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_finish
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1finish
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
if ( drive_infos != NULL ) {
|
||||
/* if we have a drive array, it must be freed before finish */
|
||||
burn_drive_info_free(drive_infos);
|
||||
}
|
||||
burn_finish();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_preset_device_open
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1preset_1device_1open
|
||||
( JNIEnv *env, jclass cls, jint exclusive, jint blocking, jint abort)
|
||||
{
|
||||
burn_preset_device_open(exclusive, blocking, abort);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_allow_untested_profiles
|
||||
* Signature: (Z)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1allow_1untested_1profiles
|
||||
(
|
||||
JNIEnv *env, jclass cls, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_allow_untested_profiles(yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_scan
|
||||
* Signature: ()[Lorg/pykix/libburnia/libburn/DriveInfo;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1scan
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
unsigned int n_drives;
|
||||
static jclass driveInfoCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
jobjectArray result;
|
||||
int i;
|
||||
|
||||
if ( drive_infos != NULL ) {
|
||||
/* if we already have a drive array, it must be freed before scan again */
|
||||
burn_drive_info_free(drive_infos);
|
||||
}
|
||||
|
||||
while ( !burn_drive_scan(&drive_infos, &n_drives) ) {
|
||||
usleep(1002);
|
||||
}
|
||||
|
||||
if ( n_drives <= 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( driveInfoCls == NULL ) {
|
||||
driveInfoCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/DriveInfo");
|
||||
if ( driveInfoCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, driveInfoCls, "<init>",
|
||||
"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZZZIIIIIJ)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
result = (*env)->NewObjectArray(env, n_drives, driveInfoCls, NULL);
|
||||
|
||||
for ( i = 0; i < n_drives; ++i ) {
|
||||
|
||||
struct burn_drive_info* drive = &(drive_infos[i]);
|
||||
|
||||
jstring vendor = (*env)->NewStringUTF(env, drive->vendor);
|
||||
jstring product = (*env)->NewStringUTF(env, drive->product);
|
||||
jstring revision = (*env)->NewStringUTF(env, drive->revision);
|
||||
jstring location = (*env)->NewStringUTF(env, drive->location);
|
||||
|
||||
jobject jdrive = (*env)->NewObject(env, driveInfoCls, cid, (jlong) drive, vendor, product,
|
||||
revision, location, drive->read_dvdram, drive->read_dvdr, drive->read_dvdrom,
|
||||
drive->read_cdr, drive->read_cdrw, drive->write_dvdram,
|
||||
drive->write_dvdr, drive->write_cdr, drive->write_cdrw,
|
||||
drive->write_simulate, drive->c2_errors, drive->buffer_size,
|
||||
drive->tao_block_types, drive->sao_block_types, drive->raw_block_types,
|
||||
drive->packet_block_types, drive->drive);
|
||||
|
||||
if (jdrive == NULL) {
|
||||
return NULL; /* out of memory error thrown */
|
||||
}
|
||||
|
||||
(*env)->SetObjectArrayElement(env, result, i, jdrive);
|
||||
(*env)->DeleteLocalRef(env, vendor);
|
||||
(*env)->DeleteLocalRef(env, product);
|
||||
(*env)->DeleteLocalRef(env, revision);
|
||||
(*env)->DeleteLocalRef(env, location);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_scan_and_grab
|
||||
* Signature: (Ljava/lang/String;Z)Lorg/pykix/libburnia/libburn/DriveInfo;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1scan_1and_1grab
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring adr, jboolean load
|
||||
)
|
||||
{
|
||||
|
||||
const char* cadr;
|
||||
static jclass driveInfoCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
if ( drive_infos != NULL ) {
|
||||
/* if we already have a drive array, it must be freed before scan again */
|
||||
burn_drive_info_free(drive_infos);
|
||||
}
|
||||
|
||||
cadr = (*env)->GetStringUTFChars(env, adr, NULL);
|
||||
if ( cadr == NULL ) {
|
||||
return NULL; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
if ( burn_drive_scan_and_grab(&drive_infos, (char *)cadr, load) != 1 ) {
|
||||
(*env)->ReleaseStringUTFChars(env, adr, cadr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( driveInfoCls == NULL ) {
|
||||
driveInfoCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/DriveInfo");
|
||||
if ( driveInfoCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, driveInfoCls, "<init>",
|
||||
"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZZZIIIIIJ)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
struct burn_drive_info* drive = &(drive_infos[0]);
|
||||
|
||||
jstring vendor = (*env)->NewStringUTF(env, drive->vendor);
|
||||
jstring product = (*env)->NewStringUTF(env, drive->product);
|
||||
jstring revision = (*env)->NewStringUTF(env, drive->revision);
|
||||
jstring location = (*env)->NewStringUTF(env, drive->location);
|
||||
|
||||
jobject jdrive = (*env)->NewObject(env, driveInfoCls, cid, (jlong) drive, vendor, product,
|
||||
revision, location, drive->read_dvdram, drive->read_dvdr, drive->read_dvdrom,
|
||||
drive->read_cdr, drive->read_cdrw, drive->write_dvdram,
|
||||
drive->write_dvdr, drive->write_cdr, drive->write_cdrw,
|
||||
drive->write_simulate, drive->c2_errors, drive->buffer_size,
|
||||
drive->tao_block_types, drive->sao_block_types, drive->raw_block_types,
|
||||
drive->packet_block_types, drive->drive);
|
||||
|
||||
(*env)->DeleteLocalRef(env, vendor);
|
||||
(*env)->DeleteLocalRef(env, product);
|
||||
(*env)->DeleteLocalRef(env, revision);
|
||||
(*env)->DeleteLocalRef(env, location);
|
||||
(*env)->ReleaseStringUTFChars(env, adr, cadr);
|
||||
|
||||
return jdrive;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_add_whitelist
|
||||
* Signature: (Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1add_1whitelist
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring adr
|
||||
)
|
||||
{
|
||||
const char* cadr;
|
||||
int res;
|
||||
|
||||
cadr = (*env)->GetStringUTFChars(env, adr, NULL);
|
||||
if ( cadr == NULL ) {
|
||||
return -1; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
res = burn_drive_add_whitelist( (char *) adr);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, adr, cadr);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_clear_whitelist
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1clear_1whitelist
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
burn_drive_clear_whitelist();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_set_verbosity
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1set_1verbosity
|
||||
(
|
||||
JNIEnv *env, jclass cls, jint level
|
||||
)
|
||||
{
|
||||
burn_set_verbosity(level);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_is_enumerable_adr
|
||||
* Signature: (Ljava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1is_1enumerable_1adr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring adr
|
||||
)
|
||||
{
|
||||
const char* cadr;
|
||||
int res;
|
||||
|
||||
cadr = (*env)->GetStringUTFChars(env, adr, NULL);
|
||||
if ( cadr == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
res = burn_drive_is_enumerable_adr( (char *) adr);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, adr, cadr);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_drive_convert_fs_adr
|
||||
* Signature: (Ljava/lang/String;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1convert_1fs_1adr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring path
|
||||
)
|
||||
{
|
||||
const char* cpath;
|
||||
char adr[BURN_DRIVE_ADR_LEN];
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return NULL; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
if ( burn_drive_convert_fs_adr( (char *) cpath, adr) != 1) {
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
|
||||
return (*env)->NewStringUTF(env, adr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_abort_def
|
||||
* Signature: (ILjava/lang/String;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1abort_1def
|
||||
(
|
||||
JNIEnv *env, jclass cls, jint patience, jstring msg
|
||||
)
|
||||
{
|
||||
const char *message;
|
||||
int res;
|
||||
|
||||
message = (*env)->GetStringUTFChars(env, msg, NULL);
|
||||
if ( message == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
res = burn_abort(patience, burn_abort_pacifier, (void *) message);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, msg, message);
|
||||
|
||||
if ( res < 0 ) {
|
||||
java_libburn_throw_burn_exception(env, "Can't abort");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_abort_java
|
||||
* Signature: (ILorg/pykix/libburnia/libburn/Burn$AbortHandler;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1abort_1java
|
||||
(
|
||||
JNIEnv *env, jclass cls, jint patience, jobject handler
|
||||
)
|
||||
{
|
||||
|
||||
int res = burn_abort(patience, java_libburn_pacifier_func, (void *) handler);
|
||||
|
||||
if ( res < 0 ) {
|
||||
java_libburn_throw_burn_exception(env, "Can't abort");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int java_libburn_pacifier_func
|
||||
(
|
||||
void *handle, int patience, int elapsed
|
||||
)
|
||||
{
|
||||
/* call back to java */
|
||||
JNIEnv *env;
|
||||
jclass handlerCls;
|
||||
|
||||
env = java_libburn_get_env();
|
||||
|
||||
if ( env == NULL ) {
|
||||
perror("Ups, can't call back to abort java pacifier.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
handlerCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/Burn$AbortHandler");
|
||||
if ( handlerCls == NULL ) {
|
||||
perror("Ups, java handler not found.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
jmethodID mid = (*env)->GetMethodID(env, handlerCls, "abortPacifier", "(II)I");
|
||||
if ( mid == NULL ) {
|
||||
perror("Ups, method not found.\n");
|
||||
return -1;
|
||||
}
|
||||
return (*env)->CallIntMethod(env, (jobject) handle, mid, patience, elapsed);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_set_signal_handling
|
||||
* Signature: (Lorg/pykix/libburnia/libburn/Burn$SignalHandler;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_Burn_burn_1set_1signal_1handling
|
||||
(
|
||||
JNIEnv *env, jclass cls, jobject handler, jint mode
|
||||
)
|
||||
{
|
||||
jobject sh =(*env)->NewGlobalRef(env, handler);
|
||||
burn_set_signal_handling( sh, java_libburn_signal_handler, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_set_default_signal_handling
|
||||
* Signature: (Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1set_1default_1signal_1handling
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring msg, jint mode
|
||||
)
|
||||
{
|
||||
const char *message = NULL;
|
||||
|
||||
if (msg != NULL) {
|
||||
message = (*env)->GetStringUTFChars(env, msg, NULL);
|
||||
if ( message == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
|
||||
burn_set_signal_handling((void *) message, NULL, mode);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, msg, message);
|
||||
}
|
||||
|
||||
static int java_libburn_signal_handler(void *handle, int signum, int flag)
|
||||
{
|
||||
/* call back to java */
|
||||
JNIEnv *env;
|
||||
jclass handlerCls;
|
||||
|
||||
env = java_libburn_get_env();
|
||||
|
||||
if ( env == NULL ) {
|
||||
perror("Ups, can't call back to java handler, just aborting... please wait\n");
|
||||
burn_abort(5, NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
handlerCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/Burn$SignalHandler");
|
||||
if ( handlerCls == NULL ) {
|
||||
perror("Ups, java handler not found, just aborting... please wait\n");
|
||||
burn_abort(5, NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
jmethodID mid = (*env)->GetMethodID(env, handlerCls, "handleSignal", "(II)I");
|
||||
if ( mid == NULL ) {
|
||||
perror("Ups, method not found, just aborting... please wait\n");
|
||||
burn_abort(5, NULL, NULL);
|
||||
return -1;
|
||||
}
|
||||
return (*env)->CallIntMethod(env, (jobject) handle, mid, signum, flag);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Burn
|
||||
* Method: burn_version
|
||||
* Signature: ()Lorg/pykix/libburnia/libburn/Burn$Version;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Burn_burn_1version
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
int major;
|
||||
int minor;
|
||||
int micro;
|
||||
static jclass versionCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
if ( versionCls == NULL ) {
|
||||
versionCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/Burn$Version");
|
||||
if ( versionCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, versionCls, "<init>", "(III)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
burn_version(&major, &minor, µ);
|
||||
|
||||
return (*env)->NewObject(env, versionCls, cid, major, minor, micro);
|
||||
}
|
||||
|
123
experimental/java-libburnia/src/jni/libburn/Disc.c
Normal file
123
experimental/java-libburnia/src/jni/libburn/Disc.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Disc.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Disc.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_create
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1create
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
return (jlong) burn_disc_create();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
burn_disc_free( (struct burn_disc *) d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_add_session
|
||||
* Signature: (JJI)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1add_1session
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong s, jint pos
|
||||
)
|
||||
{
|
||||
return burn_disc_add_session( (struct burn_disc *) d,
|
||||
(struct burn_session *) s, pos);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_remove_session
|
||||
* Signature: (JJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1remove_1session
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong s
|
||||
)
|
||||
{
|
||||
return burn_disc_remove_session( (struct burn_disc *) d, (struct burn_session *) s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_get_sessions
|
||||
* Signature: (J)[J
|
||||
*/
|
||||
JNIEXPORT jlongArray JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1get_1sessions
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
int num;
|
||||
struct burn_session **sessions;
|
||||
int i;
|
||||
|
||||
sessions = burn_disc_get_sessions( (struct burn_disc *) d, &num);
|
||||
|
||||
/* create C array to store the pointers */
|
||||
jlong cresult[num];
|
||||
|
||||
for ( i = 0; i < num; ++i ) {
|
||||
struct burn_session *session = sessions[i];
|
||||
cresult[i] = (jlong) session;
|
||||
}
|
||||
|
||||
/* move the pointer to a Java array */
|
||||
jlongArray result = (*env)->NewLongArray(env, num);
|
||||
if ( result == NULL) {
|
||||
return NULL; /* exception already thrown */
|
||||
}
|
||||
(*env)->SetLongArrayRegion(env, result, 0, num, cresult);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Disc
|
||||
* Method: burn_disc_get_sectors
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1get_1sectors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_disc_get_sectors( (struct burn_disc *) d);
|
||||
}
|
672
experimental/java-libburnia/src/jni/libburn/Drive.c
Normal file
672
experimental/java-libburnia/src/jni/libburn/Drive.c
Normal file
@ -0,0 +1,672 @@
|
||||
/*
|
||||
* Drive.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Drive.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_grab
|
||||
* Signature: (JI)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1grab
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive, jint load
|
||||
)
|
||||
{
|
||||
return burn_drive_grab( (struct burn_drive *) drive, load);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_release
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1release
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive, jint eject
|
||||
)
|
||||
{
|
||||
burn_drive_release( (struct burn_drive *) drive, eject);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_status
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1status
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return burn_disc_get_status( (struct burn_drive *) drive );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_profile
|
||||
* Signature: (J)S
|
||||
*/
|
||||
JNIEXPORT jshort JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1profile
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
int pno;
|
||||
char name[80];
|
||||
|
||||
if ( burn_disc_get_profile( (struct burn_drive *) d, &pno, name) ) {
|
||||
return (jshort) pno;
|
||||
} else {
|
||||
return 0; //no profile
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_erasable
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1erasable
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_disc_erasable( (struct burn_drive *) d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_status
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1status
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive, jlong p
|
||||
)
|
||||
{
|
||||
return burn_drive_get_status( (struct burn_drive *)drive, (struct burn_progress *) p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_erase
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1erase
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive, jboolean fast
|
||||
)
|
||||
{
|
||||
burn_disc_erase( (struct burn_drive *) drive, fast);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_write_opts_new
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1write_1opts_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return (jlong) burn_write_opts_new( (struct burn_drive *) drive);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_available_space
|
||||
* Signature: (JJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1available_1space
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong o
|
||||
)
|
||||
{
|
||||
|
||||
return burn_disc_available_space( (struct burn_drive *) d,
|
||||
(struct burn_write_opts *) o);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_write
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1write
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong o, jlong disc
|
||||
)
|
||||
{
|
||||
burn_disc_write( (struct burn_write_opts *) o, (struct burn_disc *) disc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_format
|
||||
* Signature: (JJI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1format
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive, jlong size, jint flag
|
||||
)
|
||||
{
|
||||
burn_disc_format( (struct burn_drive *) drive, size, flag);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_cancel
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1cancel
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
burn_drive_cancel( (struct burn_drive *) d );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_wrote_well
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1wrote_1well
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_drive_wrote_well( (struct burn_drive *) d );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_disc
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1disc
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return (jlong) burn_drive_get_disc( (struct burn_drive *) d );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_set_speed
|
||||
* Signature: (JII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1set_1speed
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint r , jint w
|
||||
)
|
||||
{
|
||||
burn_drive_set_speed( (struct burn_drive *) d, r, w);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_write_speed
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1write_1speed
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return burn_drive_get_write_speed( (struct burn_drive *) drive);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_min_write_speed
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1min_1write_1speed
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return burn_drive_get_min_write_speed( (struct burn_drive *) drive);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_read_speed
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1read_1speed
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return burn_drive_get_read_speed( (struct burn_drive *) drive);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_read_opts_new
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1read_1opts_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong drive
|
||||
)
|
||||
{
|
||||
return (jlong) burn_read_opts_new( (struct burn_drive *) drive);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_speedlist
|
||||
* Signature: (J)[Lorg/pykix/libburnia/libburn/SpeedDescriptor;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1speedlist
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
struct burn_speed_descriptor *list;
|
||||
int count = 0;
|
||||
static jclass speedDescCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
jobjectArray result;
|
||||
|
||||
if ( speedDescCls == NULL ) {
|
||||
speedDescCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/SpeedDescriptor");
|
||||
if ( speedDescCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, speedDescCls, "<init>", "(ISIIIIZZ)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
int res = burn_drive_get_speedlist((struct burn_drive *) d, &list);
|
||||
|
||||
if ( res < 0 ) {
|
||||
return NULL; //error
|
||||
}
|
||||
|
||||
/* count speed descs */
|
||||
if ( res != 0) {
|
||||
|
||||
/* no empty list */
|
||||
count = 1;
|
||||
struct burn_speed_descriptor *sd = list;
|
||||
while ( (sd = sd->next) != NULL) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
result = (*env)->NewObjectArray(env, count, speedDescCls, NULL);
|
||||
|
||||
int i;
|
||||
struct burn_speed_descriptor *csd = list;
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
jobject sd = (*env)->NewObject(env, speedDescCls, cid, csd->source,
|
||||
(jshort) csd->profile_loaded, csd->end_lba, csd->write_speed,
|
||||
csd->read_speed, csd->wrc, csd->exact, csd->mrw);
|
||||
|
||||
if (sd == NULL) {
|
||||
return NULL; /* out of memory error thrown */
|
||||
}
|
||||
|
||||
(*env)->SetObjectArrayElement(env, result, i, sd);
|
||||
csd = csd->next;
|
||||
}
|
||||
|
||||
/* free speed list returned by libburn */
|
||||
burn_drive_free_speedlist( &list );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_pretend_blank
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1pretend_1blank
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_disc_pretend_blank( (struct burn_drive *) d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_pretend_full
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1pretend_1full
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_disc_pretend_full( (struct burn_drive *) d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_read_atip
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1read_1atip
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
return burn_disc_read_atip( (struct burn_drive *) d );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_start_lba
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1start_1lba
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint flag
|
||||
)
|
||||
{
|
||||
int start_lba, end_lba;
|
||||
|
||||
if ( burn_drive_get_start_end_lba( (struct burn_drive *) d,
|
||||
&start_lba, &end_lba, flag) == 1 ) {
|
||||
|
||||
/* valid values */
|
||||
return start_lba;
|
||||
} else {
|
||||
/* invalid, throw exception */
|
||||
java_libburn_throw_burn_exception(env, "Can't get valid LBA value");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_drive_get_end_lba
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1end_1lba
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint flag
|
||||
)
|
||||
{
|
||||
int start_lba, end_lba;
|
||||
|
||||
if ( burn_drive_get_start_end_lba( (struct burn_drive *) d,
|
||||
&start_lba, &end_lba, flag) == 1 ) {
|
||||
|
||||
/* valid values */
|
||||
return end_lba;
|
||||
} else {
|
||||
/* invalid, throw exception */
|
||||
java_libburn_throw_burn_exception(env, "Can't get valid LBA value");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_track_lba
|
||||
* Signature: (JJI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1track_1lba
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong o, jint trackno
|
||||
)
|
||||
{
|
||||
int lba, nwa;
|
||||
|
||||
int res = burn_disc_track_lba_nwa( (struct burn_drive *) d, (struct burn_write_opts *) o,
|
||||
trackno, &lba, &nwa);
|
||||
|
||||
if ( res < 0 ) {
|
||||
java_libburn_throw_burn_exception(env, "Can't get Track LBA");
|
||||
return -1;
|
||||
} else {
|
||||
return lba;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_track_nwa
|
||||
* Signature: (JJI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1track_1nwa
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong o, jint trackno
|
||||
)
|
||||
{
|
||||
int lba, nwa;
|
||||
|
||||
int res = burn_disc_track_lba_nwa( (struct burn_drive *) d, (struct burn_write_opts *) o,
|
||||
trackno, &lba, &nwa);
|
||||
|
||||
switch (res) {
|
||||
case 1:
|
||||
return nwa;
|
||||
case 0:
|
||||
java_libburn_throw_burn_exception(env, "Track nwa is not valid");
|
||||
return -1;
|
||||
default:
|
||||
java_libburn_throw_burn_exception(env, "Can't get Track nwa");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_msc1
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1msc1
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
int start_lba;
|
||||
if ( burn_disc_get_msc1( (struct burn_drive *) d, &start_lba) == 1 ) {
|
||||
return start_lba;
|
||||
} else {
|
||||
java_libburn_throw_burn_exception(env, "Can't get msc1");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_multi_caps
|
||||
* Signature: (JII)Lorg/pykix/libburnia/libburn/MultiCaps;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1multi_1caps
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint wt, jint flag
|
||||
)
|
||||
{
|
||||
struct burn_multi_caps *caps;
|
||||
static jclass multiCapsCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
int res = burn_disc_get_multi_caps( (struct burn_drive *) d, wt, &caps, flag);
|
||||
|
||||
if ( res < 0 ) {
|
||||
java_libburn_throw_burn_exception(env, "Can't get multi caps");
|
||||
//TODO is needed the free of caps???
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( multiCapsCls == NULL ) {
|
||||
multiCapsCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/MultiCaps");
|
||||
if ( multiCapsCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, multiCapsCls, "<init>", "(ZZZJJJIIIIISZZ)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
jobject mc = (*env)->NewObject(env, multiCapsCls, cid, caps->multi_session, caps->multi_track,
|
||||
caps->start_adr, caps->start_alignment, caps->start_range_low, caps->start_range_high,
|
||||
caps->might_do_tao, caps->might_do_sao, caps->might_do_raw, caps->advised_write_mode,
|
||||
caps->selected_write_mode, caps->current_profile, caps->current_is_cd_profile, res);
|
||||
|
||||
burn_disc_free_multi_caps(&caps);
|
||||
|
||||
return mc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_read
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1read
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jlong o
|
||||
)
|
||||
{
|
||||
burn_disc_read( (struct burn_drive *) d, (const struct burn_read_opts *) o);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_formats
|
||||
* Signature: (J)Lorg/pykix/libburnia/libburn/Formats;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1formats
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
int status;
|
||||
off_t size;
|
||||
unsigned bl_sas;
|
||||
int num_formats;
|
||||
static jclass formatsCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
if ( burn_disc_get_formats( (struct burn_drive *) d, &status, &size,
|
||||
&bl_sas, &num_formats) != 1 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( formatsCls == NULL ) {
|
||||
formatsCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/Formats");
|
||||
if ( formatsCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, formatsCls, "<init>", "(IJII)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
return (*env)->NewObject(env, formatsCls, cid, status, size, bl_sas, num_formats);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Drive
|
||||
* Method: burn_disc_get_format_descr
|
||||
* Signature: (JI)Lorg/pykix/libburnia/libburn/FormatDesc;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1format_1descr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint index
|
||||
)
|
||||
{
|
||||
int type;
|
||||
off_t size;
|
||||
unsigned tdp;
|
||||
static jclass formatDescCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
if ( burn_disc_get_format_descr( (struct burn_drive *) d, index,
|
||||
&type, &size, &tdp) != 1 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( formatDescCls == NULL ) {
|
||||
formatDescCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/FormatDesc");
|
||||
if ( formatDescCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, formatDescCls, "<init>", "(IJI)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
return (*env)->NewObject(env, formatDescCls, cid, type, size, tdp);
|
||||
}
|
||||
|
||||
|
49
experimental/java-libburnia/src/jni/libburn/DriveInfo.c
Normal file
49
experimental/java-libburnia/src/jni/libburn/DriveInfo.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* DriveInfo.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_DriveInfo.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_DriveInfo
|
||||
* Method: burn_drive_info_forget
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_DriveInfo_burn_1drive_1info_1forget
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d, jint force
|
||||
)
|
||||
{
|
||||
return burn_drive_info_forget( (struct burn_drive_info *) d, force);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_DriveInfo
|
||||
* Method: burn_drive_get_adr
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_pykix_libburnia_libburn_DriveInfo_burn_1drive_1get_1adr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong d
|
||||
)
|
||||
{
|
||||
char adr[BURN_DRIVE_ADR_LEN];
|
||||
|
||||
if ( burn_drive_get_adr( (struct burn_drive_info *) d, adr) <= 0 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (*env)->NewStringUTF(env, adr);
|
||||
}
|
111
experimental/java-libburnia/src/jni/libburn/Message.c
Normal file
111
experimental/java-libburnia/src/jni/libburn/Message.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Message.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Message.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Message
|
||||
* Method: burn_msgs_set_severities
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Message_burn_1msgs_1set_1severities
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring queueSev, jstring printSev, jstring printId
|
||||
)
|
||||
{
|
||||
int res;
|
||||
const char *queue_severity;
|
||||
const char *print_severity;
|
||||
const char *print_id;
|
||||
|
||||
queue_severity = (*env)->GetStringUTFChars(env, queueSev, NULL);
|
||||
if ( queue_severity == NULL ) {
|
||||
return -1; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
print_severity = (*env)->GetStringUTFChars(env, printSev, NULL);
|
||||
if ( print_severity == NULL ) {
|
||||
return -1; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
print_id = (*env)->GetStringUTFChars(env, printId, NULL);
|
||||
if ( print_id == NULL ) {
|
||||
return -1; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
|
||||
res = burn_msgs_set_severities( (char *) queue_severity,
|
||||
(char *) print_severity, (char *) print_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, queueSev, queue_severity);
|
||||
(*env)->ReleaseStringUTFChars(env, printSev, print_severity);
|
||||
(*env)->ReleaseStringUTFChars(env, printId, print_id);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Message
|
||||
* Method: burn_msgs_obtain
|
||||
* Signature: (Ljava/lang/String;)Lorg/pykix/libburnia/libburn/Message;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Message_burn_1msgs_1obtain
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring minSev
|
||||
)
|
||||
{
|
||||
|
||||
const char *minimum_severity;
|
||||
int error_code;
|
||||
int os_errno;
|
||||
char msg_text[BURN_MSGS_MESSAGE_LEN];
|
||||
char severity[80];
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
minimum_severity = (*env)->GetStringUTFChars(env, minSev, NULL);
|
||||
if ( minimum_severity == NULL ) {
|
||||
return NULL; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, cls, "<init>", "(ILjava/lang/String;ILjava/lang/String;)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
int res = burn_msgs_obtain( (char *) minimum_severity, &error_code, msg_text,
|
||||
&os_errno, severity);
|
||||
|
||||
jobject message = NULL;
|
||||
if ( res == 1 ) {
|
||||
|
||||
jstring msgText = (*env)->NewStringUTF(env, msg_text);
|
||||
jstring sev = (*env)->NewStringUTF(env, severity);
|
||||
|
||||
message = (*env)->NewObject(env, cls, cid, error_code, msgText, os_errno, sev);
|
||||
|
||||
(*env)->DeleteLocalRef(env, msgText);
|
||||
(*env)->DeleteLocalRef(env, sev);
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, minSev, minimum_severity);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
229
experimental/java-libburnia/src/jni/libburn/Progress.c
Normal file
229
experimental/java-libburnia/src/jni/libburn/Progress.c
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Progress.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Progress.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "libburn.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_new
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
//FIXME: sizeof(struct burn_progress) == 52, but if we alloc less
|
||||
//than 53 bytes code breaks, I don't known the reason!!!
|
||||
//return (jlong) calloc(1, sizeof(struct burn_progress) );
|
||||
return (jlong) calloc(1, 54 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
free( (void *) p );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_sessions
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sessions
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->sessions;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_session
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1session
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->session;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_tracks
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1tracks
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->tracks;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_track
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1track
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->track;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_indices
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1indices
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->indices;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_index
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1index
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->index;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_start_sector
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1start_1sector
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->start_sector;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_sectors
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sectors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->sectors;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_sector
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sector
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->sector;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_buffer_capacity
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1capacity
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->buffer_capacity;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_buffer_available
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1available
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->buffer_available;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_buffered_bytes
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffered_1bytes
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->buffered_bytes;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Progress
|
||||
* Method: burn_progress_buffer_min_fill
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1min_1fill
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong p
|
||||
)
|
||||
{
|
||||
return ((struct burn_progress*) p)->buffer_min_fill;
|
||||
}
|
||||
|
135
experimental/java-libburnia/src/jni/libburn/ReadOpts.c
Normal file
135
experimental/java-libburnia/src/jni/libburn/ReadOpts.c
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* ReadOpts.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_ReadOpts.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts
|
||||
)
|
||||
{
|
||||
burn_read_opts_free( (struct burn_read_opts *) opts);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_set_raw
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1raw
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_set_raw( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_set_c2errors
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1c2errors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_set_c2errors( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_read_subcodes_audio
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1read_1subcodes_1audio
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_read_subcodes_audio( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_read_subcodes_data
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1read_1subcodes_1data
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_read_subcodes_data( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_set_hardware_error_recovery
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1hardware_1error_1recovery
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_set_hardware_error_recovery( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_report_recovered_errors
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1report_1recovered_1errors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_report_recovered_errors( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_transfer_damaged_blocks
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1transfer_1damaged_1blocks
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean yes
|
||||
)
|
||||
{
|
||||
burn_read_opts_transfer_damaged_blocks( (struct burn_read_opts *) opts, yes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ReadOpts
|
||||
* Method: burn_read_opts_set_hardware_error_retries
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1hardware_1error_1retries
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jint r
|
||||
)
|
||||
{
|
||||
burn_read_opts_set_hardware_error_retries( (struct burn_read_opts *) opts, r);
|
||||
}
|
||||
|
91
experimental/java-libburnia/src/jni/libburn/ScsiAdr.c
Normal file
91
experimental/java-libburnia/src/jni/libburn/ScsiAdr.c
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* ScsiAdr.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_ScsiAdr.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ScsiAdr
|
||||
* Method: burn_drive_convert_scsi_adr
|
||||
* Signature: (IIIII)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_pykix_libburnia_libburn_ScsiAdr_burn_1drive_1convert_1scsi_1adr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jint bus_no, jint host_no, jint channel_no,
|
||||
jint target_no, jint lun_no
|
||||
)
|
||||
{
|
||||
char adr[BURN_DRIVE_ADR_LEN];
|
||||
|
||||
if ( burn_drive_convert_scsi_adr(bus_no, host_no, channel_no,
|
||||
target_no, lun_no, adr) != 1 ) {
|
||||
java_libburn_throw_burn_exception(env, "Can't convert SCSI adr");
|
||||
return NULL;
|
||||
}
|
||||
return (*env)->NewStringUTF(env, adr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_ScsiAdr
|
||||
* Method: burn_drive_obtain_scsi_adr
|
||||
* Signature: (Ljava/lang/String;)Lorg/pykix/libburnia/libburn/ScsiAdr;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_ScsiAdr_burn_1drive_1obtain_1scsi_1adr
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring path
|
||||
)
|
||||
{
|
||||
const char* cpath;
|
||||
int bus_no;
|
||||
int host_no;
|
||||
int channel_no;
|
||||
int target_no;
|
||||
int lun_no;
|
||||
static jclass scsiAdrCls = NULL;
|
||||
static jmethodID cid = NULL;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return NULL; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
if ( burn_drive_obtain_scsi_adr( (char *) path, &bus_no, &host_no,
|
||||
&channel_no, &target_no, &lun_no) != 1 ) {
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
java_libburn_throw_burn_exception(env, "Can't convert SCSI adr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
|
||||
if ( scsiAdrCls == NULL ) {
|
||||
scsiAdrCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/ScsiAdr");
|
||||
if ( scsiAdrCls == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cid == NULL ) {
|
||||
cid = (*env)->GetMethodID(env, scsiAdrCls, "<init>", "(IIIII)V");
|
||||
if (cid == NULL) {
|
||||
return NULL; /* exception thrown */
|
||||
}
|
||||
}
|
||||
|
||||
return (*env)->NewObject(env, scsiAdrCls, cid, bus_no, host_no,
|
||||
channel_no, target_no, lun_no);
|
||||
}
|
168
experimental/java-libburnia/src/jni/libburn/Session.c
Normal file
168
experimental/java-libburnia/src/jni/libburn/Session.c
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Session.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Session.h"
|
||||
|
||||
#include "libburn.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_create
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1create
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
return (jlong) burn_session_create();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
burn_session_free( (struct burn_session *) s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_add_track
|
||||
* Signature: (JJI)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1add_1track
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s, jlong t, jint pos
|
||||
)
|
||||
{
|
||||
return burn_session_add_track( (struct burn_session *) s,
|
||||
(struct burn_track *) t, pos);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_remove_track
|
||||
* Signature: (JJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1remove_1track
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s, jlong t
|
||||
)
|
||||
{
|
||||
return burn_session_remove_track( (struct burn_session *) s, (struct burn_track *) t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_hide_first_track
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1hide_1first_1track
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s, jint onoff
|
||||
)
|
||||
{
|
||||
burn_session_hide_first_track( (struct burn_session *) s, onoff );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_get_sectors
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1sectors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
return burn_session_get_sectors( (struct burn_session *) s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_get_leadout_entry
|
||||
* Signature: (J)Lorg/pykix/libburnia/libburn/TocEntry;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1leadout_1entry
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
struct burn_toc_entry entry;
|
||||
|
||||
burn_session_get_leadout_entry( (struct burn_session *) s, &entry);
|
||||
|
||||
return java_libburn_toc_entry_c2java(env, &entry);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_get_tracks
|
||||
* Signature: (J)[J
|
||||
*/
|
||||
JNIEXPORT jlongArray JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1tracks
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
int num;
|
||||
struct burn_track **tracks;
|
||||
int i;
|
||||
|
||||
tracks = burn_session_get_tracks( (struct burn_session *) s, &num);
|
||||
|
||||
/* create C array to store the pointers */
|
||||
jlong cresult[num];
|
||||
|
||||
for ( i = 0; i < num; ++i ) {
|
||||
struct burn_track *track = tracks[i];
|
||||
cresult[i] = (jlong) track;
|
||||
}
|
||||
|
||||
/* move the pointer to a Java array */
|
||||
jlongArray result = (*env)->NewLongArray(env, num);
|
||||
if ( result == NULL) {
|
||||
return NULL; /* exception already thrown */
|
||||
}
|
||||
(*env)->SetLongArrayRegion(env, result, 0, num, cresult);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Session
|
||||
* Method: burn_session_get_hidefirst
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1hidefirst
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
return burn_session_get_hidefirst( (struct burn_session *) s);
|
||||
}
|
||||
|
182
experimental/java-libburnia/src/jni/libburn/Source.c
Normal file
182
experimental/java-libburnia/src/jni/libburn/Source.c
Normal file
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Source.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Source.h"
|
||||
|
||||
#include "libburn.h"
|
||||
#include "libisofs.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: burn_file_source_new
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_burn_1file_1source_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring path, jstring subPath
|
||||
)
|
||||
{
|
||||
const char *cpath = NULL;
|
||||
const char *subpath = NULL;
|
||||
struct burn_source *src;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
if ( subPath != NULL ) {
|
||||
subpath = (*env)->GetStringUTFChars(env, subPath, NULL);
|
||||
if (subpath == NULL) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
|
||||
src = burn_file_source_new(cpath, subpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
(*env)->ReleaseStringUTFChars(env, subPath, subpath);
|
||||
|
||||
return (jlong) src;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: burn_fd_source_new
|
||||
* Signature: (IIJ)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Source_burn_1fd_1source_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls, jint datafd, jint subfd, jlong size
|
||||
)
|
||||
{
|
||||
return (jlong) burn_fd_source_new(datafd, subfd, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: iso_source_new_ecma119
|
||||
* Signature: (JIII)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_iso_1source_1new_1ecma119
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volumeset, jint volnum, jint level, jint flags)
|
||||
{
|
||||
|
||||
return (jlong) iso_source_new_ecma119 ( (struct iso_volset *) volumeset, volnum, level, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: read
|
||||
* Signature: (J[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_read
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong burnSource, jbyteArray byteBuffer, jint size
|
||||
)
|
||||
{
|
||||
struct burn_source *source;
|
||||
jbyte *buffer = NULL;
|
||||
|
||||
source = (struct burn_source *) burnSource;
|
||||
|
||||
buffer = (*env)->GetByteArrayElements(env, byteBuffer, NULL);
|
||||
if (buffer == NULL) {
|
||||
return -1; /* exception occurred */
|
||||
}
|
||||
|
||||
int n = source->read(source, buffer, size);
|
||||
|
||||
(*env)->ReleaseByteArrayElements(env, byteBuffer, buffer, 0);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: read_sub
|
||||
* Signature: (J[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_read_1sub
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong burnSource, jbyteArray byteBuffer, jint size
|
||||
)
|
||||
{
|
||||
struct burn_source *source;
|
||||
jbyte *buffer = NULL;
|
||||
|
||||
source = (struct burn_source *) burnSource;
|
||||
|
||||
buffer = (*env)->GetByteArrayElements(env, byteBuffer, NULL);
|
||||
if (buffer == NULL) {
|
||||
return -1; /* exception occurred */
|
||||
}
|
||||
|
||||
int n = source->read_sub(source, buffer, size);
|
||||
|
||||
(*env)->ReleaseByteArrayElements(env, byteBuffer, buffer, 0);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: get_size
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_get_1size
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong burnSource
|
||||
)
|
||||
{
|
||||
struct burn_source *source;
|
||||
|
||||
source = (struct burn_source *) burnSource;
|
||||
|
||||
off_t size = source->get_size(source);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: set_size
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_set_1size
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong burnSource, jlong size
|
||||
)
|
||||
{
|
||||
struct burn_source *source;
|
||||
|
||||
source = (struct burn_source *) burnSource;
|
||||
|
||||
int n = source->set_size(source, size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Source
|
||||
* Method: burn_source_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_Source_burn_1source_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong s
|
||||
)
|
||||
{
|
||||
burn_source_free( (struct burn_source *) s);
|
||||
}
|
||||
|
223
experimental/java-libburnia/src/jni/libburn/Track.c
Normal file
223
experimental/java-libburnia/src/jni/libburn/Track.c
Normal file
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Track.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_Track.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_create
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1create
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
return (jlong) burn_track_create();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
burn_track_free( (struct burn_track *) t );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_define_data
|
||||
* Signature: (JIIZI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1define_1data
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t, jint offset, jint tail, jboolean pad, jint mode
|
||||
)
|
||||
{
|
||||
burn_track_define_data( (struct burn_track *) t, offset, tail, pad, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_set_byte_swap
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1byte_1swap
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t, jint swapSourceBytes
|
||||
)
|
||||
{
|
||||
return burn_track_set_byte_swap( (struct burn_track *) t, swapSourceBytes);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_set_isrc
|
||||
* Signature: (JLjava/lang/String;Ljava/lang/String;BI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1isrc
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t, jstring country, jstring owner, jbyte year, jint serial
|
||||
)
|
||||
{
|
||||
const char *ccountry;
|
||||
const char *cowner;
|
||||
|
||||
ccountry = (*env)->GetStringUTFChars(env, country, NULL);
|
||||
if ( ccountry == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
cowner = (*env)->GetStringUTFChars(env, owner, NULL);
|
||||
if ( cowner == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
burn_track_set_isrc( (struct burn_track *) t, (char *) ccountry, (char *) cowner, year, serial);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, country, ccountry);
|
||||
(*env)->ReleaseStringUTFChars(env, owner, cowner);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_clear_isrc
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1clear_1isrc
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
burn_track_clear_isrc( (struct burn_track *) t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_set_source
|
||||
* Signature: (JJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1source
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t, jlong s
|
||||
)
|
||||
{
|
||||
return burn_track_set_source( (struct burn_track *) t, (struct burn_source *) s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_set_default_size
|
||||
* Signature: (JJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1default_1size
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t, jlong size
|
||||
)
|
||||
{
|
||||
return burn_track_set_default_size( (struct burn_track *) t, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_get_sectors
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1sectors
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
return burn_track_get_sectors( (struct burn_track *) t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_get_entry
|
||||
* Signature: (J)Lorg/pykix/libburnia/libburn/TocEntry;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1entry
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
struct burn_toc_entry entry;
|
||||
|
||||
burn_track_get_entry( (struct burn_track *) t, &entry);
|
||||
|
||||
return java_libburn_toc_entry_c2java(env, &entry);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_get_mode
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1mode
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
return burn_track_get_mode( (struct burn_track *) t );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_get_read_bytes
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1read_1bytes
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
off_t r, w;
|
||||
burn_track_get_counters( (struct burn_track *) t, &r, &w);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_Track
|
||||
* Method: burn_track_get_written_bytes
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1written_1bytes
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong t
|
||||
)
|
||||
{
|
||||
off_t r, w;
|
||||
burn_track_get_counters( (struct burn_track *) t, &r, &w);
|
||||
return w;
|
||||
}
|
||||
|
304
experimental/java-libburnia/src/jni/libburn/WriteOpts.c
Normal file
304
experimental/java-libburnia/src/jni/libburn/WriteOpts.c
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
* WriteOpts.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libburn_WriteOpts.h"
|
||||
#include "BindingsUtil.h"
|
||||
|
||||
#include "libburn.h"
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts
|
||||
)
|
||||
{
|
||||
burn_write_opts_free( (struct burn_write_opts *) opts);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_write_type
|
||||
* Signature: (JII)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1write_1type
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jint write_type, jint block_type
|
||||
)
|
||||
{
|
||||
return burn_write_opts_set_write_type( (struct burn_write_opts *) opts,
|
||||
write_type, block_type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_auto_write_type
|
||||
* Signature: (JJI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1auto_1write_1type
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jlong disc, jint flag
|
||||
)
|
||||
{
|
||||
char reasons[BURN_REASONS_LEN];
|
||||
|
||||
return burn_write_opts_auto_write_type( (struct burn_write_opts *) opts,
|
||||
(struct burn_disc *) disc, reasons, flag);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_simulate
|
||||
* Signature: (JZ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1simulate
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean sim
|
||||
)
|
||||
{
|
||||
return burn_write_opts_set_simulate( (struct burn_write_opts *) opts, sim);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_underrun_proof
|
||||
* Signature: (JZ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1underrun_1proof
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean underrun_proof
|
||||
)
|
||||
{
|
||||
return burn_write_opts_set_underrun_proof( (struct burn_write_opts *) opts, underrun_proof);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_perform_opc
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1perform_1opc
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean opc
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_perform_opc( (struct burn_write_opts *) opts, opc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_multi
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1multi
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean multi
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_multi( (struct burn_write_opts *) opts, multi);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_force
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1force
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jint use_force
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_force( (struct burn_write_opts *) opts, use_force);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_start_byte
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1start_1byte
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jlong value
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_start_byte( (struct burn_write_opts *) opts, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_format
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1format
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jint format
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_format( (struct burn_write_opts *) opts, format);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_has_mediacatalog
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1has_1mediacatalog
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jboolean has_mediacatalog
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_has_mediacatalog( (struct burn_write_opts *)opts, has_mediacatalog);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_mediacatalog
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1mediacatalog
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong opts, jstring mediaCatalog
|
||||
)
|
||||
{
|
||||
const char *mediacatalog;
|
||||
|
||||
mediacatalog = (*env)->GetStringUTFChars(env, mediaCatalog, NULL);
|
||||
if ( mediacatalog == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
burn_write_opts_set_mediacatalog( (struct burn_write_opts *) opts, (unsigned char*) mediacatalog);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, mediaCatalog, mediacatalog);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_precheck_write
|
||||
* Signature: (JJI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1precheck_1write
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong o, jlong disc, jint silent
|
||||
)
|
||||
{
|
||||
char reasons[BURN_REASONS_LEN];
|
||||
|
||||
if ( burn_precheck_write( (struct burn_write_opts *) o, (struct burn_disc *) disc,
|
||||
reasons, silent) != 1 ) {
|
||||
|
||||
java_libburn_throw_burn_exception(env, reasons);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_fillup
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1fillup
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong o, jboolean fill_up
|
||||
)
|
||||
{
|
||||
burn_write_opts_set_fillup( (struct burn_write_opts *) o, fill_up);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libburn_WriteOpts
|
||||
* Method: burn_write_opts_set_toc_entries
|
||||
* Signature: (JI[Lorg/pykix/libburnia/libburn/TocEntry;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1toc_1entries
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong o, jint count, jobjectArray ents
|
||||
)
|
||||
{
|
||||
struct burn_toc_entry entries[count];
|
||||
static jclass tocEntryCls = NULL;
|
||||
static jfieldID sessionid, adrid, controlid, pointid, minid, secid,
|
||||
frameid, zeroid, pminid, psecid, pframeid, extvid, smsbid, pmsbid,
|
||||
slbaid, blocksid;
|
||||
int i;
|
||||
|
||||
if ( tocEntryCls == NULL ) {
|
||||
tocEntryCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/TocEntry");
|
||||
if ( tocEntryCls == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: check for NULL?? */
|
||||
sessionid = (*env)->GetFieldID(env, cls, "session", "B");
|
||||
adrid = (*env)->GetFieldID(env, cls, "adr", "B");
|
||||
controlid = (*env)->GetFieldID(env, cls, "control", "B");
|
||||
pointid = (*env)->GetFieldID(env, cls, "point", "B");
|
||||
minid = (*env)->GetFieldID(env, cls, "min", "B");
|
||||
secid = (*env)->GetFieldID(env, cls, "sec", "B");
|
||||
frameid = (*env)->GetFieldID(env, cls, "frame", "B");
|
||||
zeroid = (*env)->GetFieldID(env, cls, "zero", "B");
|
||||
pminid = (*env)->GetFieldID(env, cls, "pmin", "B");
|
||||
psecid = (*env)->GetFieldID(env, cls, "psec", "B");
|
||||
pframeid = (*env)->GetFieldID(env, cls, "pframe", "B");
|
||||
extvid = (*env)->GetFieldID(env, cls, "extensionsValid", "B");
|
||||
smsbid = (*env)->GetFieldID(env, cls, "sessionMsb", "B");
|
||||
pmsbid = (*env)->GetFieldID(env, cls, "pointMsb", "B");
|
||||
slbaid = (*env)->GetFieldID(env, cls, "startLba", "I");
|
||||
blocksid = (*env)->GetFieldID(env, cls, "trackBlocks", "I");
|
||||
}
|
||||
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
|
||||
struct burn_toc_entry entry = entries[i];
|
||||
jobject obj = (*env)->GetObjectArrayElement(env, ents, i);
|
||||
|
||||
entry.session = (*env)->GetByteField(env, obj, sessionid);
|
||||
entry.adr = (*env)->GetByteField(env, obj, adrid);
|
||||
entry.control = (*env)->GetByteField(env, obj, controlid);
|
||||
entry.tno = 0; //tno is always 0
|
||||
entry.point = (*env)->GetByteField(env, obj, pointid);
|
||||
entry.min = (*env)->GetByteField(env, obj, minid);
|
||||
entry.sec = (*env)->GetByteField(env, obj, secid);
|
||||
entry.frame = (*env)->GetByteField(env, obj, frameid);
|
||||
entry.zero = (*env)->GetByteField(env, obj, zeroid);
|
||||
entry.pmin = (*env)->GetByteField(env, obj, pminid);
|
||||
entry.psec = (*env)->GetByteField(env, obj, psecid);
|
||||
entry.pframe = (*env)->GetByteField(env, obj, pframeid);
|
||||
entry.extensions_valid = (*env)->GetByteField(env, obj, extvid);
|
||||
entry.session_msb = (*env)->GetByteField(env, obj, smsbid);
|
||||
entry.point_msb = (*env)->GetByteField(env, obj, pmsbid);
|
||||
entry.start_lba = (*env)->GetIntField(env, obj, slbaid);
|
||||
entry.track_blocks = (*env)->GetIntField(env, obj, blocksid);
|
||||
}
|
||||
|
||||
burn_write_opts_set_toc_entries( (struct burn_write_opts *) o,
|
||||
count, entries);
|
||||
|
||||
}
|
||||
|
74
experimental/java-libburnia/src/jni/libisofs/IsoExclude.c
Normal file
74
experimental/java-libburnia/src/jni/libisofs/IsoExclude.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* IsoTreeNode.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libisofs_IsoExclude.h"
|
||||
|
||||
#include "libisofs.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoExclude
|
||||
* Method: iso_exclude_add_path
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1add_1path
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring path
|
||||
)
|
||||
{
|
||||
const char *cpath;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
iso_exclude_add_path(cpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoExclude
|
||||
* Method: iso_exclude_remove_path
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1remove_1path
|
||||
(
|
||||
JNIEnv *env, jclass cls, jstring path
|
||||
)
|
||||
{
|
||||
const char *cpath;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
iso_exclude_remove_path(cpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
}
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoExclude
|
||||
* Method: iso_exclude_empty
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1empty
|
||||
(
|
||||
JNIEnv *env, jclass cls
|
||||
)
|
||||
{
|
||||
iso_exclude_empty();
|
||||
}
|
131
experimental/java-libburnia/src/jni/libisofs/IsoTreeNode.c
Normal file
131
experimental/java-libburnia/src/jni/libisofs/IsoTreeNode.c
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* IsoTreeNode.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libisofs_IsoTreeNode.h"
|
||||
|
||||
#include "libisofs.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoTreeNode
|
||||
* Method: iso_tree_add_node
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1add_1node
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong parent, jstring path
|
||||
)
|
||||
{
|
||||
const char *cpath;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_add_node( (struct iso_tree_node *) parent, cpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoTreeNode
|
||||
* Method: iso_tree_radd_dir
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1radd_1dir
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong parent, jstring path
|
||||
)
|
||||
{
|
||||
const char *cpath;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_radd_dir( (struct iso_tree_node *) parent, cpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoTreeNode
|
||||
* Method: iso_tree_print
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1print
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong root, jint spaces
|
||||
)
|
||||
{
|
||||
iso_tree_print( (const struct iso_tree_node *) root, spaces);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoTreeNode
|
||||
* Method: iso_tree_node_set_name
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1node_1set_1name
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong file, jstring name
|
||||
)
|
||||
{
|
||||
const char *cname;
|
||||
|
||||
cname = (*env)->GetStringUTFChars(env, name, NULL);
|
||||
if ( cname == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
iso_tree_node_set_name( (struct iso_tree_node *) file, cname);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, name, cname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoTreeNode
|
||||
* Method: iso_tree_add_new_dir
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1add_1new_1dir
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong parent, jstring name
|
||||
)
|
||||
{
|
||||
const char *cname;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
cname = (*env)->GetStringUTFChars(env, name, NULL);
|
||||
if ( cname == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_add_new_dir( (struct iso_tree_node *) parent, cname);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, name, cname);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
55
experimental/java-libburnia/src/jni/libisofs/IsoVolSet.c
Normal file
55
experimental/java-libburnia/src/jni/libisofs/IsoVolSet.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* IsoVolSet.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libisofs_IsoVolSet.h"
|
||||
|
||||
#include "libisofs.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolSet
|
||||
* Method: iso_volset_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume
|
||||
)
|
||||
{
|
||||
iso_volset_free( (struct iso_volset *) volume);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolSet
|
||||
* Method: iso_volset_new
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1new
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring volsetId
|
||||
)
|
||||
{
|
||||
const char *volset_id;
|
||||
struct iso_volset *volset;
|
||||
|
||||
volset_id = (*env)->GetStringUTFChars(env, volsetId, NULL);
|
||||
if ( volset_id == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
volset = iso_volset_new( (struct iso_volume *) volume, volset_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, volsetId, volset_id);
|
||||
|
||||
return (jlong) volset;
|
||||
}
|
292
experimental/java-libburnia/src/jni/libisofs/IsoVolume.c
Normal file
292
experimental/java-libburnia/src/jni/libisofs/IsoVolume.c
Normal file
@ -0,0 +1,292 @@
|
||||
/*
|
||||
* IsoVolume.c
|
||||
*
|
||||
* Copyright (c) 2007 Vreixo Formoso
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* See COPYING file for details.
|
||||
*/
|
||||
|
||||
#include "org_pykix_libburnia_libisofs_IsoVolume.h"
|
||||
|
||||
#include "libisofs.h"
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_new
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1new
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass cls,
|
||||
jstring volumeId,
|
||||
jstring publisherId,
|
||||
jstring dataPreparerId
|
||||
)
|
||||
{
|
||||
const char *volume_id = NULL;
|
||||
const char *publisher_id = NULL;
|
||||
const char *data_preparer_id = NULL;
|
||||
|
||||
if ( volumeId != NULL ) {
|
||||
volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL);
|
||||
if ( volume_id == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
if ( publisherId != NULL ) {
|
||||
publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL);
|
||||
if (publisher_id == NULL) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
if ( dataPreparerId != NULL ) {
|
||||
data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL);
|
||||
if ( data_preparer_id == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
|
||||
struct iso_volume *iso = iso_volume_new(volume_id, publisher_id, data_preparer_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, volumeId, volume_id);
|
||||
(*env)->ReleaseStringUTFChars(env, publisherId, publisher_id);
|
||||
(*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id);
|
||||
|
||||
return (jlong) iso;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_new_with_root
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1new_1with_1root
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass cls,
|
||||
jstring volumeId,
|
||||
jstring publisherId,
|
||||
jstring dataPreparerId,
|
||||
jlong root
|
||||
)
|
||||
{
|
||||
const char *volume_id = NULL;
|
||||
const char *publisher_id = NULL;
|
||||
const char *data_preparer_id = NULL;
|
||||
struct iso_volume *iso;
|
||||
|
||||
if ( volumeId != NULL ) {
|
||||
volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL);
|
||||
if ( volume_id == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
if ( publisherId != NULL ) {
|
||||
publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL);
|
||||
if (publisher_id == NULL) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
if ( dataPreparerId != NULL ) {
|
||||
data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL);
|
||||
if ( data_preparer_id == NULL ) {
|
||||
return (jlong) 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
}
|
||||
|
||||
iso = iso_volume_new_with_root(volume_id, publisher_id, data_preparer_id,
|
||||
(struct iso_tree_node *) root);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, volumeId, volume_id);
|
||||
(*env)->ReleaseStringUTFChars(env, publisherId, publisher_id);
|
||||
(*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id);
|
||||
|
||||
return (jlong) iso;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_free
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1free
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume
|
||||
)
|
||||
{
|
||||
iso_volume_free( (struct iso_volume *) volume );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_get_root
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1get_1root
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume
|
||||
)
|
||||
{
|
||||
//return (jlong) iso_volume_get_root( (struct iso_volume *) volume );
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_set_volume_id
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1volume_1id
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring volumeId
|
||||
)
|
||||
{
|
||||
const char *volume_id;
|
||||
volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL);
|
||||
if ( volume_id == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
//iso_volume_set_volume_id( (struct iso_volume *) volume, volume_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, volumeId, volume_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_set_publisher_id
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1publisher_1id
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring publisherId
|
||||
)
|
||||
{
|
||||
const char *publisher_id;
|
||||
publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL);
|
||||
if (publisher_id == NULL) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
//iso_volume_set_publisher_id( (struct iso_volume *) volume, publisher_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, publisherId, publisher_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_volume_set_data_preparer_id
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1data_1preparer_1id
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring dataPreparerId
|
||||
)
|
||||
{
|
||||
const char *data_preparer_id;
|
||||
data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL);
|
||||
if ( data_preparer_id == NULL ) {
|
||||
return; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
//iso_volume_set_data_preparer_id( (struct iso_volume *) volume, data_preparer_id);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_tree_volume_path_to_node
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1path_1to_1node
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring path
|
||||
)
|
||||
{
|
||||
const char *cpath;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_volume_path_to_node((struct iso_volume *) volume, cpath);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_tree_volume_add_path
|
||||
* Signature: (JLjava/lang/String;Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1add_1path
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring discPath, jstring path
|
||||
)
|
||||
{
|
||||
const char *disc_path;
|
||||
const char *cpath;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
disc_path = (*env)->GetStringUTFChars(env, discPath, NULL);
|
||||
if ( disc_path == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
if ( cpath == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_volume_add_path( (struct iso_volume *) volume, disc_path, path);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
(*env)->ReleaseStringUTFChars(env, discPath, disc_path);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_pykix_libburnia_libisofs_IsoVolume
|
||||
* Method: iso_tree_volume_add_new_dir
|
||||
* Signature: (JLjava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1add_1new_1dir
|
||||
(
|
||||
JNIEnv *env, jclass cls, jlong volume, jstring discPath
|
||||
)
|
||||
{
|
||||
const char *disc_path;
|
||||
struct iso_tree_node *node;
|
||||
|
||||
disc_path = (*env)->GetStringUTFChars(env, discPath, NULL);
|
||||
if ( disc_path == NULL ) {
|
||||
return 0; /* OutOfMemoryError already thrown */
|
||||
}
|
||||
|
||||
node = iso_tree_volume_add_new_dir( (struct iso_volume *) volume, disc_path);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, discPath, disc_path);
|
||||
|
||||
return (jlong) node;
|
||||
}
|
Reference in New Issue
Block a user