Imported initial java bindings

This commit is contained in:
Mario Danic 2007-04-23 08:42:04 +00:00
parent a8ab6c34c6
commit 1418259ec4
69 changed files with 14651 additions and 0 deletions

1
java/AUTHORS Normal file
View File

@ -0,0 +1 @@
Vreixo Formoso <metalpain2002@yahoo.es>

280
java/COPYING Normal file
View File

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

0
java/ChangeLog Normal file
View File

32
java/INSTALL Normal file
View File

@ -0,0 +1,32 @@
Installation Instructions
*************************
TODO write better install instructions
TODO you need Apache Ant to compile the code
TODO ant install is not implemented yet, you should copy .jar and .so files
manually
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `ant' to compile the package.
3. Optionally, type `ant check' to run any self-tests that come with
the package.
4. Type `ant install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `ant clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `ant distclean'. There is
also a `ant maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.

0
java/NEWS Normal file
View File

20
java/README Normal file
View File

@ -0,0 +1,20 @@
These are Java bindings for the libburnia project <libburnia.pykix.org>
This version is a full binding for libisofs 0.2.4 and libburn 0.3.4.
NOTE:
This is realeased under GPL.
However, it is implemented using 1.5 version of the Java language. At this time
there isn't, at my knowledge, any free JVM implementation with fully support
for Java 1.5. Given that this project is still in a very early stage, I really
prefer to live with this problem for a while. I hope that free JVM with 1.5
support will be available soon.
Anyway as these bindings reach release 1.0 they will be fully compilable and
executable on a free environment, even if this implies porting them back to 1.4.
Vreixo,
17-Apr-2007

16
java/TODO Normal file
View File

@ -0,0 +1,16 @@
Documentation:
- Review of javadocs, update methods to java ones.
- Write a little tutorial.
- Usage examples.
Design:
- Improve error notification. Decide what functions should return error
as int/boolean and what should throw an exception. Design exception hierarchy.
- Walk to a improved Java-like API...
- Java based BurnSource. java IO/NIO burn sources
Testing:
- Test program like test/libburner and test/iso.c (this last already done)
- Write a lot of tests, either manual tests and automatic test (Junit based)
to cover all methods.

4
java/build.properties.in Normal file
View File

@ -0,0 +1,4 @@
package=@PACKAGE_NAME@
version=@PACKAGE_VERSION@
cflags.isofs=@ISOFS_INCLUDE@
cflags.burn=@BURN_INCLUDE@

288
java/build.xml Normal file
View File

@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
build.xml
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.
-->
<project name="java-libburn" default="all" basedir=".">
<!-- === App properties ============================ -->
<property file="build.properties" />
<!-- === Compiler properties ====================== -->
<property name="build.compiler" value="modern" />
<property name="javac.debug" value="on" />
<property name="javac.optimize" value="off" />
<property name="javac.deprecation" value="on" />
<property name="javac.nowarn" value="on" />
<property name="cc.debug" value="on" />
<!-- === directories ====================== -->
<property name="src" value="src" />
<property name="src.java" value="${src}/java" />
<property name="src.test" value="${src}/test" />
<property name="src.jni" value="${src}/jni" />
<property name="build" value="build" />
<property name="build.object" value="${build}/.object" />
<property name="build.headers" value="${build}/.headers" />
<property name="build.classes" value="${build}/.classes" />
<property name="build.test" value="${build}/.test" />
<property name="doc" value="doc" />
<property name="doc.api" value="${doc}/api" />
<property name="libs" value="libs" />
<property name="dist.tar" value="${package}-${version}" />
<property name="dist.jar" value="${package}-${version}.jar" />
<!-- === CC tasks ====================== -->
<property name="cc.jar" value="${libs}/cpptasks.jar"/>
<taskdef resource="cpptasks.tasks"
classpath="${cc.jar}"
loaderRef="cctasks"/>
<typedef resource="cpptasks.types"
classpath="${cc.jar}"
loaderRef="cctasks"/>
<!-- == JavaDoc URLs ========================================= -->
<!-- JavaDoc bottom -->
<property name="javadoc.bottomline" value="${package} ${version}" />
<!-- == target "init" ================================================= -->
<target name="init">
<echo>
----------------------------------------------------
Building ${package}...
----------------------------------------------------
</echo>
</target>
<!-- == target "all" ================================================== -->
<target name="all" depends="init, jars, jni" />
<!-- == target "compile" ============================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.classes}" />
<javac srcdir="${src.java}" destdir="${build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}" deprecation="${javac.deprecation}"
nowarn="${javac.nowarn}" />
</target>
<!-- == target "compile.test" ========================================== -->
<target name="compile.test" depends="init">
<mkdir dir="${build.test}" />
<javac srcdir="${src.test}" destdir="${build.test}"
classpath="${build.classes}" debug="${javac.debug}"
optimize="${javac.optimize}" deprecation="${javac.deprecation}"
nowarn="${javac.nowarn}" />
</target>
<!-- == target "headers" ============================================== -->
<target name="headers" depends="compile">
<mkdir dir="${build.headers}" />
<javah destdir="${build.headers}"
force="yes" classpath="${build.classes}">
<class name="org.pykix.libburnia.libisofs.IsoVolume"/>
<class name="org.pykix.libburnia.libisofs.IsoTreeNode"/>
<class name="org.pykix.libburnia.libisofs.IsoExclude"/>
<class name="org.pykix.libburnia.libisofs.IsoVolSet"/>
<class name="org.pykix.libburnia.libburn.Burn"/>
<class name="org.pykix.libburnia.libburn.Disc"/>
<class name="org.pykix.libburnia.libburn.Drive"/>
<class name="org.pykix.libburnia.libburn.DriveInfo"/>
<class name="org.pykix.libburnia.libburn.Message"/>
<class name="org.pykix.libburnia.libburn.Progress"/>
<class name="org.pykix.libburnia.libburn.ReadOpts"/>
<class name="org.pykix.libburnia.libburn.ScsiAdr"/>
<class name="org.pykix.libburnia.libburn.Session"/>
<class name="org.pykix.libburnia.libburn.Source"/>
<class name="org.pykix.libburnia.libburn.Track"/>
<class name="org.pykix.libburnia.libburn.WriteOpts"/>
</javah>
</target>
<!-- == target "jni" ================================================== -->
<target name="jni" depends="headers" >
<mkdir dir="${build.object}"/>
<cc debug="${cc.debug}"
link="shared" libtool="yes"
outfile="${build}/${package}-${version}"
objdir="${build.object}"
multithreaded="true"
exceptions="true" >
<defineset define="DEBUG"/>
<compiler name="gcc" />
<compilerarg value="-Wno-pointer-to-int-cast"/>
<compilerarg value="-Wno-int-to-pointer-cast"/>
<!-- A 64 bits off_t is needed for DVD -->
<compilerarg value="-D_FILE_OFFSET_BITS=64"/>
<compilerarg value="-D_LARGEFILE_SOURCE=1"/>
<fileset dir="${src.jni}"/>
<includepath location="${build.headers}" />
<sysincludepath location="${env.JAVA_HOME}/include" />
<sysincludepath location="${cflags.isofs}" />
<sysincludepath location="${cflags.burn}" />
<libset libs="isofs"/>
<libset libs="burn"/>
<linker name="gcc" />
</cc>
</target>
<!-- == target "jars" ================================================= -->
<target name="jars" depends="compile">
<mkdir dir="${build}" />
<jar destfile="${build}/${dist.jar}">
<manifest>
<attribute name="version" value="${version}" />
</manifest>
<fileset dir="${build.classes}" />
</jar>
</target>
<!-- == target "rebuild" ============================================== -->
<target name="rebuild" depends="init, clean, all" />
<!-- == target "distclean" ============================================ -->
<target name="distclean" depends="init">
<delete dir="${build}" />
<delete dir="${doc.api}" />
<delete file="build.properties" />
<delete >
<fileset dir="." includes="config.*" />
</delete>
</target>
<!-- ================ "maintainer-clean" target ======================= -->
<target name="maintainer-clean" depends="distclean" >
<echo>NOT IMPLEMENTED YET</echo>
</target>
<!-- == target "clean" ================================================ -->
<target name="clean" depends="init">
<delete dir="${build.classes}" />
<delete dir="${build.object}" />
<delete dir="${build.test}" />
<delete >
<fileset dir="." includes="hs_err_*" />
</delete>
</target>
<!-- == target "javadoc" ============================================== -->
<target name="doc" depends="compile">
<delete dir="${doc.api}" />
<mkdir dir="${doc.api}" />
<javadoc packagenames="org.*" sourcepath="${src.java}"
classpath="${build.classes}" destdir="${doc.api}" access="public"
windowtitle="${package}" doctitle="${package}"
header="${package}" bottom="${javadoc.bottomline}">
<!--
<link href="${j2se.javadocurl}"/>
-->
</javadoc>
</target>
<!-- ================= "run" target =================================== -->
<target name="run" depends="all, compile.test">
<!--
<java classname="org.pykix.libburnia.test.IsoFsMain" fork="true" >
<arg value="-R"/>
<arg value="-L"/>
<arg value="3"/>
<arg value="/home/metalpain/Projects/LibBurn"/>
<arg value="/home/metalpain/proba.iso"/>
<classpath location="${build.test}" />
<classpath location="${build.classes}"/>
<jvmarg value="-Djava.library.path=${build}" />
</java>
-->
<java classname="org.pykix.libburnia.test.Test" fork="true" >
<classpath location="${build.test}" />
<classpath location="${build.classes}"/>
<jvmarg value="-Djava.library.path=${build}" />
</java>
</target>
<!-- ================= "install" target =============================== -->
<target name="install" depends="all">
<echo>NOT IMPLEMENTED YET</echo>
<!--
It seems that these are default locations for java objects, at
least on Ubuntu:
jars to /usr/share/java
jni libs to /usr/lib/jni
-->
</target>
<!-- ========================= "dist" target ========================== -->
<target name="dist" depends="init, dist-tarZ" />
<target name="dist-tarZ" >
<mkdir dir="${build}"/>
<patternset id="tar.commonfiles" includes="java-libburn/**"
excludes="**/build/**, **/bin/**, **/*.back, **/*~,
**/*.sh, **/doc/api/**, **/autom4te.cache/**,
**/build.properties/**, **/.bzr**" />
<!--
.tar.gz distribution (with execution permissions for .sh files)
-->
<delete file="${build}/${dist.tar}.tar.gz"/>
<tar tarfile="${build}/${dist.tar}.tar.gz" longfile="gnu"
compression="gzip">
<tarfileset dir="..">
<patternset refid="tar.commonfiles"/>
</tarfileset>
<tarfileset dir=".." mode="755" includes="java-libburn/**/*.sh"/>
</tar>
</target>
<!-- ======================== "backup" target ========================= -->
<target name="backup" >
<mkdir dir="${build}"/>
<patternset id="tar.commonfiles" includes="java-libburn/**"
excludes="**/build/**, **/bin/**, **/*.back, **/*~,
**/*.sh, **/doc/api/**, **/autom4te.cache/**,
**/build.properties/**" />
<delete file="${build}/${dist.tar}.back.tar.gz"/>
<tar tarfile="${build}/${dist.tar}.back.tar.gz" longfile="gnu"
compression="gzip">
<tarfileset dir="..">
<patternset refid="tar.commonfiles"/>
</tarfileset>
<tarfileset dir=".." mode="755" includes="java-libburn/**/*.sh"/>
</tar>
</target>
</project>

228
java/config.log Normal file
View File

@ -0,0 +1,228 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by java-libburn configure 0.1, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = mplaptop
uname -m = i686
uname -r = 2.6.17-10-generic
uname -s = Linux
uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = i686
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/bin/X11
PATH: /usr/games
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1633: checking for javac
configure:1651: found /usr/local/bin/javac
configure:1663: result: /usr/local/bin/javac
configure:1673: checking for javah
configure:1691: found /usr/bin/javah
configure:1703: result: /usr/bin/javah
configure:1713: checking for jar
configure:1731: found /usr/bin/jar
configure:1743: result: /usr/bin/jar
configure:1800: checking for gcc
configure:1816: found /usr/bin/gcc
configure:1827: result: gcc
configure:2065: checking for C compiler version
configure:2072: gcc --version >&5
gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2075: $? = 0
configure:2082: gcc -v >&5
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
configure:2085: $? = 0
configure:2092: gcc -V >&5
gcc: '-V' option must have argument
configure:2095: $? = 1
configure:2118: checking for C compiler default output file name
configure:2145: gcc conftest.c >&5
configure:2148: $? = 0
configure:2194: result: a.out
configure:2199: checking whether the C compiler works
configure:2209: ./a.out
configure:2212: $? = 0
configure:2229: result: yes
configure:2236: checking whether we are cross compiling
configure:2238: result: no
configure:2241: checking for suffix of executables
configure:2248: gcc -o conftest conftest.c >&5
configure:2251: $? = 0
configure:2275: result:
configure:2281: checking for suffix of object files
configure:2307: gcc -c conftest.c >&5
configure:2310: $? = 0
configure:2333: result: o
configure:2337: checking whether we are using the GNU C compiler
configure:2366: gcc -c conftest.c >&5
configure:2372: $? = 0
configure:2379: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2382: $? = 0
configure:2389: test -s conftest.o
configure:2392: $? = 0
configure:2406: result: yes
configure:2411: checking whether gcc accepts -g
configure:2441: gcc -c -g conftest.c >&5
configure:2447: $? = 0
configure:2454: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2457: $? = 0
configure:2464: test -s conftest.o
configure:2467: $? = 0
configure:2597: result: yes
configure:2614: checking for gcc option to accept ISO C89
configure:2688: gcc -c -g -O2 conftest.c >&5
configure:2694: $? = 0
configure:2701: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2704: $? = 0
configure:2711: test -s conftest.o
configure:2714: $? = 0
configure:2734: result: none needed
configure:2893: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by java-libburn config.status 0.1, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on mplaptop
config.status:563: creating build.properties
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_objext=o
ac_cv_path_JAR=/usr/bin/jar
ac_cv_path_JAVAC=/usr/local/bin/javac
ac_cv_path_JAVAH=/usr/bin/javah
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
BURN_INCLUDE='/usr/local/include/libburn'
CC='gcc'
CFLAGS='-g -O2'
CPPFLAGS=''
DEFS='-DPACKAGE_NAME=\"java-libburn\" -DPACKAGE_TARNAME=\"java-libburn\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"java-libburn\ 0.1\" -DPACKAGE_BUGREPORT=\"\"'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
ISOFS_INCLUDE='/usr/local/include/libisofs'
JAR='/usr/bin/jar'
JAVAC='/usr/local/bin/javac'
JAVAH='/usr/bin/javah'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='java-libburn'
PACKAGE_STRING='java-libburn 0.1'
PACKAGE_TARNAME='java-libburn'
PACKAGE_VERSION='0.1'
PATH_SEPARATOR=':'
SHELL='/bin/bash'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define PACKAGE_NAME "java-libburn"
#define PACKAGE_TARNAME "java-libburn"
#define PACKAGE_VERSION "0.1"
#define PACKAGE_STRING "java-libburn 0.1"
#define PACKAGE_BUGREPORT ""
configure: exit 0

749
java/config.status Normal file
View File

@ -0,0 +1,749 @@
#! /bin/bash
# Generated by configure.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=${CONFIG_SHELL-/bin/bash}
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# PATH needs CR
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
as_nl='
'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
{ (exit 1); exit 1; }
fi
# Work around bugs in pre-3.0 UWIN ksh.
for as_var in ENV MAIL MAILPATH
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
for as_var in \
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# CDPATH.
$as_unset CDPATH
as_lineno_1=$LINENO
as_lineno_2=$LINENO
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
# line-number line after each line using $LINENO; the second 'sed'
# does the real work. The second script uses 'N' to pair each
# line-number line with the line containing $LINENO, and appends
# trailing '-' during substitution so that $LINENO is not a special
# case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
# scripts with optimization help from Paolo Bonzini. Blame Lee
# E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in
-n*)
case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
*) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir
fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# Find out whether ``test -x'' works. Don't use a zero-byte file, as
# systems may use methods other than mode bits to determine executability.
cat >conf$$.file <<_ASEOF
#! /bin/sh
exit 0
_ASEOF
chmod +x conf$$.file
if test -x conf$$.file >/dev/null 2>&1; then
as_executable_p="test -x"
else
as_executable_p=:
fi
rm -f conf$$.file
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by java-libburn $as_me 0.1, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
# Files that config.status was made for.
config_files=" build.properties"
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
Configuration files:
$config_files
Report bugs to <bug-autoconf@gnu.org>."
ac_cs_version="\
java-libburn config.status 0.1
configured by ./configure, generated by GNU Autoconf 2.60,
with options \"\"
Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='/home/metalpain/Dados/workspace/java-libburn'
srcdir='.'
# If no file are specified by the user, then we need to provide default
# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
echo "$ac_cs_version"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--he | --h | --help | --hel | -h )
echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) { echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; } ;;
*) ac_config_targets="$ac_config_targets $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
if $ac_cs_recheck; then
echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6
CONFIG_SHELL=/bin/bash
export CONFIG_SHELL
exec /bin/bash "./configure" $ac_configure_extra_args --no-create --no-recursion
fi
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
echo "$ac_log"
} >&5
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"build.properties") CONFIG_FILES="$CONFIG_FILES build.properties" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp=
trap 'exit_status=$?
{ test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
#
# Set up the sed scripts for CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "$CONFIG_FILES"; then
cat >"$tmp/subs-1.sed" <<\CEOF
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
s,@SHELL@,|#_!!_#|/bin/bash,g
s,@PATH_SEPARATOR@,|#_!!_#|:,g
s,@PACKAGE_NAME@,|#_!!_#|java-libburn,g
s,@PACKAGE_TARNAME@,|#_!!_#|java-libburn,g
s,@PACKAGE_VERSION@,|#_!!_#|0.1,g
s,@PACKAGE_STRING@,|#_!!_#|java-libburn 0.1,g
s,@PACKAGE_BUGREPORT@,|#_!!_#|,g
s,@exec_prefix@,|#_!!_#|${prefix},g
s,@prefix@,|#_!!_#|/usr/local,g
s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g
s,@bindir@,|#_!!_#|${exec_prefix}/bin,g
s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g
s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g
s,@datarootdir@,|#_!!_#|${prefix}/share,g
s,@datadir@,|#_!!_#|${datarootdir},g
s,@sysconfdir@,|#_!!_#|${prefix}/etc,g
s,@sharedstatedir@,|#_!!_#|${prefix}/com,g
s,@localstatedir@,|#_!!_#|${prefix}/var,g
s,@includedir@,|#_!!_#|${prefix}/include,g
s,@oldincludedir@,|#_!!_#|/usr/include,g
s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE_TARNAME},g
s,@infodir@,|#_!!_#|${datarootdir}/info,g
s,@htmldir@,|#_!!_#|${docdir},g
s,@dvidir@,|#_!!_#|${docdir},g
s,@pdfdir@,|#_!!_#|${docdir},g
s,@psdir@,|#_!!_#|${docdir},g
s,@libdir@,|#_!!_#|${exec_prefix}/lib,g
s,@localedir@,|#_!!_#|${datarootdir}/locale,g
s,@mandir@,|#_!!_#|${datarootdir}/man,g
s,@DEFS@,|#_!!_#|-DPACKAGE_NAME=\\"java-libburn\\" -DPACKAGE_TARNAME=\\"java-libburn\\" -DPACKAGE_VERSION=\\"0.1\\" -DPACKAGE_STRING=\\"java-libburn\\ 0.1\\" -DPACKAGE_BUGREPORT=\\"\\",g
s,@ECHO_C@,|#_!!_#|,g
s,@ECHO_N@,|#_!!_#|-n,g
s,@ECHO_T@,|#_!!_#|,g
s,@LIBS@,|#_!!_#|,g
s,@build_alias@,|#_!!_#|,g
s,@host_alias@,|#_!!_#|,g
s,@target_alias@,|#_!!_#|,g
s,@JAVAC@,|#_!!_#|/usr/local/bin/javac,g
s,@JAVAH@,|#_!!_#|/usr/bin/javah,g
s,@JAR@,|#_!!_#|/usr/bin/jar,g
s,@CC@,|#_!!_#|gcc,g
s,@CFLAGS@,|#_!!_#|-g -O2,g
s,@LDFLAGS@,|#_!!_#|,g
s,@CPPFLAGS@,|#_!!_#|,g
s,@ac_ct_CC@,|#_!!_#|gcc,g
s,@EXEEXT@,|#_!!_#|,g
s,@OBJEXT@,|#_!!_#|o,g
s,@ISOFS_INCLUDE@,|#_!!_#|/usr/local/include/libisofs,g
s,@BURN_INCLUDE@,|#_!!_#|/usr/local/include/libburn,g
s,@LIBOBJS@,|#_!!_#|,g
s,@LTLIBOBJS@,|#_!!_#|,g
:end
s/|#_!!_#|//g
CEOF
fi # test -n "$CONFIG_FILES"
for ac_tag in :F $CONFIG_FILES
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
echo "$as_me: error: Invalid tag $ac_tag." >&2;}
{ (exit 1); exit 1; }; };;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
{ { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
echo "$as_me: error: cannot find input file: $ac_f" >&2;}
{ (exit 1); exit 1; }; };;
esac
ac_file_inputs="$ac_file_inputs $ac_f"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input="Generated from "`IFS=:
echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
fi
case $ac_tag in
*:-:* | *:-) cat >"$tmp/stdin";;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
{ as_dir="$ac_dir"
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
echo "$as_me: error: cannot create directory $as_dir" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
case `sed -n '/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p
' $ac_file_inputs` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
ac_datarootdir_hack='
s&@datadir@&${datarootdir}&g
s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g
s&@infodir@&${datarootdir}/info&g
s&@localedir@&${datarootdir}/locale&g
s&@mandir@&${datarootdir}/man&g
s&\${datarootdir}&${prefix}/share&g' ;;
esac
sed "/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/
s/:*\${srcdir}:*/:/
s/:*@srcdir@:*/:/
s/^\([^=]*=[ ]*\):*/\1/
s/:*$//
s/^[^=]*=[ ]*$//
}
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s&@configure_input@&$configure_input&;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
{ echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&5
echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined." >&2;}
rm -f "$tmp/stdin"
case $ac_file in
-) cat "$tmp/out"; rm -f "$tmp/out";;
*) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
esac
;;
esac
done # for ac_tag
{ (exit 0); exit 0; }

3757
java/configure vendored Normal file

File diff suppressed because it is too large Load Diff

37
java/configure.ac Normal file
View File

@ -0,0 +1,37 @@
dnl configure.ac
dnl
dnl Copyright (c) 2007 Vreixo Formoso
dnl
dnl This library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl See COPYING file for details.
dnl
AC_INIT(java-libburn, 0.1)
AC_REVISION([$Revision: 0.1 $])
dnl look for java programs
AC_PATH_PROG([JAVAC], [javac])
AC_PATH_PROG([JAVAH], [javah])
AC_PATH_PROG([JAR], [jar])
AC_PROG_CC
dnl Package dependances
dnl -------------------------------------------------------------------------
dnl PKG_PROG_PKG_CONFIG()
dnl PKG_CHECK_MODULES([ISOFS], isofs)
AC_SUBST(ISOFS_INCLUDE,`pkg-config --cflags libisofs-1 | sed -e's/-I//g' -e's/ *$//g'`)
AC_SUBST(BURN_INCLUDE,`pkg-config --cflags libburn-1 | sed -e's/-I//g' -e's/ *$//g'`)
dnl Output Files
dnl -------------------------------------------------------------------------
AC_CONFIG_FILES([
build.properties
])
AC_OUTPUT

4
java/libs/README Normal file
View File

@ -0,0 +1,4 @@
The lib/ hierarchy contains third party libraries.
TODO comentar cada libraria usada

View File

@ -0,0 +1,82 @@
/*
* Proxy.java
*
* 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.
*/
package org.pykix.libburnia.bindings;
import java.lang.ref.WeakReference;
import java.util.HashMap;
/**
* Wrapper around a native C resource, i.e., a pointer.
*
* <p>
* This also keeps track of all Java objects that are a wrapper around
* a C object, to prevent replication of objects when retrieved from C
* side.
*
* <p>
* <b>This class is a implementation detail, that should be never user
* by a developer</b>
*
* @author Vreixo Formoso
* @since 0.1
*/
public abstract class Proxy {
/** Pointer to C object. */
private final long pointer;
/** Keeps track of existing pointers. */
private static final HashMap<Long, WeakReference<Proxy>> proxies =
new HashMap<Long, WeakReference<Proxy>>();
protected Proxy(long ptr) {
assert ptr != 0 : "Can't proxy a NULL pointer";
assert proxies.get(ptr) == null :
"Can't create a pointer for an existing proxy";
pointer = ptr;
proxies.put( ptr, new WeakReference<Proxy>(this) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
proxies.remove(pointer);
}
/**
* Get C pointer for a Proxy.
*
* @param obj
* @return
*/
protected static long pointerOf(Proxy obj) {
return obj.pointer;
}
/**
* Get the proxy registered for a pointer.
*
* @param ptr
* Pointer
* @return
* The Proxy or <code>null</code> if no Proxy is registered.
*/
protected static Proxy proxyFor(long ptr) {
WeakReference<Proxy> ref = proxies.get(ptr);
return ref == null ? null : ref.get();
}
}

View File

@ -0,0 +1,78 @@
/*
* BlockType.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Data format to send to the drive.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum BlockType {
/** sync, headers, edc/ecc provided by lib/user. */
RAW0(1),
/** sync, headers, edc/ecc and p/q subs provided by lib/user. */
RAW16(2),
/** sync, headers, edc/ecc and packed p-w subs provided by lib/user. */
RAW96P(4),
/** sync, headers, edc/ecc and raw p-w subs provided by lib/user. */
RAW96R(8),
/** only 2048 bytes of user data provided by lib/user. */
MODE1(256),
/** 2336 bytes of user data provided by lib/user. */
MODE2R(512),
/**
* 2048 bytes of user data provided by lib/user
* subheader provided in write parameters
* are we ever going to support this shit? I vote no.
* (supposed to be supported on all drives...)
*/
MODE2_PATHETIC(1024),
/**
* 2048 bytes of data + 8 byte subheader provided by lib/user
* hey, this is also dumb
*/
MODE2_LAME(2048),
/**
* 2324 bytes of data provided by lib/user
* subheader provided in write parameters.
* no sir, I don't like it.
*/
MODE2_OBSCURE(4096),
/**
* 2332 bytes of data supplied by lib/user
* 8 bytes sub header provided in write parameters
* this is the second least suck mode2, and is mandatory for
* all drives to support.
*/
MODE2_OK(8192),
/** SAO block sizes are based on cue sheet, so use this. */
SAO(16384);
int code;
private BlockType(int code) {
this.code = code;
}
}

View File

@ -0,0 +1,482 @@
/*
* Burn.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Library initialization/shutdown and miscellaneous functions.
*
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Burn {
static final String JNI_LIBRARY_NAME = "java-libburn-0.1";
/** Maximum number of particularly permissible drive addresses. */
public static final int WHITELIST_LEN = 255;
/**
* Initialize the library.
*
* <p>
* This must be called before using any other functions in the library. It
* may be called more than once with no effect.
*
* <p>
* It is possible to 'restart' the library by shutting it down and
* re-initializing it. This is necessary if you follow the older and
* more general way of accessing a drive via burn_drive_scan() and
* burn_drive_grab(). See burn_drive_scan_and_grab() with its strong
* urges and its explanations. TODO fix this comment
*
* @throws BurnException
* If library initialization fails.
*/
public static void initialize() throws BurnException {
if ( burn_initialize() == 0 ) {
throw new BurnException("Can't initialize libburnia library");
}
}
/**
* Shutdown the library.
*
* <p>
* This should be called before exiting your application. Make sure that all
* drives you have grabbed are released <i>before</i> calling this.
*/
public static void finish() {
burn_finish();
}
/**
* Set parameters for behavior on opening device files. To be called early
* after {@link #initialize()} and before any bus scan. But not mandatory at
* all.
*
* <p>
* Parameter value 1 enables a feature, 0 disables. Default is (1,0,0).
* Have a good reason before you change it.
*
* @param exclusive
* <ul>
* <li>1 = Try to open only devices which are not marked as busy
* and try to mark them busy if opened sucessfully. (O_EXCL)
* There are kernels which simply don't care about O_EXCL.
* Some have it off, some have it on, some are switchable.
* <li>2 = in case of a SCSI device, also try to open exclusively
* the matching /dev/sr, /dev/scd and /dev/st .
* <li>0 = no attempt to make drive access exclusive.
* </ul>
* @param blocking
* Try to wait for drives which do not open immediately but
* also do not return an error as well. (O_NONBLOCK)
* This might stall indefinitely with /dev/hdX hard disks.
* @param abortOnBusy
* Unconditionally abort process when a non blocking
* exclusive opening attempt indicates a busy drive.
* Use this only after thorough tests with your app.
*/
public static void presetDeviceOpen(int exclusive, int blocking,
int abortOnBusy) {
burn_preset_device_open(exclusive, blocking, abortOnBusy);
}
/**
* Allows the use of media types which are implemented in libburn but not
* yet tested. The list of those untested profiles is subject to change.
* Currently it contains: 0x15 "DVD-R/DL Sequential".
* If you really test such media, then please report the outcome on
* libburn-hackers@pykix.org
* If ever then this call should be done soon after {@link #initialize()}
* before any drive scanning.
*
* @param yes
* <code>true</code> to allow all implemented profiles,
* <code>false</code> only tested media (default)
*/
public static void allowUntestedProfiles(boolean yes) {
burn_allow_untested_profiles(yes);
}
/**
* Scan for drives.
*
* <p>
* No drives may be in use when this is called. All drive objects are
* invalidated by using this function. Do <b>NOT</b> store drive
* objects across calls to this function or death AND pain will ensue.
*
* <p>
* After this call all drives depicted by the returned array are subject
* to eventual (O_EXCL) locking. See burn_preset_device_open(). This state
* ends either with burn_drive_info_forget() or with burn_drive_release().
*
* <p>
* It is unfriendly to other processes on the system to hold drives locked
* which one does not definitely plan to use soon.
*
* @return
* an array of drive info items (cdroms/burners).
* The returned array must be freed by burn_drive_info_free()
* before burn_finish(), and also before calling this function
* burn_drive_scan() again.
* @throws BurnException
* If scan fails
*
* TODO correct above comment
*/
public static DriveInfo[] scan() throws BurnException {
DriveInfo[] infos = burn_drive_scan();
if ( infos == null ) {
throw new BurnException("No drives found");
}
return infos;
}
/**
* Aquire a drive with known persistent address.
*
* <p>
* This is the sysadmin friendly way to open one drive and to leave all
* others untouched. It bundles the following API calls to form a
* non-obtrusive way to use libburn:
* burn_drive_add_whitelist() , {@link #scan()}, {@link Drive#grab(boolean)}
*
* <p>
* You are <b>strongly urged</b> to use this call whenever you know the
* drive address in advance.
*
* <p>
* If not, then you have to use directly above calls. In that case, you are
* <b>strongly urged</b> to drop any unintended drive which will be
* exclusively occupied and not closed by {@link #scan()}.
* This can be done by shutting down the library including a call to
* {@link #finish()}. You may later start a new libburn session and should
* then use the function described here with an address obtained after
* {@link #scan()} via {@link DriveInfo#getAdr()}.
*
* <p>
* Another way is to drop the unwanted drives by {@link DriveInfo#forget(int)}.
*
* @param adr
* The persistent address of the desired drive. Either obtained
* by {@link DriveInfo#getAdr()} or guessed skillfully by application
* resp. its user.
* @param load
* <code>true</code> to make the drive attempt to load a disc (close
* its tray door, etc).
* @return
* A DriveInfo object with the requested cdrom/burner.
* @throws BurnException
* If drive not found.
*/
public static DriveInfo scanAndGrab(String adr, boolean load)
throws BurnException {
DriveInfo info = burn_drive_scan_and_grab(adr, load);
if ( info == null ) {
throw new BurnException("Drive not found");
}
return info;
}
/**
* Add a device to the list of permissible drives. As soon as some entry
* is in the whitelist all non-listed drives are banned from scanning.
*
* <p>
* The number of devices that can be added to the whitelist is limited
* to {@link #WHITELIST_LEN}.
*
* @param adr
* The persistent address of the drive.
* @return
* <code>true</code> on success, <code>false</code> otherwise.
*/
public static boolean addWhiteList(String adr) {
return (burn_drive_add_whitelist(adr) == 1);
}
/**
* Remove all drives from whitelist. This enables all possible drives.
*/
public static void clearWhiteList() {
burn_drive_clear_whitelist();
}
/**
* Set the verbosity level of the library.
*
* <p>
* The default value is 0, which means that nothing is output on stderr.
* The more you increase this, the more debug output should be displayed
* on stderr for you.
*
* <p>
* This is for development only. Not suitable for applications.
*
* @param level
* The verbosity level desired. 0 for nothing, higher positive
* values for more information output.
*/
public static void setVerbosity(int level) {
burn_set_verbosity(level);
}
/**
* Evaluate wether the given address would be a possible persistent
* drive address of libburn.
*/
public static boolean isEnumerableAdr(String adr) {
return burn_drive_is_enumerable_adr(adr);
}
/**
* Try to convert a given existing filesystem address into a persistent
* drive address. This succeeds with symbolic links or if a hint about
* the drive's system address can be read from the filesystem object and
* a matching drive is found.
*
* @param path
* The address of an existing file system object
* @return
* The persistent address or <code>null</code> on failure
*/
public static String convertFsAdr(String path) {
return burn_drive_convert_fs_adr(path);
}
/**
*
*/
public interface AbortHandler {
/**
* Function suitable to produce appeasing messages while
* burn is been canceled.
*
* @param patience
* Maximum number of seconds to wait.
* @param elapsed
* Elapsed number of seconds.
* @return
*/
public int abortPacifier(int patience, int elapsed);
}
/**
* Abort any running drive operation and finally call {@link #finish()}.
*
* <p>
* You MUST calm down the busy drive if an aborting event occurs during a
* burn run. For that you may call this function either from your own signal
* handling code or indirectly by activating the builtin signal handling:
* burn_set_signal_handling("my_app_name : ", NULL, 0);
*
* <p>
* Else you may eventually call {@link Drive#cancel()} on the active drive
* and wait for it to assume state {@link DriveStatus#IDLE}.
*
* @param patience
* Maximum number of seconds to wait for drives to finish
* @param pacifier
* A function to produce appeasing messages. You can pass
* <code>null</code> to not produce those messages.
* @return
* <code>true</code> if all went well, <code>false</code> if had
* to leave a drive in unclean state
* @throws BurnException
* On severe error, do no use libburn again
* @see #abort(int, String)
*/
public static boolean abort(int patience, AbortHandler pacifier)
throws BurnException {
return burn_abort_java(patience, pacifier);
}
/**
* Abort any running drive operation and finally call {@link #finish()}.
*
* <p>
* You MUST calm down the busy drive if an aborting event occurs during a
* burn run. For that you may call this function either from your own signal
* handling code or indirectly by activating the builtin signal handling:
* burn_set_signal_handling("my_app_name : ", NULL, 0);
*
* <p>
* Else you may eventually call {@link Drive#cancel()} on the active drive
* and wait for it to assume state {@link DriveStatus#IDLE}.
*
* <p>
* This version of abort uses the default pacifier function that print
* messages to stdout.
*
* @param patience
* Maximum number of seconds to wait for drives to finish
* @param msg
* The message to be printed.
* @return
* <code>true</code> if all went well, <code>false</code> if had
* to leave a drive in unclean state
* @throws BurnException
* On severe error, do no use libburn again
* @see #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler)
*/
public static boolean abort(int patience, String msg) throws BurnException {
return burn_abort_def(patience, msg);
}
/**
* Interface suitable for {@link Burn#setSignalHandler(org.pykix.libburnia.libburn.Burn.SignalHandler, int)}
*/
public interface SignalHandler {
/**
* Function to be called when a signal is received.
*
* @param signum
* @param flag
* @return
* has to return -2 if it does not want the process to
* exit with value 1.
*/
public int handleSignal(int signum, int flag);
}
/**
* Control builtin signal handling. See also
* {@link #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler)}.
*
* @param handler
* A handler to be called on signals. It's
* {@link SignalHandler#handleSignal(int, int) handleSignal} method
* will be called when a signal is received. It should finally call
* {@link #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler)}.
* @param mode
* 0 call handler(signum, 0) on nearly all signals
* 1 enable system default reaction on all signals
* 2 try to ignore nearly all signals
* 10 like mode 2 but handle SIGABRT like with mode 0
*/
public static void setSignalHandler(SignalHandler handler, int mode) {
if ( handler == null ) {
throw new NullPointerException("Handler cannot be null");
}
burn_set_signal_handling(handler, mode);
}
/**
* Control builtin signal handling.
*
* <p>
* This forces the usage of the default signal handler, that will
* eventually call {@link #abort(int, String) abort} and then perform
* exit(1).
*
* <p>
* If you want to provide a custom signal handler you can use
* {@link #setSignalHandler(org.pykix.libburnia.libburn.Burn.SignalHandler, int)}
*
* @param msg
* If not <code>null</code> then it is used as prefix for pacifier
* messages.
* @param mode
* 0 call handler(signum, 0) on nearly all signals
* 1 enable system default reaction on all signals
* 2 try to ignore nearly all signals
* 10 like mode 2 but handle SIGABRT like with mode 0
*/
public static void setDefaultSignalHandler(String msg, int mode) {
burn_set_default_signal_handling(msg, mode);
}
public static class Version {
public int major;
public int minor;
public int micro;
public Version(int major, int minor, int micro) {
super();
this.major = major;
this.minor = minor;
this.micro = micro;
}
@Override
public String toString() {
return major + "." + minor + "." + micro;
}
}
/**
* Returns the library's version.
*/
public static Version getVersion() {
return burn_version();
}
private static native int burn_initialize();
private static native void burn_finish();
private static native void burn_preset_device_open(int exclusive,
int blocking, int abort_on_busy);
private static native void burn_allow_untested_profiles(boolean yes);
private static native DriveInfo[] burn_drive_scan();
private static native DriveInfo burn_drive_scan_and_grab(String adr,
boolean load);
private static native int burn_drive_add_whitelist(String adr);
private static native void burn_drive_clear_whitelist();
private static native void burn_set_verbosity(int level);
private static native boolean burn_drive_is_enumerable_adr(String adr);
private static native String burn_drive_convert_fs_adr(String path);
private static native boolean burn_abort_def(int patience, String msg)
throws BurnException;
//TODO not tested at all!!
private static native boolean burn_abort_java(int patience, AbortHandler h)
throws BurnException;
private static native void burn_set_signal_handling(SignalHandler handler,
int mode);
private static native void burn_set_default_signal_handling(String msg,
int mode);
private static native Version burn_version();
static {
System.loadLibrary(JNI_LIBRARY_NAME);
}
}

View File

@ -0,0 +1,39 @@
/*
* BurnException.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Base class for all library exceptions.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class BurnException extends Exception {
public BurnException() {
super();
}
public BurnException(String message, Throwable cause) {
super(message, cause);
}
public BurnException(String message) {
super(message);
}
public BurnException(Throwable cause) {
super(cause);
}
}

View File

@ -0,0 +1,101 @@
/*
* BurnMode.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Burn Mode options.
*
* TODO this is a bitmask on C, I prefer exposing it as a enum in Java
* for now, but I need to think about it. enum is typesafe and more java-like.
* A better option might be creation of 2 enums, one for track mode, another
* for track mode modifier.
*
* TODO comentar bem o uso desta classe
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum BurnMode {
/**
* Track mode - mode 0 data
* 0 bytes of user data. it's all 0s. mode 0. get it? HAH
*/
MODE0(1 << 0),
/**
* Track mode - mode "raw" - all 2352 bytes supplied by app
* FOR DATA TRACKS ONLY!
*/
MODE_RAW(1 << 1),
/**
* Track mode - mode 1 data
* 2048 bytes user data, and all the LEC money can buy
*/
MODE1(1 << 2),
/**
* Track mode - mode 2 data
* defaults to formless, 2336 bytes of user data, unprotected
* | with a data form if required.
*/
MODE2(1 << 3),
/**
* Track mode modifier - Form 1, | with MODE2 for reasonable results
* 2048 bytes of user data, 4 bytes of subheader
*/
FORM1(1 << 4),
/**
* Track mode modifier - Form 2, | with MODE2 for reasonable results
* lots of user data. not much LEC.
*/
FORM2(1 << 5),
/**
* Track mode - audio
* 2352 bytes per sector. may be | with 4ch or preemphasis.
* NOT TO BE CONFUSED WITH {@link #MODE_RAW}
* Audio data must be 44100Hz 16bit stereo with no riff or other header at
* beginning. Extra header data will cause pops or clicks. Audio data should
* also be in little-endian byte order. Big-endian audio data causes static.
*/
AUDIO(1 << 6),
/** Track mode modifier - 4 channel audio. */
AUDIO_4CH(1 << 7),
/** Track mode modifier - Digital copy permitted, can be set on any track. */
COPY(1 << 8),
/** Track mode modifier - 50/15uS pre-emphasis. */
PREEMPHASIS(1 << 9),
/** Input mode modifier - subcodes present packed 16 */
SUBCODE_P16(1 << 10),
/** Input mode modifier - subcodes present packed 96 */
SUBCODE_P96(1 << 11),
/** Input mode modifier - subcodes present raw 96 */
SUBCODE_R96 (1 << 12);
/* for bitmak generation, package protected */
int bm;
private BurnMode(int bm) {
this.bm = bm;
}
}

View File

@ -0,0 +1,72 @@
/*
* BurnSource.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Data source for tracks on disc.
*
* FIXME think about design of this object. being an interface any user
* can create its own implementation and pass it to libburn, and this will
* not work.
*
* @author Vreixo Formoso
* @since 0.1
*/
public interface BurnSource {
/**
* Read data from the source.
*
* @param buffer
* Buffer where data is to be read. Must have at least size bytes.
* @param size
* Number of bytes to be read.
* @return
* Number of bytes actually read.
* @throws IndexOutOfBoundsException
* If size bigger than buffer length
* @throws NullPointerException
* If buffer is <code>null</code>
*/
int read(byte[] buffer, int size);
/**
* Read subchannel data from the source.
*
* @param buffer
* Buffer where data is to be read. Must have at least size bytes.
* @param size
* Number of bytes to be read.
* @return
* Number of bytes actually read.
* @throws IndexOutOfBoundsException
* If size bigger than buffer length
* @throws NullPointerException
* If buffer is <code>null</code>
*/
int readSub(byte[] buffer, int size);
/**
* Get the size of the source's data.
* @return
*/
long getSize();
/**
* Set the size of the source's data.
* @param bytes
* @return
*/
int setSize(long bytes);
}

View File

@ -0,0 +1,129 @@
/*
* Disc.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
* References a whole disc.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Disc extends Proxy {
public static final int POS_END = 100;
/**
* Create a new disc.
*/
public Disc() {
super( burn_disc_create() );
}
Disc(long ptr) {
super(ptr);
}
/**
* Add a session to disc at a specific position.
*
* @param session
* Session to add to the disc.
* @param pos
* position to add at ({@link #POS_END} is "at the end").
* @return
* <code>true</code> on success, <code>false</code> on failure.
*/
public boolean addSession(Session session, int pos) {
if ( pos > POS_END ) {
return false;
}
return burn_disc_add_session( pointerOf(this), pointerOf(session), pos);
}
/**
* Remove a session from a disc.
*
* @param session
* Session to find and remove.
* @return
* <code>true</code> on success, <code>false</code> on failure,
* for example if session was not previously added to disc.
*/
public boolean removeSession(Session session) {
return burn_disc_remove_session( pointerOf(this), pointerOf(session));
}
/**
* Gets an array of all the sessions for the disc.
*
* <p>
* <b>THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION.</b>
*
* FIXME same problem as in {@link Session#getTracks()}
*
* @return
* An array with the sessions.
*/
public Session[] getSessions() {
long[] sessionPtrs = burn_disc_get_sessions(pointerOf(this));
Session[] sessions = new Session[sessionPtrs.length];
for ( int i = 0; i < sessionPtrs.length; ++i ) {
long ptr = sessionPtrs[i];
Session session = (Session) proxyFor(ptr);
if (session == null) {
session = new Session(ptr);
}
sessions[i] = session;
}
return sessions;
}
/**
* Get how much long the disc will be.
*
* @return
* Number of sectors of the disc.
*/
public int getSectors() {
return burn_disc_get_sectors( pointerOf(this) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
burn_disc_free( pointerOf(this) );
}
private static native long burn_disc_create();
private static native void burn_disc_free(long d);
private static native boolean burn_disc_add_session( long d, long s,
int pos);
private static native boolean burn_disc_remove_session(long d, long s);
private static native long[] burn_disc_get_sessions(long d);
private static native int burn_disc_get_sectors(long d);
}

View File

@ -0,0 +1,46 @@
/*
* DiscStatus.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Possible status' of the drive in regard to the disc in it.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum DiscStatus {
/** The current status is not yet known. */
UNREADY,
/** The drive holds a blank disc. */
BLANK,
/** There is no disc at all in the drive. */
EMPTY,
/** There is an incomplete disc in the drive. */
APPENDABLE,
/** There is a disc with data on it in the drive. */
FULL,
/* ts A61007 */
/** The drive was not grabbed when the status was inquired. */
UNGRABBED,
/* ts A61020 */
/** The media seems not to be suitable for burning. */
UNSUITABLE
}

View File

@ -0,0 +1,737 @@
/*
* Drive.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
* References a physical drive in the system.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Drive extends Proxy {
Drive(long ptr) {
super(ptr);
}
/**
* Grab the drive. This must be done before the drive can be used
* (for reading, writing, etc).
*
* @param load
* <code>true</code> to make the drive attempt to load a disc
* (close its tray door, etc).
* @throws BurnException
* if it wasn't possible to grab the drive
*/
public void grab(boolean load) throws BurnException {
if ( !burn_drive_grab(pointerOf(this), load ? 1 : 0) ) {
throw new BurnException("Can't grab the drive");
}
}
/**
* Release the drive. This should not be done until the drive is no longer
* busy (see burn_drive_get_status). The drive is (O_EXCL) unlocked.
*
* @param eject
* <code>true</code> to make the drive eject the disc in it.
*/
public void release(boolean eject) {
burn_drive_release( pointerOf(this), eject ? 1 : 0 );
}
/**
* Returns what kind of disc the drive is holding.
*
* <p>
* This function may need to be called more than once to get a proper
* status from it.
*
* @return
* The status of the drive, or what kind of disc is in it.
*/
public DiscStatus getDiscStatus() {
switch ( burn_disc_get_status( pointerOf(this) ) ) {
case 0:
return DiscStatus.UNREADY;
case 1:
return DiscStatus.BLANK;
case 2:
return DiscStatus.EMPTY;
case 3:
return DiscStatus.APPENDABLE;
case 4:
return DiscStatus.FULL;
case 5:
return DiscStatus.UNGRABBED;
case 6:
return DiscStatus.UNSUITABLE;
default:
throw new RuntimeException("Unexpected value");
}
}
/**
* Tells the MMC Profile identifier of the loaded media. The drive must be
* grabbed in order to get a profile other than {@link Profile#NONE}.
*
* <p>
* libburn currently writes only to profiles 0x09 "CD-R", 0x0a "CD-RW",
* 0x11 "DVD-R", 0x12 "DVD-RAM", 0x13 "DVD-RW restricted overwrite",
* 0x14 "DVD-RW Sequential Recording" or 0x1a "DVD+RW".
*
* <p>
* If enabled by burn_allow_untested_profiles() it also writes to profile
* 0x15 "DVD-R/DL Sequential Recording".
*
* @return
* The profile of the loaded media.
*/
/*
* I've implemented this in a different way that libburn, I prefer returning
* profile as an enum. It has a lot of advantages for the programmer,
* and only one problem: this cannot distinguish between different unknown
* profiles.
*/
public Profile getProfile() {
return Profile.get( burn_disc_get_profile( pointerOf(this) ) );
}
/**
* Tells whether a disc can be erased or not.
*
* @return
* <code>true</code> is inserted disc is erasable,
* <code>false</code> if not.
*/
public boolean isErasable() {
return burn_disc_erasable( pointerOf(this) );
}
/**
* Returns the progress and status of a drive.
*
* @param progress
* Will be filled with the progress of the operation,
* you can pass <code>null</code> if you don't care
* @return
* the current status of the drive.
*/
public DriveStatus getDriveStatus(Progress progress) {
switch ( burn_drive_get_status( pointerOf(this),
progress == null ? 0 : pointerOf(progress) ) ) {
case 0:
return DriveStatus.IDLE;
case 1:
return DriveStatus.SPAWNING;
case 2:
return DriveStatus.READING;
case 3:
return DriveStatus.WRITING;
case 4:
return DriveStatus.WRITING_LEADIN;
case 5:
return DriveStatus.WRITING_LEADOUT;
case 6:
return DriveStatus.ERASING;
case 7:
return DriveStatus.GRABBING;
case 8:
return DriveStatus.WRITING_PREGAP;
case 9:
return DriveStatus.CLOSING_TRACK;
case 10:
return DriveStatus.CLOSING_SESSION;
case 11:
return DriveStatus.FORMATTING;
default:
throw new RuntimeException("Unexpected drive status");
}
}
/**
* Erase a disc in the drive.
*
* <p>
* The drive must be grabbed successfully <b>BEFORE</b> calling this
* function. Always ensure that the drive reports a status of
* {@link DiscStatus#FULL} or {@link DiscStatus#APPENDABLE} before
* calling this function. An erase operation is not cancellable, as
* control of the operation is passed wholly to the drive and
* there is no way to interrupt it safely.
*
* @see #getDiscStatus()
*
* @param fast
* <code>true</code> to do a fast erase, where only the disc's
* headers are erased; <code>false</code> to erase the entire disc.
* With DVD-RW, fast blanking yields media capable only of DAO.
*/
public void erase(boolean fast) {
burn_disc_erase(pointerOf(this), fast);
}
/**
* Creates a WriteOpts object for burning to this drive.
*
* @return
* a WriteOpts object
*/
public WriteOpts newWriteOpts() {
return new WriteOpts( burn_write_opts_new(pointerOf(this)) );
}
/**
* Return the best possible estimation of the currently available capacity
* of the media. This might depend on particular write option settings.
* For inquiring the space with such a set of options, the drive has to be
* grabbed and {@link DriveStatus#IDLE}. If not, then one will only get a
* canned value from the most recent automatic inquiry (e.g. during last
* drive grabbing).
*
* <p>
* An eventual start address from burn_write_opts_set_start_byte() will be
* subtracted from the obtained capacity estimation. Negative results get
* defaulted to 0.
*
* @param opts
* If not <code>null</code>, write parameters to be set on drive
* before query.
* @return
* number of most probably available free bytes.
*/
public long getAvailableSpace(WriteOpts opts) {
return burn_disc_available_space( pointerOf(this),
opts == null ? 0 : pointerOf(opts) );
}
/**
* Write a disc in the drive.
*
* <p>
* The drive must be grabbed successfully before calling this function.
* Always ensure that the drive reports a status of
* {@link DiscStatus#BLANK} or {@link DiscStatus#APPENDABLE} before
* calling this function.
*
* <p>
* Note: write type {@link WriteType#SAO} is currently not capable of
* writing a mix of data and audio tracks. You must use
* {@link WriteType#TAO} for such sessions.
* To be set by {@link WriteOpts#setWriteType(WriteType, BlockTypes)}.
*
* @param o
* The options for the writing operation.
* @param d
* The {@link Disc} object that described the disc to be created.
*/
/*
* ok, this not need to be a member of Drive, but as
* read, erase, etc are also here...
*/
public void write( WriteOpts o, Disc disc) {
burn_disc_write( pointerOf(o), pointerOf(disc) );
}
/**
* Format media for use with libburn. This currently applies to DVD-RW
* in state "Sequential Recording" (profile 0014h) which get formatted to
* state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced"
* by setting bit2 of flag. Other media cannot be formatted yet.
*
* @param size
* The size in bytes to be used with the format command. It should
* be divisible by 32*1024. The effect of this parameter may
* depend on the media profile.
* @param flag
* Bitfield for control purposes:
* <ul>
* <li>bit0= after formatting, write the given number of zero-bytes
* to the media and eventually perform preliminary closing.
* <li>bit1= insist in size 0 even if there is a better default known
* <li>bit2= format to maximum available size
* <li>bit3= -reserved-
* <li>bit4= enforce re-format of (partly) formatted media
* <li>bit7= MMC expert application mode (else libburn tries to
* choose a suitable format type):
* <li>bit8 to bit15 contain the index of the format to use. See
* burn_disc_get_formats(), burn_disc_get_format_descr().
* Acceptable types are: 0x00, 0x10, 0x11, 0x13, 0x15, 0x26.
* If bit7 is set, bit4 is set automatically.
* </ul>
*/
public void format(long size, int flag) {
burn_disc_format(pointerOf(this), size, flag);
}
/**
* Cancel an operation on a drive.
*
* <p>
* This will only work when the drive's busy state is
* {@link DriveStatus#READING} or {@link DriveStatus#WRITING}.
*
* @see #getDriveStatus(Progress)
*/
public void cancel() {
burn_drive_cancel( pointerOf(this) );
}
/**
* Inquire wether the most recent write run was successful. Reasons for
* non-success may be: rejection of burn parameters, abort during fatal
* errors during write, a call to {@link #cancel()} by the application
* thread.
*
* @return
* <code>true</code> if burn seems to have went well,
* <code>false</code> if burn failed.
*/
public boolean wroteWell() {
return burn_drive_wrote_well( pointerOf(this) );
}
/**
* Get the drive's disc object.
*
* @return
* the Disc object or <code>null</code> on failure.
*/
public Disc getDisc() {
long ptr = burn_drive_get_disc( pointerOf(this) );
if ( ptr == 0 ) {
return null;
}
Disc disc = (Disc) proxyFor(ptr);
if ( disc == null) {
disc = new Disc(ptr);
}
return disc;
}
/**
* Sets drive read and write speed.
*
* @param read
* Read speed in k/s (0 is max).
* @param write
* Write speed in k/s (0 is max).
*/
public void setSpeed(int read, int write) {
burn_drive_set_speed( pointerOf(this), read, write);
}
/**
* Creates a ReadOpts object for reading from this drive.
*
* @return
* the ReadOpts object.
*/
public ReadOpts newReadOpts() {
return new ReadOpts( burn_read_opts_new(pointerOf(this)) );
}
/**
* Gets the maximum write speed for a drive and eventually loaded media.
*
* <p>
* The return value might change by the media type of already loaded media,
* again by call burn_drive_grab() and again by call burn_disc_read_atip().
*
* @return
* Maximum write speed in K/s.
*/
public int getWriteSpeed() {
return burn_drive_get_write_speed( pointerOf(this) );
}
/**
* Gets the minimum write speed for the drive and eventually loaded media.
*
* <p>
* The return value might change by the media type of already loaded media,
* again by call burn_drive_grab() and again by call burn_disc_read_atip().
*
* @return
* Minimum write speed in K/s.
*/
public int getMinWriteSpeed() {
return burn_drive_get_min_write_speed( pointerOf(this) );
}
/**
* Gets the maximum read speed for the drive.
*
* @return
* Maximum read speed in K/s.
*/
public int getReadSpeed() {
return burn_drive_get_read_speed( pointerOf(this) );
}
/**
* Obtain a copy of the current speed descriptor list. The drive's list
* gets updated on various occasions such as {@link #grab(boolean)} but
* the copy obtained here stays untouched.
*
* <p>
* Speeds may appear several times in the list. The list content depends
* much on drive and media type. It seems that .source == 1 applies mostly
* to CD media whereas .source == 2 applies to any media.
*
* @return
* The speed list, may be empty.
* @throws BurnException
* If severe error occurs.
*/
public SpeedDescriptor[] getSpeedList() throws BurnException {
SpeedDescriptor[] lst = burn_drive_get_speedlist(pointerOf(this));
if (lst == null) {
throw new BurnException("Can't get speed list");
}
return lst;
}
/**
* <b>WARNING:</b>
* This revives an old bug-like behavior that might be dangerous.
*
* Sets the drive status to {@link DiscStatus#BLANK} if it is
* {@link DiscStatus#UNREADY} or {@link DiscStatus#UNSUITABLE}.
* Thus marking media as writable which actually failed to declare
* themselves either blank or (partially) filled.
*
* @return
* <code>true</code> on success, <code>false</code> if drive is
* in an unsuitable status.
*/
public boolean pretendBlank() {
return burn_disc_pretend_blank( pointerOf(this) );
}
/**
* <b>WARNING:</b>
* This overrides the safety measures against unsuitable media.
*
* Sets the drive status to {@link DiscStatus#FULL} if it is
* {@link DiscStatus#UNREADY} or {@link DiscStatus#UNSUITABLE}.
* Thus marking media as blankable which actually failed to declare
* themselves either blank or (partially) filled.
*
* @return
* <code>true</code> on success, <code>false</code> if drive is
* in an unsuitable status.
*/
public boolean pretendFull() {
return burn_disc_pretend_full( pointerOf(this) );
}
/**
* Reads ATIP information from inserted media. To be obtained via
* {@link #getWriteSpeed()}, {@link #getMinWriteSpeed()},
* burn_drive_get_start_end_lba(). The drive must be grabbed for this call.
*
* @return
* <code>true</code> on success, <code>false</code> if no valid ATIP
* info read.
* @throws BurnException
* On a severe error.
*/
public boolean readAtip() throws BurnException {
switch ( burn_disc_read_atip( pointerOf(this) ) ) {
case 1:
return true;
case 0:
return false;
default:
throw new BurnException("Severe error reading ATIP");
}
}
/**
* Returns start lba of the media which is currently inserted in the drive.
* The drive has to be grabbed to have hope for reply.
*
* <p>
* Shortcomming (not a feature): unless {@link #readAtip()} was called
* only blank media will return valid info.
*
* @return
* the start lba value
* @throws BurnException
* On invalid lba value.
*/
/*
* TODO mmm, I really don't like to throw an Exception here...
*/
public int getStartLba() throws BurnException {
/* flag is unused yet */
return burn_drive_get_start_lba(pointerOf(this), 0);
}
/**
* Returns end lba of the media which is currently inserted in the drive.
* The drive has to be grabbed to have hope for reply.
*
* <p>
* Shortcomming (not a feature): unless {@link #readAtip()} was called
* only blank media will return valid info.
*
* @return
* the end lba value
* @throws BurnException
* On invalid lba value.
*/
/*
* TODO mmm, I really don't like to throw an Exception here...
*/
public int getEndLba() throws BurnException {
/* flag is unused yet */
return burn_drive_get_end_lba(pointerOf(this), 0);
}
/**
* Read start lba of a track from media.
*
* <p>
* Usually a track lba is obtained from the result of
* {@link Track#getEntry()}. This call retrieves an updated lba,
* and can address the invisible track to come.
*
* <p>
* The drive must be grabbed for this call. One may not issue this call
* during ongoing {@link #write(WriteOpts, Disc)} or {@link #erase(boolean)}.
*
* @param o
* If not <code>null</code>, write parameters to be set on drive
* before query
* @param trackno
* 0=next track to come, >0 number of existing track
* @return
* start lba
* @throws BurnException
* On error
*/
public int getTrackLba(WriteOpts o, int trackno) throws BurnException {
return burn_disc_track_lba( pointerOf(this),
o == null ? 0 : pointerOf(o), trackno);
}
/**
* Read Next Writeable Address of a track from media.
*
* <p>
* The drive must be grabbed for this call. One may not issue this call
* during ongoing {@link #write(WriteOpts, Disc)} or {@link #erase(boolean)}.
*
* @param o
* If not <code>null</code>, write parameters to be set on drive
* before query
* @param trackno
* 0=next track to come, >0 number of existing track
* @return
* Next Writeable Address
* @throws BurnException
* If error or non valid nwa
*/
public int getTrackNwa(WriteOpts o, int trackno) throws BurnException {
return burn_disc_track_nwa( pointerOf(this),
o == null ? 0 : pointerOf(o), trackno);
}
/**
* Read start lba of the first track in the last complete session.
*
* <p>
* This is the first parameter of mkisofs option -C. The second parameter
* is nwa as obtained by {@link #getTrackNwa(WriteOpts, int)} with
* trackno 0.
*
* @return
* returns the start address of that track
* @throws BurnException
* on error
*/
public int getMsc1() throws BurnException {
return burn_disc_get_msc1(pointerOf(this));
}
/**
* Creates a {@link MultiCaps} with values which are appropriate for the
* drive and the loaded media. The drive must be grabbed for this call.
*
* @param wt
* With {@link WriteType#NONE} the best capabilities of all write modes
* get returned. If set to a write mode like {@link WriteType#SAO} the
* capabilities with that particular mode are returned and the
* {@link MultiCaps#isWritingPossible()} return value is
* <code>false</code> if the desired mode is not possible.
* @return
* The MultiCaps object.
* @throws BurnException
* On error.
*/
public MultiCaps getMultiCaps(WriteType wt) throws BurnException {
/* flag param unused yet */
return burn_disc_get_multi_caps(pointerOf(this),
wt.ordinal(), 0);
}
/**
* TODO not implemented in libburn
*
* Read a disc from the drive and write it to an fd pair. The drive must be
* grabbed successfully BEFORE calling this function. Always ensure that the
* drive reports a status of BURN_DISC_FULL before calling this function.
*
* @param opts
* The options for the read operation.
*/
public void read(ReadOpts opts) {
burn_disc_read( pointerOf(this), pointerOf(opts) );
}
/**
* Inquire the formatting status, the associated sizes and the number of
* available formats. The info is media specific and stems from MMC command
* 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details.
* Media type can be determined via burn_disc_get_profile().
*
* @return
*
* @throws BurnException
* On failure
*/
public Formats getFormats() throws BurnException {
Formats f = burn_disc_get_formats( pointerOf(this) );
if ( f != null ) {
return f;
} else {
throw new BurnException("Can't get formats");
}
}
/**
* Inquire parameters of an available media format.
*
* @param index
* he index of the format item. Beginning with 0 up to reply
* parameter from {@link #getFormats()} :
* {@link Formats#getNumFormats()} - 1
* @return
* @throws BurnException
* On error
*/
public FormatDesc getFormatDescr(int index) throws BurnException {
FormatDesc fd = burn_disc_get_format_descr(pointerOf(this), index);
if ( fd == null ) {
throw new BurnException("Can't get format desc");
}
return fd;
}
private static native boolean burn_drive_grab(long drive, int load);
private static native void burn_drive_release(long drive, int eject);
private static native int burn_disc_get_status(long drive);
private static native short burn_disc_get_profile(long d);
private static native boolean burn_disc_erasable(long d);
private static native int burn_drive_get_status(long drive, long p);
private static native void burn_disc_erase(long drive, boolean fast);
private static native long burn_write_opts_new(long drive);
private static native long burn_disc_available_space(long d, long o);
private static native void burn_disc_write(long o, long disc);
private static native void burn_disc_format(long drive, long size, int flag);
private static native void burn_drive_cancel(long drive);
private static native boolean burn_drive_wrote_well(long d);
private static native long burn_drive_get_disc(long d);
private static native void burn_drive_set_speed(long d, int r, int w);
private static native int burn_drive_get_write_speed(long d);
private static native int burn_drive_get_min_write_speed(long d);
private static native int burn_drive_get_read_speed(long d);
private static native long burn_read_opts_new(long drive);
private static native SpeedDescriptor[] burn_drive_get_speedlist(long d);
private static native boolean burn_disc_pretend_blank(long drive);
private static native boolean burn_disc_pretend_full(long drive);
private static native int burn_disc_read_atip(long drive);
/*
* These two functions are wrapping for the single C function:
* int burn_drive_get_start_end_lba(struct burn_drive *drive,
* int *start_lba, int *end_lba, int flag);
*/
private static native int burn_drive_get_start_lba(long drive, int flag)
throws BurnException;
private static native int burn_drive_get_end_lba(long drive, int flag)
throws BurnException;
/*
* These two functions are wrapping for the single C function:
* int burn_disc_track_lba_nwa(struct burn_drive *d,
* struct burn_write_opts *o, int trackno, int *lba, int *nwa);
*/
private static native int burn_disc_track_lba(long d, long o, int trackno)
throws BurnException;
private static native int burn_disc_track_nwa(long d, long o, int trackno)
throws BurnException;
private static native int burn_disc_get_msc1(long d)
throws BurnException;
private static native MultiCaps burn_disc_get_multi_caps(long d,
int wt, int flag) throws BurnException;
private static native void burn_disc_read(long d, long o);
private static native Formats burn_disc_get_formats(long drive);
private static native FormatDesc burn_disc_get_format_descr(long d,
int index);
}

View File

@ -0,0 +1,311 @@
/*
* DriveInfo.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import java.util.EnumSet;
/**
* Information on a drive in the system.
*
* @author Vreixo Formoso
* @since 0.1
*/
/*
* This is not a proxy, but it contains a reference to the
* C burn_drive_info struct it represents. This is only for two
* pair of functions, forget and getAdr, than need that reference.
*
* FIXME in a future it would be a good idea to ensure that this
* reference is part of the drive_infos array, cause otherwise that
* means that this DriveInfo is used after a new scan.
*
* TODO do good java comments to getters
*/
public class DriveInfo {
/** Name of the vendor of the drive. */
private String vendor;
/** Name of the drive. */
private String product;
/** Revision of the drive. */
private String revision;
/** Location of the drive in the filesystem. */
/* This is currently the string which is used as persistent
* drive address. But be warned: there is NO GUARANTEE that this
* will stay so. Always use function {@link #getAdr} to
* inquire a persistent address.
*/
private String location;
/** Can the drive read DVD-RAM discs. */
private boolean readDvdram;
/** Can the drive read DVD-R discs. */
private boolean readDvdr;
/** Can the drive read DVD-ROM discs. */
private boolean readDvdrom;
/** Can the drive read CD-R discs. */
private boolean readCdr;
/** Can the drive read CD-RW discs. */
private boolean readCdrw;
/** Can the drive write DVD-RAM discs. */
private boolean writeDvdram;
/** Can the drive write DVD-R discs. */
private boolean writeDvdr;
/** Can the drive write CD-R discs. */
private boolean writeCdr;
/** Can the drive write CD-RW discs. */
private boolean writeCdrw;
/** Can the drive simulate a write. */
private boolean writeSimulate;
/** Can the drive report C2 errors. */
private boolean c2Errors;
/** The size of the drive's buffer (in kilobytes). */
private int bufferSize;
/**
* The supported block types in tao mode.
* They should be tested with the desired block type.
*
* @see BlockType
*/
private EnumSet<BlockType> taoBlockTypes;
/**
* The supported block types in sao mode.
* They should be tested with the desired block type.
*
* @see BlockType
*/
private EnumSet<BlockType> saoBlockTypes;
/**
* The supported block types in raw mode.
* They should be tested with the desired block type.
*
* @see BlockType
*/
private EnumSet<BlockType> rawBlockTypes;
/**
* The supported block types in packet mode.
* They should be tested with the desired block type.
*
* @see BlockType
*/
private EnumSet<BlockType> packetBlockTypes;
/**
* The value by which this drive can be indexed when using functions
* in the library. This is the value to pass to all libbburn functions
* that operate on a drive.
*/
private Drive drive;
/* reference to the C struct */
private long ptr;
DriveInfo(long ptr, String vendor, String product, String revision,
String location, boolean readDvdram, boolean readDvdr,
boolean readDvdrom, boolean readCdr, boolean readCdrw,
boolean writeDvdram, boolean writeDvdr, boolean writeCdr,
boolean writeCdrw, boolean writeSimulate, boolean errors,
int bufferSize, int taoBlockTypes, int saoBlockTypes,
int rawBlockTypes, int packetBlockTypes, long drive) {
super();
this.ptr = ptr;
this.vendor = vendor;
this.product = product;
this.revision = revision;
this.location = location;
this.readDvdram = readDvdram;
this.readDvdr = readDvdr;
this.readDvdrom = readDvdrom;
this.readCdr = readCdr;
this.readCdrw = readCdrw;
this.writeDvdram = writeDvdram;
this.writeDvdr = writeDvdr;
this.writeCdr = writeCdr;
this.writeCdrw = writeCdrw;
this.writeSimulate = writeSimulate;
c2Errors = errors;
this.bufferSize = bufferSize;
this.taoBlockTypes = blockTypeBitMask2EnumSet(taoBlockTypes);
this.saoBlockTypes = blockTypeBitMask2EnumSet(saoBlockTypes);
this.rawBlockTypes = blockTypeBitMask2EnumSet(rawBlockTypes);
this.packetBlockTypes = blockTypeBitMask2EnumSet(packetBlockTypes);
//TODO can this lead to duplicate objects??
this.drive = new Drive(drive);
}
public int getBufferSize() {
return bufferSize;
}
public boolean c2Errors() {
return c2Errors;
}
public Drive getDrive() {
return drive;
}
public String getLocation() {
return location;
}
public EnumSet<BlockType> getPacketBlockTypes() {
return packetBlockTypes;
}
public String getProduct() {
return product;
}
public EnumSet<BlockType> getRawBlockTypes() {
return rawBlockTypes;
}
public boolean readCdr() {
return readCdr;
}
public boolean readCdrw() {
return readCdrw;
}
public boolean readDvdr() {
return readDvdr;
}
public boolean readDvdram() {
return readDvdram;
}
public boolean readDvdrom() {
return readDvdrom;
}
public String getRevision() {
return revision;
}
public EnumSet<BlockType> getSaoBlockTypes() {
return saoBlockTypes;
}
public EnumSet<BlockType> getTaoBlockTypes() {
return taoBlockTypes;
}
public String getVendor() {
return vendor;
}
public boolean writeCdr() {
return writeCdr;
}
public boolean writeCdrw() {
return writeCdrw;
}
public boolean writeDvdr() {
return writeDvdr;
}
public boolean writeDvdram() {
return writeDvdram;
}
public boolean writeSimulate() {
return writeSimulate;
}
/**
* Release memory about a single drive and any exclusive lock on it.
* Become unable to inquire or grab it.
* Expect FATAL consequences if you try.
*
* @param force
* controls degree of permissible drive usage at the moment this
* function is called, and the amount of automatically provided
* drive shutdown :
* 0= drive must be ungrabbed and BURN_DRIVE_IDLE
* 1= try to release drive resp. accept BURN_DRIVE_GRABBING
* Use these two only. Further values are to be defined.
* @return
* 1 on success, 2 if drive was already forgotten,
* 0 if not permissible, &lt; 0 on other failures,
*
* TODO throw exceptions instead of these return values
*/
public int forget(int force) {
return burn_drive_info_forget(ptr, force);
}
/**
* Inquire the persistent address of the given drive.
*
* @return
* The persistent address of the drive.
* @throws BurnException
* If address can't be getted, what means a libburn
* internal problem.
*/
public String getAdr() throws BurnException {
String adr = burn_drive_get_adr(ptr);
if ( adr == null ) {
throw new BurnException("Internal libray error");
}
return adr;
}
@Override
public String toString() {
return vendor + " " + product + " " + revision + " / " + location;
}
private static native int burn_drive_info_forget(long di, int force);
private static native String burn_drive_get_adr(long drive_info);
private EnumSet<BlockType> blockTypeBitMask2EnumSet(int bm) {
EnumSet<BlockType> blockTypes = EnumSet.noneOf(BlockType.class);
for ( BlockType bt : EnumSet.allOf(BlockType.class) ) {
if ( (bm & bt.code) != 0 ) {
blockTypes.add(bt);
}
}
return blockTypes;
}
}

View File

@ -0,0 +1,63 @@
/*
* DriveStatus.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Possible busy states for a drive.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum DriveStatus {
/** The drive is not in an operation. */
IDLE,
/**
* The library is spawning the processes to handle a pending
* operation (A read/write/etc is about to start but hasn't quite
* yet).
*/
SPAWNING,
/** The drive is reading data from a disc. */
READING,
/** The drive is writing data to a disc. */
WRITING,
/** The drive is writing Lead-In. */
WRITING_LEADIN,
/** The drive is writing Lead-Out. */
WRITING_LEADOUT,
/** The drive is erasing a disc. */
ERASING,
/** The drive is being grabbed. */
GRABBING,
/** The drive gets written zeroes before the track payload data. */
WRITING_PREGAP,
/** The drive is told to close a track (TAO only). */
CLOSING_TRACK,
/** The drive is told to close a session (TAO only). */
CLOSING_SESSION,
/** The drive is formatting media. */
FORMATTING
}

View File

@ -0,0 +1,58 @@
/*
* FormatDesc.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
*
* @author Vreixo Formoso
* @since 0.1
*/
public class FormatDesc {
private int type;
private long size;
private int tdp;
/* to be called from JNI code */
FormatDesc(int type, long size, int tdp) {
super();
this.type = type;
this.size = size;
this.tdp = tdp;
}
/**
* The maximum size in bytes achievable with this format.
*/
public long getSize() {
return size;
}
/**
* Type Dependent Parameter. See mmc5r03c.pdf.
*/
public int getTdp() {
return tdp;
}
/**
* The format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT.
* 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow,
* 0x15=DVD-RW quick, 0x13=DVD-RW quick grow,
* 0x26=DVD+RW background
*/
public int getType() {
return type;
}
}

View File

@ -0,0 +1,28 @@
/*
* FormatStatus.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Possible formatting status values.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum FormatStatus {
/* C defines begins with 1, add +1 to ordinal() */
UNFORMATTED,
FORMATTED,
UNKNOWN;
}

View File

@ -0,0 +1,83 @@
/*
* Formats.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
*
* @author Vreixo Formoso
* @since 0.1
*/
/*
* TODO I really don't like this way of wrapping the burn_disc_get_formats
* return value, maybe an internal class of Burn would be a better idea.
*/
public class Formats {
private FormatStatus status;
private long size;
private int blSas;
private int numFormats;
/* to be called from JNI code */
Formats(int status, long size, int blSas, int numFormats) {
super();
this.status = FormatStatus.values()[status-1];
this.size = size;
this.blSas = blSas;
this.numFormats = numFormats;
}
/**
* Additional info "Block Length/Spare Area Size".
* Expected to be constantly 2048 for non-BD media.
*
* @return
*/
public int getBlSas() {
return blSas;
}
/**
* The number of available formats. To be used with
* burn_disc_get_format_descr() to obtain such a format
* and eventually with burn_disc_format() to select one.
*
* @return
*/
public int getNumFormats() {
return numFormats;
}
/**
* The size in bytes associated with status.
* unformatted: the maximum achievable size of the media
* formatted: the currently formatted capacity
* unknown: maximum capacity of drive or of media
* @return
*/
public long getSize() {
return size;
}
/**
* The current formatting status of the inserted media.
*
* @return
* The format status. Note: {@link FormatStatus#UNKNOWN} is the
* legal status for quick formatted, yet unwritten DVD-RW.
*/
public FormatStatus getStatus() {
return status;
}
}

View File

@ -0,0 +1,128 @@
/*
* Message.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Message from libburn.
*
* <p>
* Only fatal messages are printed to stderr by default. This class allows you
* to change that behavior.
*
* <p>
* Indeed, you can also select message queuing, which allows you to retrieve
* the messages. TODO
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Message {
/** */
public enum Severity {
NEVER, FATAL, SORRY, WARNING, HINT, NOTE, UPDATE, DEBUG, ALL
}
private int errorCode;
private String msgText;
private int osErrno;
private Severity severity;
/* it's to be called from JNI code */
Message(int errorCode, String msgText, int osErrno, String severity) {
super();
this.errorCode = errorCode;
this.msgText = msgText;
this.osErrno = osErrno;
this.severity = Severity.valueOf(severity);
}
/**
* Get the a unique error code as listed in libburn/libdax_msgs.h
*
* TODO i need to get the errcodes and list it here, maybe as a enum,
* maybe as integer constants!!
*/
public int getErrorCode() {
return errorCode;
}
/**
* Get a text describing the message
*/
public String getMsgText() {
return msgText;
}
/**
* Get the eventual errno related to the message.
*/
public int getOsErrno() {
return osErrno;
}
/**
* Severity related to the message.
*/
public Severity getSeverity() {
return severity;
}
/**
* Control queueing and stderr printing of messages from libburn.
*
* @param queueSeverity
* Gives the minimum limit for messages to be queued.
* Default: {@link Severity#NEVER}. If you queue messages then you
* must consume them by burn_msgs_obtain().
* @param printSeverity
* Does the same for messages to be printed directly
* to stderr. Default: {@link Severity#FATAL}.
* @param printId
* A text prefix to be printed before the message.
* @return
* <code>true</code> for success, <code>false</code> for error.
*/
public static boolean setSeverities(Severity queueSeverity,
Severity printSeverity, String printId) {
return ( burn_msgs_set_severities(queueSeverity.name(),
printSeverity.name(), printId) > 0);
}
/**
* Obtain the oldest pending libburn message from the queue which has at
* least the given minSeverity. This message and any older message of
* lower severity will get discarded from the queue and is then lost
* forever.
*
* @param minSeverity
* The minimum severity that a message must have to be retrieved.
* To call with minSeverity {@link Severity#NEVER} will discard the
* whole queue.
* @return
* The oldest pending message or <code>null</code> if a message
* with given or higher priority wasn't found.
*/
/*
* TODO this implementation forgets the error that C function can throw!!
*/
public static Message obtain(Severity minSeverity) {
return burn_msgs_obtain( minSeverity.name() );
}
private static native int burn_msgs_set_severities(String queueSeverity,
String printSeverity, String printId);
private static native Message burn_msgs_obtain(String minSeverity);
}

View File

@ -0,0 +1,140 @@
/*
* Msf.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Represent a minute-second-frame (MSF) address.
*
* @author Vreixo Formoso
* @since 0.1
*/
/*
* Due its simplicity, the functions here are implemented in pure Java,
* without really wrapping underlying libburn C functions.
*/
public class Msf {
/*
* I make this vars public, maybe a get/set would be a better option.
*/
/** Minute component. */
public int m;
/** Second component. */
public int s;
/** Frame component. */
public int f;
public Msf(int m, int s, int f) {
super();
this.m = m;
this.s = s;
this.f = f;
}
/**
* Get the sector count for this MSF.
*/
public int getSectors() {
return msf2Sectors(m, s, f);
}
/**
* Get the lba for this MSF.
*/
public int getLba() {
return msf2Lba(m, s, f);
}
/**
* Convert a minute-second-frame (MSF) value to sector count.
*
* @param m
* Minute component.
* @param s
* Second component.
* @param f
* Frame component.
* @return
* The sector count.
*/
public static int msf2Sectors(int m, int s, int f) {
return (m * 60 + s) * 75 + f;
}
/**
* Convert a sector count to minute-second-frame (MSF).
*
* @param sectors
* The sector count.
* @return
* The MSF.
*/
public static Msf sectors2Msf(int sectors) {
int m = sectors / (60 * 75);
int s = (sectors - m * 60 * 75) / 75;
int f = sectors - m * 60 * 75 - s * 75;
return new Msf(m, s, f);
}
/**
* Convert a minute-second-frame (MSF) value to a lba.
*
* @param m
* Minute component.
* @param s
* Second component.
* @param f
* Frame component.
* @return
* The lba.
*/
public static int msf2Lba(int m, int s, int f) {
if (m < 90)
return (m * 60 + s) * 75 + f - 150;
else
return (m * 60 + s) * 75 + f - 450150;
}
/**
* Convert an lba to minute-second-frame (MSF).
*
* @param lba
* The lba.
* @return
* The MSF.
*/
public static Msf lba2Msf(int lba) {
int m, s, f;
if (lba >= -150) {
m = (lba + 150) / (60 * 75);
s = (lba + 150 - m * 60 * 75) / 75;
f = lba + 150 - m * 60 * 75 - s * 75;
} else {
m = (lba + 450150) / (60 * 75);
s = (lba + 450150 - m * 60 * 75) / 75;
f = lba + 450150 - m * 60 * 75 - s * 75;
}
return new Msf(m, s, f);
}
}

View File

@ -0,0 +1,243 @@
/*
* MultiCaps.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
*
* @author Vreixo Formoso
* @since 0.1
*/
public class MultiCaps {
private boolean multiSession;
private boolean multiTrack;
private boolean startAdr;
private long startAlignment;
private long startRangeLow;
private long startRangeHigh;
private int mightDoTao;
private int mightDoSao;
private int mightDoRaw;
private WriteType advisedWriteMode;
private WriteType selectedWriteMode;
private Profile currentProfile;
private boolean cdProfile;
/*
* this is not part of C burn_multi_caps struct, but is returned
* in burn_disc_get_multi_caps function
*/
private boolean writingPossible;
/* be to called from JNI code */
MultiCaps(boolean multiSession, boolean multiTrack, boolean startAdr,
long startAlignment, long startRangeLow, long startRangeHigh,
int mightDoTao, int mightDoSao, int mightDoRaw,
int advisedWriteMode, int selectedWriteMode, short currentProfile,
boolean cdProfile, boolean writingPossible) {
super();
this.multiSession = multiSession;
this.multiTrack = multiTrack;
this.startAdr = startAdr;
this.startAlignment = startAlignment;
this.startRangeLow = startRangeLow;
this.startRangeHigh = startRangeHigh;
this.mightDoTao = mightDoTao;
this.mightDoSao = mightDoSao;
this.mightDoRaw = mightDoRaw;
this.advisedWriteMode = WriteType.values()[advisedWriteMode];
this.selectedWriteMode = WriteType.values()[selectedWriteMode];
this.currentProfile = Profile.get(currentProfile);
this.cdProfile = cdProfile;
this.writingPossible = writingPossible;
}
/**
* Get generally advised write mode.
*
* <p>
* Not necessarily the one chosen by
* {@link WriteOpts#setAutoWriteType(Disc, int)}
* because the {@link Disc} object might impose particular demands.
*/
public WriteType getAdvisedWriteMode() {
return advisedWriteMode;
}
/**
* Wether the current profile indicates CD media.
*
* @return
* <code>true</code> = yes, <code>false</code> = no
*/
public boolean isCdProfile() {
return cdProfile;
}
/**
* Profile which was current when the reply was generated.
*/
public Profile getCurrentProfile() {
return currentProfile;
}
/**
* Potential availability of RAW write mode.
*
* <p>
* With CD media (profiles 0x09 and 0x0a) check also the element
* {@link DriveInfo#getRawBlockTypes()}.
*
* @return
* <ul>
* <li>4= needs no size prediction, not to be chosen automatically
* <li>3= needs size prediction, not to be chosen automatically
* <li>2= available, no size prediction necessary
* <li>1= available, needs exact size prediction
* <li>0= not available
* </ul>
*/
public int getMightDoRaw() {
return mightDoRaw;
}
/**
* Potential availability of SAO write mode.
*
* <p>
* With CD media (profiles 0x09 and 0x0a) check also the element
* {@link DriveInfo#getSaoBlockTypes()}.
*
* @return
* <ul>
* <li>4= needs no size prediction, not to be chosen automatically
* <li>3= needs size prediction, not to be chosen automatically
* <li>2= available, no size prediction necessary
* <li>1= available, needs exact size prediction
* <li>0= not available
* </ul>
*/
public int getMightDoSao() {
return mightDoSao;
}
/**
* Potential availability of TAO write mode.
*
* <p>
* With CD media (profiles 0x09 and 0x0a) check also the element
* {@link DriveInfo#getTaoBlockTypes()}.
*
* @return
* <ul>
* <li>4= needs no size prediction, not to be chosen automatically
* <li>3= needs size prediction, not to be chosen automatically
* <li>2= available, no size prediction necessary
* <li>1= available, needs exact size prediction
* <li>0= not available
* </ul>
*/
public int getMightDoTao() {
return mightDoTao;
}
/**
* Multi-session capability allows to keep the media appendable after
* writing a session. It also guarantees that the drive will be able
* to predict and use the appropriate Next Writeable Address to place
* the next session on the media without overwriting the existing ones.
*
* <p>
* It does not guarantee that the selected write type is able to do
* an appending session after the next session. (E.g. CD SAO is capable
* of multi-session by keeping a disc appendable. But {@link #getMightDoSao()}
* will be 0 afterwards, when checking the appendable media.)
*
* @return
* <code>true</code>= media may be kept appendable by
* {@link WriteOpts#setMulti(boolean)} with <code>true</code> as
* parameter.
* <code>false</code>= media will not be appendable
*/
public boolean isMultiSession() {
return multiSession;
}
/**
* Multi-track capability allows to write more than one track source
* during a single session. The written tracks can later be found in
* libburn's TOC model with their start addresses and sizes.
*
* @return
* if <code>true</code>, multiple tracks per session are allowed,
* else, only one track per session allowed
*/
public boolean isMultiTrack() {
return multiTrack;
}
/**
* Write mode as given by parameter wt of burn_disc_get_multi_caps().
*/
public WriteType getSelectedWriteMode() {
return selectedWriteMode;
}
/**
* Start-address capability allows to set a non-zero address with
* {@link WriteOpts#setStartByte(long)}. Eventually this has to respect
* {@link #getStartAlignment()} and {@link #getStartRangeRow()},
* {@link #getStartRangeHigh()} in this structure.
*
* @return
* if <code>true</code>, non-zero start address is allowed, otherwise
* only start address 0 is allowed (to depict the drive's own idea
* about the appropriate write start)
*/
public boolean isStartAdr() {
return startAdr;
}
/**
* The alignment for start addresses.
* ( start_address % start_alignment ) must be 0.
*/
public long getStartAlignment() {
return startAlignment;
}
/**
* The highest addressable start address.
*/
public long getStartRangeHigh() {
return startRangeHigh;
}
/**
* The lowest permissible start address.
*/
public long getStartRangeLow() {
return startRangeLow;
}
/**
* @return
* If <code>false</code>, writing seems impossible , else writing
* is possible
*/
public boolean isWritingPossible() {
return writingPossible;
}
}

View File

@ -0,0 +1,91 @@
/*
* Profile.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import java.util.EnumSet;
/**
* MMC profile of the loaded media.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum Profile {
NONE((short)0, "No profile"),
NON_REMOVABLE_DISC((short)0x01, "Non-removable disc"),
REMOVABLE_DISC((short)0x02, "Removable disc"),
MO_ERASABLE((short)0x03, "MO Erasable"),
OPTICAL_WRITE_ONCE((short)0x04, "Optical Write Once"),
AS_MO((short)0x05, "AS-MO"),
CD_ROM((short)0x08, "CD-ROM"),
CD_R((short)0x09, "CD-R"),
CD_RW((short)0x0A, "CD-RW"),
DVD_ROM((short)0x10, "DVD-ROM"),
DVD_R_SEQUENCIAL((short)0x11, "DVD-R Sequential Recording"),
DVD_RAM((short)0x12, "DVD-RAM"),
DVD_RW_RESTRICTED_OVERWITE((short)0x13, "DVD-RW Restricted Overwrite"),
DVD_RW_SEQUENCIAL((short)0x14, "DVD-RW Sequential recording"),
DVD_R_DL_SEQUENCIAL((short)0x15, "DVD-R Dual Layer Sequential Recording"),
DVD_R_DL_JUMP((short)0x16, "DVD-R Dual Layer Jump Recording"),
DVD_PLUS_RW((short)0x1A, "DVD+RW"),
DVD_PLUS_R((short)0x1B, "DVD+R"),
DVD_PLUS_RW_DL((short)0x2A, "DVD+RW Dual Layer"),
DVD_PLUS_R_DL((short)0x2B, "DVD+R Dual Layer"),
BD_ROM((short)0x40, "BD-ROM"),
BD_R_SRM((short)0x41, "BD-R SRM"),
BD_R_RRM((short)0x42, "BD-R RRM"),
HD_DVD_ROM((short)0x50, "HD DVD-ROM"),
HD_DVD_R((short)0x51, "HD DVD-R"),
HD_DVD_RAM((short)0x52, "HD DVD-RAM"),
UNKNOWN((short)0xFFFF, "Unknown Profile");
private final short code;
private final String name;
private Profile(final short code, final String name) {
this.code = code;
this.name = name;
}
/**
* Get the Profile Number as of mmc5r03c.pdf, table 89.
*
* @return
* The profile number.
*/
public short getCode() {
return code;
}
/**
* Get the Profile Name (e.g "CD-RW").
*
* @return
* the profile name
*/
public String getName() {
return name;
}
static Profile get(short code) {
EnumSet<Profile> set = EnumSet.allOf(Profile.class);
for ( Profile prof : set ) {
if ( prof.getCode() == code) {
return prof;
}
}
return UNKNOWN;
}
}

View File

@ -0,0 +1,164 @@
/*
* Progress.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
* Operation progress report. All values are 0 based indices.
*
* @author Vreixo Formoso
* @since 0.1
*/
/*
* I've implemented this as a proxy, because I think is a good option given
* the normal usage of this object. The 3 considered options are:
* - One option is implement this as a pure Java option, created in JNI
* with a copy of the C struct and returned back to Java. This involves
* creation of a object each time the progress is retrieved, so it's not
* a good option.
* - Implement this as a proxy. C code can pass directly the proxied C struct
* so is a fast operation. The problem is that consult of Progress values
* involves a JNI call.
* - Another option, maybe better, is treat this as a Java option whose fields
* are updated from JNI code.
* For now, the proxy options seems a good enought approach.
*/
public class Progress extends Proxy {
/**
* Create a new Progress object.
*
* <p>
* This can be used with {@link Drive#getDriveStatus(Progress)} to
* get the progress of a burn operation.
*/
public Progress() {
super( burn_progress_new() );
}
/** Get the total number of sessions. */
public int getSessions() {
return burn_progress_sessions( pointerOf(this) );
}
/** Get current session. */
public int getSession() {
return burn_progress_session( pointerOf(this) );
}
/** Get the total number of tracks. */
public int getTracks() {
return burn_progress_tracks( pointerOf(this) );
}
/** Get current track. */
public int getTrack() {
return burn_progress_track( pointerOf(this) );
}
/** Get the total number of indices. */
public int getIndices() {
return burn_progress_indices( pointerOf(this) );
}
/** Get current index. */
public int getIndex() {
return burn_progress_index( pointerOf(this) );
}
/** Get the starting logical block address. */
public int getStartSector() {
return burn_progress_start_sector( pointerOf(this) );
}
/**
* On write: The number of sectors.
* On blank: 0x10000 as upper limit for relative progress steps.
*/
public int getSectors() {
return burn_progress_sectors( pointerOf(this) );
}
/**
* On write: The current sector being processed.
* On blank: Relative progress steps 0 to 0x10000.
*/
public int getSector() {
return burn_progress_sector( pointerOf(this) );
}
/**
* Get the capacity of the drive buffer.
*/
public int getBufferCapacity() {
return burn_progress_buffer_capacity( pointerOf(this) );
}
/**
* Get the free space in the drive buffer (might be slightly outdated).
*/
public int getBufferAvailable() {
return burn_progress_buffer_available( pointerOf(this) );
}
/** Get the number of bytes sent to the drive buffer. */
public long getBufferedBytes() {
return burn_progress_buffered_bytes( pointerOf(this) );
}
/**
* The minimum number of buffered bytes. (Caution: Before surely
* one buffer size of bytes was processed, this value is <code>-1</code>.)
*/
public int getBufferMinFill() {
return burn_progress_buffer_min_fill( pointerOf(this) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
burn_progress_free( pointerOf(this) );
}
private static native long burn_progress_new();
private static native void burn_progress_free(long p);
private static native int burn_progress_sessions(long p);
private static native int burn_progress_session(long p);
private static native int burn_progress_tracks(long p);
private static native int burn_progress_track(long p);
private static native int burn_progress_indices(long p);
private static native int burn_progress_index(long p);
private static native int burn_progress_start_sector(long p);
private static native int burn_progress_sectors(long p);
private static native int burn_progress_sector(long p);
private static native int burn_progress_buffer_capacity(long p);
private static native int burn_progress_buffer_available(long p);
private static native long burn_progress_buffered_bytes(long p);
private static native int burn_progress_buffer_min_fill(long p);
}

View File

@ -0,0 +1,141 @@
/*
* ReadOpts.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
*
* @author Vreixo Formoso
* @since 0.1
*/
public class ReadOpts extends Proxy {
ReadOpts(long ptr) {
super(ptr);
}
/**
* Sets whether to read in raw mode or not.
*
* @param rawMode
* If <code>true</code>, reading will be done in raw mode, so that
* everything in the data tracks on the disc is read, including
* headers.
*/
public void setRaw(boolean rawMode) {
burn_read_opts_set_raw(pointerOf(this), rawMode);
}
/**
* Sets whether to report c2 errors or not.
*
* @param c2errors
* If <code>true</code>, report c2 errors.
*/
public void setC2errors(boolean c2errors) {
burn_read_opts_set_c2errors(pointerOf(this), c2errors);
}
/**
* Sets whether to read subcodes from audio tracks or not.
*
* @param subcodesAudio
* If <code>true</code>, read subcodes from audio tracks on the disc.
*/
public void readSubcodesAudio(boolean subcodesAudio) {
burn_read_opts_read_subcodes_audio(pointerOf(this), subcodesAudio);
}
/**
* Sets whether to read subcodes from data tracks or not.
*
* @param subcodesData
* If <code>true</code>, read subcodes from data tracks on the disc.
*/
public void readSubcodesData(boolean subcodesData) {
burn_read_opts_read_subcodes_data(pointerOf(this), subcodesData);
}
/**
* Sets whether to recover errors if possible.
*
* @param her
* If <code>true</code>, attempt to recover errors if possible.
*/
public void setHardwareErrorRecovery(boolean her) {
burn_read_opts_set_hardware_error_recovery(pointerOf(this), her);
}
/**
* Sets whether to report recovered errors or not.
*
* @param rre
* If <code>true</code>, recovered errors will be reported.
*/
public void reportRecoveredErrors(boolean rre) {
burn_read_opts_report_recovered_errors(pointerOf(this), rre);
}
/**
* Sets whether blocks with unrecoverable errors should be read or not.
*
* @param tdb
* If <code>true</code>, blocks with unrecoverable errors will still
* be read.
*/
public void transferDamagedBlocks(boolean tdb) {
burn_read_opts_transfer_damaged_blocks(pointerOf(this), tdb);
}
/**
* Sets the number of retries to attempt when trying to correct an error.
*
* @param r
* The number of retries to attempt when correcting an error.
*/
public void setHardwareErrorRetries(int r) {
burn_read_opts_set_hardware_error_retries(pointerOf(this), r);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
burn_read_opts_free( pointerOf(this) );
}
private static native void burn_read_opts_free(long opts);
private static native void burn_read_opts_set_raw(long opts, boolean raw);
private static native void burn_read_opts_set_c2errors(long opts,
boolean c2errors);
private static native void burn_read_opts_read_subcodes_audio(long opts,
boolean subcodesAudio);
private static native void burn_read_opts_read_subcodes_data(long opts,
boolean subcodesData);
private static native void burn_read_opts_set_hardware_error_recovery(
long opts, boolean hardware_error_recovery);
private static native void burn_read_opts_report_recovered_errors(
long opts, boolean report_recovered_errors);
private static native void burn_read_opts_transfer_damaged_blocks(
long opts, boolean transfer_damaged_blocks);
private static native void burn_read_opts_set_hardware_error_retries(
long opts, int hardware_error_retries);
}

View File

@ -0,0 +1,106 @@
/*
* ScsiAdr.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* SCSI address.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class ScsiAdr {
/** "Bus Number" (something like a virtual controller) */
public int busNo;
/** "Host Number" (something like half a virtual controller) */
public int hostNo;
/** "Channel Number" (other half of "Host Number"). */
public int channelNo;
/** "Target Number" or "SCSI Id" (a device). */
public int targetNo;
/** "Logical Unit Number" (a sub device). */
public int lunNo;
/**
* Creates a new SCSI address.
*
* Note: bus and (host,channel) are supposed to be redundant.
*
* @param busNo
* @param hostNo
* @param channelNo
* @param targetNo
* @param lunNo
*/
public ScsiAdr(int busNo, int hostNo, int channelNo, int targetNo,
int lunNo) {
super();
this.busNo = busNo;
this.hostNo = hostNo;
this.channelNo = channelNo;
this.targetNo = targetNo;
this.lunNo = lunNo;
}
/**
* Try to convert a given SCSI address of bus,host,channel,target,lun into
* a persistent drive address. If a SCSI address component parameter is < 0
* then it is not decisive and the first enumerated address which matches
* the >= 0 parameters is taken as result.
*
* @param adr
* SCSI adr to conver
* @return
* The persistent drive address
* @throws BurnException
* On error.
*/
public static String converScsiAdr(ScsiAdr adr) throws BurnException {
return burn_drive_convert_scsi_adr(adr.busNo, adr.hostNo, adr.channelNo,
adr.targetNo, adr.lunNo);
}
/**
* Try to obtain bus,host,channel,target,lun from path. If there is an SCSI
* address at all, then this call should succeed with a persistent
* drive address obtained via {@link DriveInfo#getAdr()}. It is also supposed
* to succeed with any device file of a (possibly emulated) SCSI device.
*
* @param path
*
* @return
* @throws BurnException
* On error
*/
public static ScsiAdr obtainScsiAdr(String path) throws BurnException {
return burn_drive_obtain_scsi_adr(path);
}
@Override
public String toString() {
return "busNo=" + busNo + ", hostNo=" + hostNo + ", channelNo=" +
channelNo + ", targetNo=" + targetNo + " ,lunNo=" + lunNo;
}
private native static String burn_drive_convert_scsi_adr(int bus_no,
int host_no, int channel_no, int target_no, int lun_no)
throws BurnException;
private native static ScsiAdr burn_drive_obtain_scsi_adr(String path)
throws BurnException;
}

View File

@ -0,0 +1,182 @@
/*
* Session.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
* References a single session on a disc.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Session extends Proxy {
public static final int POS_END = 100;
/** wether is needed to free or not the session when no more needed */
private boolean free;
/**
* Create a new session.
*/
public Session() {
super( burn_session_create() );
free = true;
}
/* package protected */
Session(long ptr) {
super(ptr);
free = false;
}
/**
* Add a track to session at specified position.
*
* @param track
* Track to insert in session.
* @param pos
* position to add at ({@link #POS_END} is "at the end")
* @return
* <code>true</code> if success, <code>false</code> if track can't
* be added.
*/
public boolean addTrack(Track track, int pos) {
if ( pos > POS_END ) {
return false;
}
return burn_session_add_track( pointerOf(this), pointerOf(track), pos);
}
/**
* Remove a track from this session.
*
* @param track
* Track to find and remove.
* @return
* <code>true</code> if success, <code>false</code> for failure,
* for example if track was not previously added to this session.
*/
public boolean removeTrack(Track track) {
return burn_session_remove_track( pointerOf(this), pointerOf(track) );
}
/**
* Hide the first track in the "pre gap" of the disc.
*
* @param onoff
* <code>true</code> to enable hiding, <code>false</code> to disable.
*/
public void hideFirstTrack(boolean onoff) {
burn_session_hide_first_track( pointerOf(this), onoff ? 1 : 0 );
}
/**
* Tells how long the session will be on disc.
*
* @return
* Number of sectors the session will need.
*/
public int getSectors() {
return burn_session_get_sectors( pointerOf(this) );
}
/**
* Gets a copy of the {@link TocEntry} structure associated with the
* session's lead out.
*
* @return
* A {@link TocEntry} object.
*/
public TocEntry getLeadoutEntry() {
return burn_session_get_leadout_entry( pointerOf(this) );
}
/**
* Gets an array of all the tracks for a session.
*
* <p>
* <b>THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK</b>
*
* FIXME when a track is removed, its C struct can be deleted, thus
* the java object is no longer valid. If we still have a reference
* for the track originally created, the C struct is not deleted because
* we have a reference to it. For now, this behavior is not so bad...
*
* @return
* An array with all the tracks.
*/
public Track[] getTracks() {
long[] tracksPtrs = burn_session_get_tracks( pointerOf(this) );
Track[] tracks = new Track[tracksPtrs.length];
for ( int i = 0; i < tracksPtrs.length; ++i ) {
long ptr = tracksPtrs[i];
Track track = (Track) proxyFor(ptr);
if (track == null) {
track = new Track(ptr);
}
tracks[i] = track;
}
return tracks;
}
/**
* Returns whether the first track of a session is hidden in the pregap.
*
* @return
* <code>true</code> if the first track is hidden, <code>false</code>
* otherwise
*/
public boolean isHideFirstTrack() {
return burn_session_get_hidefirst( pointerOf(this) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
if ( free ) {
burn_session_free( pointerOf(this) );
}
}
private static native long burn_session_create();
private static native void burn_session_free(long s);
private static native boolean burn_session_add_track(long s, long t,
int pos);
private static native boolean burn_session_remove_track(long s, long t);
private static native void burn_session_hide_first_track(long s,
int onoff);
private static native int burn_session_get_sectors(long s);
private static native TocEntry burn_session_get_leadout_entry(long s);
private static native long[] burn_session_get_tracks(long s);
private static native boolean burn_session_get_hidefirst(long session);
}

View File

@ -0,0 +1,35 @@
/*
* SessionFormat.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum SessionFormat {
/** Session format for normal audio or data discs */
CDROM(0),
/** Session format for obsolete CD-I discs */
CDI(0x10),
/** Session format for CDROM-XA discs */
CDXA(0x20);
int code;
private SessionFormat(int code) {
this.code = code;
}
}

View File

@ -0,0 +1,166 @@
/*
* Source.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import java.util.EnumSet;
import org.pykix.libburnia.bindings.Proxy;
import org.pykix.libburnia.libisofs.Ecma119ExtensionFlag;
import org.pykix.libburnia.libisofs.IsoVolSet;
/**
*
* FIXME move here the newECma119 source
* FIXME create java.io.File versions.
*
* @author Vreixo Formoso
* @since 0.1
*/
public final class Source extends Proxy implements BurnSource {
/**
* Creates a data source for an image file (and maybe subcode file).
*
* @param path
* Path for the image file.
* @param subpath
* Path for the subcode file, or <code>null</code>.
*/
public Source(String path, String subpath) {
super( burn_file_source_new(path, subpath) );
}
/**
* Creates a data source for an image file (a track) from an open
* readable file descriptor, an eventually open readable subcodes file
* descriptor and eventually a fixed size in bytes.
*
* <p>
* You must take care that Unix file descriptor used by this constructor
* are not used by Java standard classes, so you must use your own
* functions/libraries to get these fds.
*
* @param datafd
* The source of data.
* @param subfd
* The eventual source for subcodes. Not used if -1.
* @param size
* The eventual fixed size of eventually both fds.
* If this value is 0, the size will be determined from datafd.
*/
public Source(int datafd, int subfd, long size) {
super( burn_fd_source_new(datafd, subfd, size) );
}
/**
* Creates a data source from a ISO Volume Set.
*
* TODO. The volume set used to create the libburn_source can _not_ be
* modified until the libburn_source is freed. This is difficul to implement
* in Java, because user can't know when a object is actually freed, so
* for now IsoVolSet should not be modified anyway after call this.
*
* @param volset
* The volume set to use as source.
* @param volnum
* The volume in the set which you want to write (usually 0)
* @param level
* ISO level to write at.
* @param flags
* Which extensions to support.
*/
public Source(IsoVolSet volset, int volnum, int level,
EnumSet<Ecma119ExtensionFlag> flags) {
super( newEcma119Source(volset, volnum, level, flags) );
}
/**
* {@inheritDoc}
*/
public int read(byte[] buffer, int size) {
if ( buffer.length < size ) {
throw new IndexOutOfBoundsException("size bigger than buffer length");
}
return read( pointerOf(this), buffer, size);
}
/**
* {@inheritDoc}
*/
public int readSub(byte[] buffer, int size) {
if ( buffer.length < size ) {
throw new IndexOutOfBoundsException("size bigger than buffer length");
}
return read_sub( pointerOf(this), buffer, size);
}
/**
* {@inheritDoc}
*/
public long getSize() {
return get_size(pointerOf(this));
}
/**
* {@inheritDoc}
*/
public int setSize(long bytes) {
return set_size(pointerOf(this), bytes);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
burn_source_free(pointerOf(this));
}
private static long newEcma119Source(IsoVolSet volset, int volnum, int level,
EnumSet<Ecma119ExtensionFlag> flags) {
int f = 0;
if ( flags.contains(Ecma119ExtensionFlag.ROCKRIDGE) ) {
f |= (1 << 0);
}
if ( flags.contains(Ecma119ExtensionFlag.JOLIET) ) {
f |= (1 << 1);
}
return iso_source_new_ecma119(pointerOf(volset), volnum, level, f);
}
private static native long burn_file_source_new(String path, String subpath);
private static native long burn_fd_source_new(int datafd, int subfd,
long size);
private static native long iso_source_new_ecma119(long volumeset,
int volnum, int level, int flags);
private static native int read(long ptr, byte [] buffer, int size);
private static native int read_sub(long ptr, byte [] buffer, int size);
private static native long get_size(long ptr);
private static native int set_size(long ptr, long bytes);
private static native void burn_source_free(long s);
}

View File

@ -0,0 +1,32 @@
/*
* SourceStatus.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Possible data source return values.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum SourceStatus {
/** The source is ok. */
OK,
/** The source is at end of file. */
EOF,
/** The source is unusable. */
FAILED
}

View File

@ -0,0 +1,127 @@
/*
* SpeedDescriptor.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Description of a speed capability as reported by the drive in conjunction
* with eventually loaded media. There can be more than one such object per
* drive.
*
* <p>
* This list is set up by {@link Burn#scan()} and gets updated by
* {@link Drive#grab(boolean)}. A copy may be obtained by
* burn_drive_get_speedlist().
*
* <p>
* For technical background info see SCSI specs MMC and SPC:
* mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364
* ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312
*
* @author Vreixo Formoso
* @since 0.1
*/
public class SpeedDescriptor {
private int source;
private Profile profile;
private int endlba;
private int writeSpeed;
private int readSpeed;
private int wrc;
private boolean exact;
private boolean mrw;
/* to be called from JNI code */
SpeedDescriptor(int source, short profile, int endlba, int writeSpeed,
int readSpeed, int wrc, boolean exact, boolean mrw) {
super();
this.source = source;
this.profile = Profile.get(profile == -1 ? 0 : profile);
this.endlba = endlba;
this.writeSpeed = writeSpeed;
this.readSpeed = readSpeed;
this.wrc = wrc;
this.exact = exact;
this.mrw = mrw;
}
/**
* The attributed capacity of appropriate media in logical block units
* i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown.
*/
public int getEndlba() {
return endlba;
}
/**
* <code>true</code> if drive promises reported performance over full
* media.
*/
public boolean isExact() {
return exact;
}
/**
* <code>true</code> if suitable for mixture of read and write
*/
public boolean isMrw() {
return mrw;
}
/**
* The media type that was current at the time of report.
*
* @return
* Same as {@link Drive#getProfile()}, {@link Profile#NONE} if
* no media was loaded.
*/
public Profile getProfile() {
return profile;
}
/**
* Read speed is given in 1000 bytes/s , 0 = invalid. The numbers
* are supposed to be usable with {@link Drive#setSpeed(int, int)}
*/
public int getReadSpeed() {
return readSpeed;
}
/**
* Get where this info comes from.
*
* @return
* 0 = misc , 1 = mode page 2Ah , 2 = ACh GET PERFORMANCE
*/
public int getSource() {
return source;
}
/**
* Expert info from ACh GET PERFORMANCE and/or mode page 2Ah.
* Expect values other than 0 or 1 to get a meaning in future.
* Rotational control: 0 = CLV/default , 1 = CAV
*/
public int getWrc() {
return wrc;
}
/**
* Write speed is given in 1000 bytes/s , 0 = invalid. The numbers
* are supposed to be usable with {@link Drive#setSpeed(int, int)}
*/
public int getWriteSpeed() {
return writeSpeed;
}
}

View File

@ -0,0 +1,176 @@
/*
* TocEntry.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Information about a track on a disc - this is from the q sub channel of
* the lead-in area of a disc. The documentation here is very terse.
* See a document such as mmc3 for proper information.
*
* @author Vreixo Formoso
* @since 0.1
*/
/*
* Note that this class is not a Proxy. Information is kept on Java side,
* and propertly copied form or to C struct when needed.
*
* FIXME: I take all C "unsigned char" as byte, but in some cases an int
* is a better option.
*
* TODO: define setters??
*/
public class TocEntry {
/** Session the track is in */
private byte session;
/** Type of data. for this struct to be valid, it must be 1 */
private byte adr;
/** Type of data in the track */
private byte control;
/** Zero. Always. Really. */
private byte tno;
/** Track number or special information */
private byte point;
private byte min;
private byte sec;
private byte frame;
private byte zero;
/** Track start time minutes for normal tracks */
private byte pmin;
/** Track start time seconds for normal tracks */
private byte psec;
/** Track start time frames for normal tracks */
private byte pframe;
/*
* Indicates wether extension data are valid and eventually override
* older elements in this structure:
* bit0= DVD extension is valid
*/
private byte extensionsValid;
/* ts A70201 : DVD extension.
* If invalid the members are guaranteed to be 0.
*/
/* Tracks and session numbers are 16 bit. Here are the high bytes. */
private byte sessionMsb;
private byte pointMsb;
/* pmin, psec, and pframe may be too small if DVD extension is valid */
private int startLba;
/* min, sec, and frame may be too small if DVD extension is valid */
private int trackBlocks;
public TocEntry(byte session, byte adr, byte control, byte tno,
byte point, byte min, byte sec, byte frame, byte zero, byte pmin,
byte psec, byte pframe, byte extensionsValid, byte sessionMsb,
byte pointMsb, int startLba, int trackBlocks) {
super();
this.session = session;
this.adr = adr;
this.control = control;
this.tno = tno;
this.point = point;
this.min = min;
this.sec = sec;
this.frame = frame;
this.zero = zero;
this.pmin = pmin;
this.psec = psec;
this.pframe = pframe;
this.extensionsValid = extensionsValid;
this.sessionMsb = sessionMsb;
this.pointMsb = pointMsb;
this.startLba = startLba;
this.trackBlocks = trackBlocks;
}
public byte getAdr() {
return adr;
}
public byte getControl() {
return control;
}
public byte getExtensionsValid() {
return extensionsValid;
}
public byte getFrame() {
return frame;
}
public byte getMin() {
return min;
}
public byte getPframe() {
return pframe;
}
public byte getPmin() {
return pmin;
}
public byte getPoint() {
return point;
}
public byte getPointMsb() {
return pointMsb;
}
public byte getPsec() {
return psec;
}
public byte getSec() {
return sec;
}
public byte getSession() {
return session;
}
public byte getSessionMsb() {
return sessionMsb;
}
public int getStartLba() {
return startLba;
}
public byte getTno() {
return tno;
}
public int getTrackBlocks() {
return trackBlocks;
}
public byte getZero() {
return zero;
}
}

View File

@ -0,0 +1,294 @@
/*
* Track.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import java.util.EnumSet;
import org.pykix.libburnia.bindings.Proxy;
/**
* References a single track on a disc.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class Track extends Proxy {
/** wether is needed to free or not the track when no more needed */
private boolean free;
/**
* Create a new Track, to use in TAO recording or to put in a
* {@link Session}
*/
public Track() {
super( burn_track_create() );
free = true;
}
/* package protected */
Track(long ptr) {
super(ptr);
free = false;
}
/**
* Define the data in a track.
*
* @param offset
* The number of 0s to write before start of data.
* @param tail
* The number of extra 0s to write after data.
* @param pad
* If <code>true</code>, the lib should pad the last sector with 0s
* if the track isn't exactly sector sized. (otherwise the lib will
* begin reading from the next track)
* @param mode
* data format
*/
public void defineData(int offset, int tail, boolean pad,
EnumSet<BurnMode> mode) {
int modebm = 0;
for ( BurnMode m : mode ) {
modebm |= m.bm;
}
burn_track_define_data( pointerOf(this), offset, tail, pad, modebm );
}
/**
* Define wether a track shall swap bytes of its input stream.
*
* @param swapSourceBytes
* <code>false</code> to do not swap, <code>true</code> to swap byte
* pairs
*/
public void setByteSwap(boolean swapSourceBytes) {
burn_track_set_byte_swap( pointerOf(this), swapSourceBytes ? 1 : 0);
}
/**
* Set the ISRC details for the track.
*
* @param country
* the 2 char country code. Each character must be only numbers or
* letters.
* @param owner
* 3 char owner code. Each character must be only numbers
* or letters.
* @param year
* 2 digit year. A number in 0-99 (Yep, not Y2K friendly).
* @param serial
* 5 digit serial number. A number in 0-99999.
* @throws IllegalArgumentException
* If some of restrictions given above are wrong.
*
* TODO add more restriction checks in java code. We need to check that
* characters are valid.
*/
public void setIsrc(String country, String owner, int year, int serial) {
if ( country.length() != 2 ) {
throw new IllegalArgumentException("Country must be 2 characters " +
"length");
}
if ( owner.length() != 3 ) {
throw new IllegalArgumentException("owner must be 3 characters " +
"length");
}
if ( (year > 99) || (year < 0) ) {
throw new IllegalArgumentException("year must be a number in 0-99");
}
if ( (serial > 99999) || (serial < 0) ) {
throw new IllegalArgumentException("99999 must be a number in " +
"0-99999");
}
burn_track_set_isrc( pointerOf(this), country, owner, (byte)year, serial );
}
/**
* Disable ISRC parameters for the track.
*/
public void clearIsrc() {
burn_track_clear_isrc( pointerOf(this) );
}
/**
* Set the track's data source.
*
* @param src
* The data source to use for the contents of the track.
* @return
* A status code stating if the source is ready for use for
* writing the track, or if an error occured
*/
public SourceStatus setSource(BurnSource src) {
long ptr;
if (src instanceof Proxy) {
Proxy source = (Proxy) src;
ptr = pointerOf(source);
} else {
//FIXME add support for java-based sources
throw new ClassCastException("Only Proxy sources supported");
}
int s = burn_track_set_source( pointerOf(this), ptr);
switch (s) {
case 0:
return SourceStatus.OK;
case 1:
return SourceStatus.EOF;
case 2:
return SourceStatus.FAILED;
default:
throw new RuntimeException("Unexpected return state");
}
}
/**
* Set a default track size to be used only if the track turns out to be of
* unpredictable length and if the effective write type demands a fixed
* size.
*
* <p>
* This can be useful to enable write types CD SAO or DVD DAO together with
* a track source like stdin. If the track source delivers fewer bytes than
* announced then the track will be padded up with zeros.
*
* @param size
* The size to set in bytes
* @return
* <code>true</code> on success, <code>false</code> if failure
*/
public boolean setDefaultSize(long size) {
return burn_track_set_default_size( pointerOf(this), size);
}
/**
* Tells how long the track will be on disc.
* <i>Not reliable with tracks of undefined length. Should never
* be called in this case.</i>
*
* @return
* Number of sectors the track will need.
*/
public int getSectors() {
return burn_track_get_sectors( pointerOf(this) );
}
/**
* Gets a copy of the {@link TocEntry} structure associated with the track.
*
* @return
* A {@link TocEntry} object.
*/
public TocEntry getEntry() {
return burn_track_get_entry( pointerOf(this) );
}
/**
* Gets the mode of the track.
*
* @return
* The track's mode
*/
public EnumSet<BurnMode> getMode() {
int modebm = burn_track_get_mode( pointerOf(this) );
EnumSet<BurnMode> mode = EnumSet.noneOf(BurnMode.class);
for ( BurnMode m : EnumSet.allOf(BurnMode.class) ) {
if ( (modebm & m.bm) != 0 ) {
mode.add(m);
}
}
return mode;
}
/**
* Tells how many source bytes have been read by the track during burn.
*
* @return
* Bytes already read.
*/
public long getReadBytes() {
return burn_track_get_read_bytes( pointerOf(this) );
}
/**
* Tells how many source bytes have been written by the track during burn.
*
* @return
* Bytes already written.
*/
public long getWrittenBytes() {
return burn_track_get_written_bytes( pointerOf(this) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
/*
* When retrieved from Session.getTrack we haven't to
* free the C object because we don't own a reference
*/
if ( free ) {
burn_track_free( pointerOf(this) );
}
}
private static native long burn_track_create();
private static native void burn_track_free(long t);
private static native void burn_track_define_data(long t, int offset,
int tail, boolean pad, int mode);
private static native int burn_track_set_byte_swap(long t,
int swapSourceBytes);
private static native void burn_track_set_isrc(long t, String country,
String owner, byte year, int serial);
private static native void burn_track_clear_isrc(long t);
private static native int burn_track_set_source(long t, long s);
private static native boolean burn_track_set_default_size(long t, long size);
private static native int burn_track_get_sectors(long t);
private static native TocEntry burn_track_get_entry(long t);
private static native int burn_track_get_mode(long track);
/*
* The two methods are the java version of the single libburn method
* int burn_track_get_counters(struct burn_track *t,
* off_t *read_bytes, off_t *written_bytes);
*/
private static native long burn_track_get_read_bytes(long t);
private static native long burn_track_get_written_bytes(long t);
}

View File

@ -0,0 +1,281 @@
/*
* WriteOpts.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
import org.pykix.libburnia.bindings.Proxy;
/**
* References a set of write parameters.
*
* <p>
* To get a new <code>WriteOpts</code> object, you have to call
* {@link Drive#newWriteOpts()} method.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class WriteOpts extends Proxy {
/* package protected */
WriteOpts(long ptr) {
super(ptr);
}
/**
* Sets the write type for the WriteOpts.
*
* <p>
* Note: write type {@link WriteType#SAO} is currently not capable of
* writing a mix of data and audio tracks. You must use
* {@link WriteType#TAO} for such sessions.
*
* @param writeType
* The write type to use.
* @param blockType
* The block type to use.
* @return
* <code>true</code> on success, <code>false</code> on failure.
*/
public boolean setWriteType( WriteType writeType, BlockType blockType ) {
int bt = blockType.code;
int wt = writeType.ordinal();
return burn_write_opts_set_write_type( pointerOf(this), wt, bt);
}
/**
* As an alternative to {@link #setWriteType(WriteType, BlockType)}
* this function tries to find a suitable write type and block type for a
* given write job described by this opts and disc. To be used after all
* other setups have been made, i.e. immediately before
* {@link Drive#write(WriteOpts, Disc)}.
*
* @param disc
* The already composed session and track model.
* @param flag
* Bitfield for control purposes:
* bit0= do not choose type but check the one that is already set
* bit1= do not issue error messages via burn_msgs queue
* (is automatically set with bit0)
* @return
* Chosen write type or {@link WriteType#NONE} on failure.
*/
/*
* TODO a C returning field, reasons, is forgeting by this implementation
*/
public WriteType setAutoWriteType(Disc disc, int flag) {
int wt = burn_write_opts_auto_write_type( pointerOf(this),
pointerOf(disc), flag);
return WriteType.values()[wt];
}
/**
* Sets the simulate value for the WriteOpts object.
*
* @param sim
* If <code>true</code>, the drive will perform a simulation
* instead of a burn
* @return
* <code>true</code> on success, <code>false</code> on failure.
*/
public boolean setSimulate(boolean sim) {
return burn_write_opts_set_simulate( pointerOf(this), sim );
}
/**
* Controls buffer underrun prevention.
*
* @param underrunProof
* if <code>true</code>, buffer underrun protection is enabled
* @return
* <code>true</code> on success, <code>false</code> on failure.
*/
public boolean setUnderrunProof(boolean underrunProof) {
return burn_write_opts_set_underrun_proof( pointerOf(this),
underrunProof);
}
/**
* Sets whether to use OPC (Optical Power Calibration)
* or not with this WriteOpts object.
*
* @param opc
* if <code>true </code>, OPC will be performed at
* start of burn.
*/
public void setPerformOpc(boolean opc) {
burn_write_opts_set_perform_opc( pointerOf(this), opc );
}
/**
* Sets the multi flag which eventually marks the emerging session as not
* being the last one and thus creating a {@link DiscStatus#APPENDABLE}
* media.
*
* @param multi
* If <code>true</code> media will be appendable, if
* <code>false</code> media will be closed (default)
*/
public void setMulti(boolean multi) {
burn_write_opts_set_multi( pointerOf(this), multi );
}
/**
* Eventually makes libburn ignore the failure of some conformance checks:
*
* <ul>
* <li>the check wether CD write+block type is supported by the drive.
* </ul>
*
* @param force
* if <code>true</code> ignore above checks, otherwise refuse work on
* failed check.
*/
public void setForce(boolean force) {
burn_write_opts_set_force( pointerOf(this), force ? 1 : 0 );
}
/**
* Sets a start address for writing to media and write modes which allow to
* choose this address at all (DVD+RW, DVD-RAM, formatted DVD-RW only for
* now). The address is given in bytes. If it is not -1 then a write run
* will fail if choice of start address is not supported or if the block
* alignment of the address is not suitable for media and write mode.
* (Alignment to 32 kB blocks is advised with DVD media.)
*
* @param value
* The address in bytes (-1 = start at default address).
*/
public void setStartByte(long value) {
burn_write_opts_set_start_byte( pointerOf(this), value );
}
/**
* Sets the session format for a disc.
*
* @param format
* The session format to set.
*/
public void setFormat(SessionFormat format) {
burn_write_opts_set_format( pointerOf(this), format.code );
}
public void setHasMediaCatalog(boolean hasMediaCatalog) {
burn_write_opts_set_has_mediacatalog( pointerOf(this), hasMediaCatalog );
}
public void setMediaCatalog(String mediaCatalog) {
burn_write_opts_set_mediacatalog( pointerOf(this), mediaCatalog );
}
/**
* Examines a completed setup for {@link Drive#write(WriteOpts, Disc)}
* wether it is permissible with drive and media.
*
* <p>
* This function is called by {@link Drive#write(WriteOpts, Disc)} but
* an application might be interested in this check in advance.
*
* @param disc
* The descrition of the disc to be created
* @param silent
* <code>true</code> to not issue error messages , <code>false</code>
* to report problems
* @throws BurnException
* on failure, a list of rejection reason statements can be getted
* as exception msg.
*/
public void precheckWrite(Disc disc, boolean silent) throws BurnException {
burn_precheck_write(pointerOf(this), pointerOf(disc), silent ? 1 : 0);
}
/**
* Caution: still immature and likely to change. Problems arose with
* sequential DVD-RW on one drive.
*
* Controls wether the whole available space of the media shall be filled
* up by the last track of the last session.
*
* @param fillUpMedia
* <code>true</code> to fill up by last track, <code>false</code> to
* not fill up
*/
public void setFillUp(boolean fillUpMedia) {
burn_write_opts_set_fillup( pointerOf(this), fillUpMedia);
}
/**
* Supplies toc entries for writing - not normally required for CD
* mastering.
*
* @param entries
* Toc entries.
*/
public void setTocEntries(TocEntry[] entries) {
burn_write_opts_set_toc_entries( pointerOf(this), entries.length,
entries);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
burn_write_opts_free( pointerOf(this) );
}
private static native void burn_write_opts_free(long opts);
private static native boolean burn_write_opts_set_write_type(long opts,
int writeType, int blockType);
private static native int burn_write_opts_auto_write_type(long opts,
long disc, int flag);
private static native boolean burn_write_opts_set_simulate(long opts,
boolean sim);
private static native boolean burn_write_opts_set_underrun_proof(long opts,
boolean underrun_proof);
private static native void burn_write_opts_set_perform_opc(long opts,
boolean opc);
private static native void burn_write_opts_set_multi(long opts,
boolean multi);
private static native void burn_write_opts_set_force(long opts, int useForce);
private static native void burn_write_opts_set_start_byte(long opts,
long value);
private static native void burn_write_opts_set_format(long opts, int format);
private static native void burn_write_opts_set_has_mediacatalog(
long opts, boolean has_mediacatalog);
private static native void burn_write_opts_set_mediacatalog(
long opts, String mediacatalog);
private static native void burn_precheck_write(long o, long disc,
int silent) throws BurnException;
private static native void burn_write_opts_set_fillup(long opts,
boolean fill_up_media);
//TODO untested and enought complex to have some bugs!!
private static native void burn_write_opts_set_toc_entries(long opts,
int count, TocEntry[] entries);
}

View File

@ -0,0 +1,66 @@
/*
* WriteType.java
*
* 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.
*/
package org.pykix.libburnia.libburn;
/**
* Possible disc writing style/modes.
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum WriteType {
/**
* Packet writing.
* currently unsupported, (for DVD Incremental Streaming use TAO)
*/
PACKET,
/**
* <ul>
* <li>With CD: Track At Once recording
* 2s gaps between tracks, no fonky lead-ins
*
* <li>With sequential DVD-R[W]: Incremental Streaming
* <li>With DVD-RAM/+RW: Random Writeable (used sequentially)
* <li>With overwriteable DVD-RW: Rigid Restricted Overwrite
* </ul>
*/
TAO,
/**
* <ul>
* <li>With CD: Session At Once
* Block type MUST be BURN_BLOCK_SAO
* ts A70122: Currently not capable of mixing data and audio tracks.
* <li>With sequential DVD-R[W]: Disc-at-once, DAO
* Single session, single track, fixed size mandatory, (-dvd-compat)
*/
SAO,
/**
* With CD: Raw disc at once recording.
* all subcodes must be provided by lib or user
* only raw block types are supported
*/
RAW,
/**
* In replies this indicates that not any writing will work.
* As parameter for inquiries it indicates that no particular write
* mode shall is specified.
* Do not use for setting a write mode for burning. It won't work.
*/
NONE
}

View File

@ -0,0 +1,26 @@
/*
* Ecma119ExtensionFlag.java
*
* 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.
*/
package org.pykix.libburnia.libisofs;
/**
* Extensions to ISO filesystem.
*
* FIXME move to libburn package, only used there
*
* @author Vreixo Formoso
* @since 0.1
*/
public enum Ecma119ExtensionFlag {
ROCKRIDGE,
JOLIET
}

View File

@ -0,0 +1,62 @@
/*
* IsoExclude.java
*
* 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.
*/
package org.pykix.libburnia.libisofs;
/**
* Manages files to be excluded when added directories recursively.
*
* FIXME I'm not very sure about to put this in its own class.
* TODO add java.io.File methods
*
* @author Vreixo Formoso
* @since 0.1
*/
public class IsoExclude {
/**
* Add the path of a file or directory to ignore when adding a
* directory recursively.
*
* @param path
* The path, on the local filesystem, of the file.
*/
public static void addPath(String path) {
iso_exclude_add_path(path);
}
/**
* Remove a path that was set to be ignored when adding a directory
* recusively.
*
* @param path
* The path, on the local filesystem, of the file.
*/
public static void removePath(String path) {
iso_exclude_remove_path(path);
}
/**
* Remove all paths that were set to be ignored when adding a
* directory recusively.
*/
public static void empty() {
iso_exclude_empty();
}
private static native void iso_exclude_add_path(String path);
private static native void iso_exclude_remove_path(String path);
private static native void iso_exclude_empty();
}

View File

@ -0,0 +1,232 @@
/*
* IsoTreeNode.java
*
* 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.
*/
package org.pykix.libburnia.libisofs;
import java.io.File;
import java.io.FileNotFoundException;
import org.pykix.libburnia.bindings.Proxy;
/**
* A node in the filesystem tree.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class IsoTreeNode extends Proxy {
/*
* Package protected
*/
IsoTreeNode(long ptr) {
super(ptr);
}
/**
* Add a file to this node (have to be a directory).
*
* @param path
* The path, on the local filesystem, of the file. Have to be not a
* directory, but a file.
* @return
* An IsoTreeNode whose path is <code>path</code> and whose parent
* is this node.
* @throws FileNotFoundException
* If path not exists or is not a file.
*/
public IsoTreeNode addNode(String path) throws FileNotFoundException {
return addNode(this, new File(path));
}
/**
* Add a file to this node (have to be a directory).
*
* @param path
* The path, on the local filesystem, of the file. Have to be not a
* directory, but a file.
* @return
* An IsoTreeNode whose path is <code>path</code> and whose parent
* is this node.
* @throws FileNotFoundException
* If path not exists or is not a file.
*/
public IsoTreeNode addNode(File path) throws FileNotFoundException {
return addNode(this, path);
}
/**
* Recursively add an existing directory as a child of this node, that have
* to be a directory.
* Warning: when using this, you'll lose files or subdirectories objects.
* If you want to have all files and directories objects,
* use {@link #addNode(File)} and {@link #addNewDir(String)}
*
* @param path
* The path, on the local filesystem, of the directory to add.
* @return
* The new created node or <code>null</code>.
* @throws FileNotFoundException
* If path not exists or is not a directory
*/
public IsoTreeNode raddDir(String path) throws FileNotFoundException {
return raddDir(this, new File(path));
}
/**
* Recursively add an existing directory as a child of this node, that have
* to be a directory.
* Warning: when using this, you'll lose files or subdirectories objects.
* If you want to have all files and directories objects,
* use {@link #addNode(File)} and {@link #addNewDir(String)}
*
* @param path
* The path, on the local filesystem, of the directory to add.
* @return
* The new created node or <code>null</code>.
* @throws FileNotFoundException
* If path not exists or is not a directory
*/
public IsoTreeNode raddDir(File path) throws FileNotFoundException {
return raddDir(this, path);
}
/* this function is for testing purposes mainly */
void print(int spaces) {
iso_tree_print( pointerOf(this), spaces);
}
/**
* Set the name of the node (using the current locale).
*
* @param name
* Name to set
*/
public void setName(String name) {
iso_tree_node_set_name( pointerOf(this), name);
}
/**
* Creates a new directory as a child of this node (have to be a
* directory).
*
* @param name
* Name of the directory to create. Must be a unique name among
* all node children, and mustn't contain '/' characters.
* @return
* The newly created directory.
*/
public IsoTreeNode addNewDir(String name) {
return addNewDir(this, name);
}
/**
* Add a file to a directory.
*
* @param parent
* Node to which add file. Can be <code>null</code>, but if
* not it must be a directory.
* @param path
* The path, on the local filesystem, of the file. Have to be non-dir
* @return
* An IsoTreeNode whose path is <code>path</code> and whose parent
* is <code>parent</code>.
* @throws FileNotFoundException
* If path not exists or is not a file
*/
public static IsoTreeNode addNode(IsoTreeNode parent, File path)
throws FileNotFoundException {
long pptr = (parent == null) ? 0 : pointerOf(parent);
/* extra check */
if ( !path.exists() ) {
throw new FileNotFoundException(path.getPath());
}
if ( !path.isFile() ) {
throw new FileNotFoundException(path + " is not a file");
}
long ptr = iso_tree_add_node(pptr, path.getPath());
return (ptr == 0) ? null : new IsoTreeNode(ptr);
}
/**
* Recursively add an existing directory to the tree.
* Warning: when using this, you'll lose files or subdirectories objects.
* If you want to have all files and directories objects,
* use {@link #addNode(File)} and {@link #addNewDir(String)}.
*
* @param parent
* Node to which add file. Can be <code>null</code>, but if
* not it must be a directory.
* @param path
* The path, on the local filesystem, of the directory to add.
* @return
* The new created node or <code>null</code>.
* @throws FileNotFoundException
* If path not exists or is not a directory
*/
public static IsoTreeNode raddDir(IsoTreeNode parent, File path)
throws FileNotFoundException {
long pptr = (parent == null) ? 0 : pointerOf(parent);
/* extra check */
if ( !path.exists() ) {
throw new FileNotFoundException(path.getPath());
}
if ( !path.isDirectory() ) {
throw new FileNotFoundException(path + " is not a directory");
}
long ptr = iso_tree_radd_dir(pptr, path.getPath());
return (ptr == 0) ? null : new IsoTreeNode(ptr);
}
/**
* Creates a new, empty directory on the volume.
*
* @param parent
* Directory in which add the new dir, or <code>null</code>
* @param name
* Name of the directory to create. Must be a unique name among
* the children and files belonging to parent, and mustn't
* contain '/' characters.
* @return
* The newly created directory.
*/
public static IsoTreeNode addNewDir(IsoTreeNode parent, String name) {
long pptr = (parent == null) ? 0 : pointerOf(parent);
long ptr = iso_tree_add_new_dir(pptr, name);
return (ptr == 0) ? null : new IsoTreeNode(ptr);
}
private static native long iso_tree_add_node(long parent, String path);
private static native long iso_tree_radd_dir(long parent, String path);
private static native void iso_tree_print(long root, int spaces);
private static native void iso_tree_node_set_name(long file, String name);
private static native long iso_tree_add_new_dir(long parent, String name);
static {
System.loadLibrary("java-libburn-0.1");
}
}

View File

@ -0,0 +1,60 @@
/*
* IsoVolSet.java
*
* 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.
*/
package org.pykix.libburnia.libisofs;
import org.pykix.libburnia.bindings.Proxy;
import org.pykix.libburnia.libburn.BurnSource;
import org.pykix.libburnia.libburn.Source;
/**
* A set of data volumes.
*
* <p>
* You will need an <code>IsoVolSet</code> object to create an ISO image
* from a {@link IsoVolume}.
*
* <p>
* For actually burn (or write to a file) the image, you will need to create
* a new {@link Source} with this Volume Set.
*
* @see BurnSource
* @see Source
* @see IsoVolume
*
* @author Vreixo Formoso
* @since 0.1
*/
public class IsoVolSet extends Proxy {
/**
* Create a new Volume Set consisting of only one volume.
* @param volume
* The first and only volume for the volset to contain.
* @param volsetId
* The Volume Set ID.
*/
public IsoVolSet(IsoVolume volume, String volsetId) {
super( iso_volset_new( pointerOf(volume), volsetId) );
}
@Override
protected void finalize() throws Throwable {
super.finalize();
iso_volset_free( pointerOf(this) );
}
private static native void iso_volset_free(long volume);
private static native long iso_volset_new(long volume, String volsetId);
}

View File

@ -0,0 +1,290 @@
/*
* IsoVolume.java
*
* 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.
*/
package org.pykix.libburnia.libisofs;
import java.io.File;
import java.io.FileNotFoundException;
import org.pykix.libburnia.bindings.Proxy;
import org.pykix.libburnia.libburn.BurnSource;
/**
* ISO-9660 Data volume.
*
* <p>
* This is the primary object to keep track of files and directory to be
* recorded in an ISO-9660 image.
*
* <p>
* To create an ISO image, you have to create a <code>IsoVolume</code>
* object and add files and/or directories to it. After doing so, you will
* want to get a {@link BurnSource} to actually write the image to a file or
* disc. To do this, you have to create an {@link IsoVolSet} with this object.
*
* @see IsoVolSet
*
* TODO current implementation forces user to keep a reference to this
* object while still having a reference to an IsoTreeNode from this. This
* is because of automatic memory management. Underlying iso_volume is
* deleted when Java object gets out of scope, and this causes all iso_tree_node
* to be also deleted, thus <i>invalidating</i> java objects. Without
* modifying libburnia code, the only way to solve this (I think) is add a ref
* from each IsoTreeNode. Because of space efficience and normal library usage
* I think current solution is better.
* When added to IsoVolSet there is no problem if this
* goes out of scope (while keeping ref. to IsoVolSet), because ref count
* is incremented and underlying object is not deleted.
*
* @author Vreixo Formoso
* @since 0.1
*/
public class IsoVolume extends Proxy {
/**
* Create a new volume.
*
* @param volumeId
* Id for the volume, can be null if you wish to set it later.
* @param publisherId
* Id for the publish, can be null if you wish to set it later.
* @param dataPreparerId
* Id for the data prepared, can be null if you wish to set it later.
*/
public IsoVolume(String volumeId, String publisherId,
String dataPreparerId) {
super( iso_volume_new(volumeId, publisherId, dataPreparerId) );
}
/**
* Create a new volume.
*
* @param volumeId
* @param publisherId
* @param dataPreparerId
* @param root
*/
public IsoVolume(String volumeId, String publisherId,
String dataPreparerId, IsoTreeNode root) {
super( iso_volume_new_with_root(volumeId, publisherId, dataPreparerId,
pointerOf(root)) );
}
/**
* Get the root directory.
* @return
*/
public IsoTreeNode getRoot() {
long ptr = iso_volume_get_root( pointerOf(this) );
if (ptr == 0) {
return null;
}
IsoTreeNode node = (IsoTreeNode) proxyFor(ptr);
if (node == null) {
node = new IsoTreeNode(ptr);
}
/*
* FIXME a problem here is that if this IsoVolume gets out of
* scope, C iso_volume will be freed, thus deleting the
* iso_tree_node, and ptr is pointing to an invalid C object, which
* can lead to problems. This can also happen in C code if an user
* explicity free the iso_volume, but in Java is really a problem
* because the automatic memory management
*/
return node;
}
/**
* Fill in the volume identifier.
* @param volumeId
*/
public void setVolumeId(String volumeId) {
iso_volume_set_volume_id(pointerOf(this), volumeId);
}
/**
* Fill in the publisher.
* @param publisherId
*/
public void setPublisherId(String publisherId) {
iso_volume_set_publisher_id(pointerOf(this), publisherId);
}
/**
* Fill in the data preparer.
* @param dataPreparerId
*/
public void setDataPreparerId(String dataPreparerId) {
iso_volume_set_data_preparer_id(pointerOf(this), dataPreparerId);
}
/**
* Locate a node by its path on disc.
*
* @param path
* The path, in the image, of the file.
* @return
* The node found or <code>null</code>.
*/
/*
* Take care that this is really a wrapp for iso_tree_volume_path_to_node
*/
public IsoTreeNode getNode(String path) {
long ptr = iso_tree_volume_path_to_node(pointerOf(this), path);
if (ptr == 0) {
return null;
}
//FIXME same problems as in getRoot
return (ptr == 0) ? null : new IsoTreeNode(ptr);
}
/**
* Add a file or a directory (recursively) to the volume by specifying
* its path on the volume.
*
* @param discPath
* The path on the disc at which to add the file/directory.
* @param path
* The path, on the local filesystem, of the file.
* @return
* The node for the file or <code>null</code> if the parent doesn't
* exists on the disc.
*/
public IsoTreeNode addPath(String discPath, String path) {
long ptr = iso_tree_volume_add_path(pointerOf(this), discPath, path);
if (ptr == 0) {
return null;
}
IsoTreeNode node = (IsoTreeNode) proxyFor(ptr);
if (node == null) {
node = new IsoTreeNode(ptr);
}
//FIXME same problems as in getRoot
return node;
}
/**
* Like {@link #addPath(String, String) addPath}, but local path is
* passed as a {@link File}
*
* @param discPath
* The path on the disc at which to add the file/directory.
* @param path
* The path, on the local filesystem, of the file.
* @return
* The node for the file or <code>null</code> if the parent doesn't
* exists on the disc.
* @throws FileNotFoundException
* If passed local path does not exist
*/
public IsoTreeNode addPath(String discPath, File path)
throws FileNotFoundException {
if ( !path.exists() ) {
throw new FileNotFoundException(path.getPath());
}
long ptr = iso_tree_volume_add_path(pointerOf(this), discPath,
path.getPath());
if (ptr == 0) {
return null;
}
IsoTreeNode node = (IsoTreeNode) proxyFor(ptr);
if (node == null) {
node = new IsoTreeNode(ptr);
}
//FIXME same problems as in getRoot
return node;
}
/**
* Creates a new, empty directory on the volume.
*
* @param discPath
* The path on the volume at which to add the directory.
* @return
* The newly created directory or <code>null</code>.
*/
public IsoTreeNode addNewDir(String discPath) {
long ptr = iso_tree_volume_add_new_dir(pointerOf(this), discPath);
if (ptr == 0) {
return null;
}
IsoTreeNode node = (IsoTreeNode) proxyFor(ptr);
if (node == null) {
node = new IsoTreeNode(ptr);
}
//FIXME same problems as in getRoot
return node;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
/* free underlying C object */
iso_volume_free( pointerOf(this) );
}
private static native long iso_volume_new(String volumeId,
String publisherId, String dataPreparerId);
private static native long iso_volume_new_with_root(String volumeId,
String publisherId, String dataPreparerId, long root);
private static native void iso_volume_free(long volume);
private static native long iso_volume_get_root(long volume);
private static native void iso_volume_set_volume_id(long volume,
String volumeId);
private static native void iso_volume_set_publisher_id(long volume,
String publisherId);
private static native void iso_volume_set_data_preparer_id(long volume,
String data_preparer_id);
private static native long iso_tree_volume_path_to_node(long volume,
String path);
private static native long iso_tree_volume_add_path(long volume,
String discPath, String path);
private static native long iso_tree_volume_add_new_dir(long volume,
String discPath);
static {
System.loadLibrary("java-libburn-0.1");
}
}

View 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;
}

View 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
java/src/jni/libburn/Burn.c Normal file
View 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, &micro);
return (*env)->NewObject(env, versionCls, cid, major, minor, micro);
}

123
java/src/jni/libburn/Disc.c Normal file
View 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);
}

View 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);
}

View 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);
}

View 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;
}

View 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;
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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;
}

View 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);
}

View 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();
}

View 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;
}

View 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;
}

View 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;
}

View File

@ -0,0 +1,152 @@
/*
* Main.java
*
* 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.
*/
package org.pykix.libburnia.test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.EnumSet;
import org.pykix.libburnia.libburn.BurnSource;
import org.pykix.libburnia.libburn.Source;
import org.pykix.libburnia.libisofs.Ecma119ExtensionFlag;
import org.pykix.libburnia.libisofs.IsoTreeNode;
import org.pykix.libburnia.libisofs.IsoVolSet;
import org.pykix.libburnia.libisofs.IsoVolume;
public class IsoFsMain {
private static void usage() {
System.out.println("Main [OPTIONS] DIRECTORY OUTPUT");
}
private static void help()
{
System.out.println(
"Options:\n" +
" -J Add Joliet support\n" +
" -R Add Rock Ridge support\n" +
" -L <num> Set the ISO level (1 or 2)\n" +
" -h Print this message"
);
}
private static void invalidOption(String opt) {
System.out.println("Invalid option: " + opt +
". Try Main -h for help");
usage();
}
public static void main(String[] args) throws IOException {
EnumSet<Ecma119ExtensionFlag> flags =
EnumSet.noneOf(Ecma119ExtensionFlag.class);
int level = 1;
/* parse cmd line. */
int i = 0;
while ( i < args.length ) {
String arg = args[i];
if ( arg.startsWith("-") ) {
if (arg.length() > 2) {
invalidOption(arg);
System.exit(1);
}
char opt = arg.charAt(1);
switch (opt) {
case 'h':
usage();
help();
System.exit(0);
break;
case 'J':
flags.add(Ecma119ExtensionFlag.JOLIET);
break;
case 'R':
flags.add(Ecma119ExtensionFlag.ROCKRIDGE);
break;
case 'L':
/* get level value */
if ( ++i < args.length ) {
level = Integer.parseInt(args[i]);
} else {
System.out.println("Level number needed");
usage();
help();
System.exit(1);
break;
}
break;
default:
invalidOption(arg);
System.exit(1);
break;
}
i++;
} else {
break; /* exit loop, no more options */
}
}
if (args.length < i + 1) {
System.out.println("Please pass directory from which to build ISO");
usage();
System.exit(1);
}
if (args.length < i + 2) {
System.out.println("Please supply output file");
usage();
System.exit(1);
}
FileOutputStream f = null;
try {
f = new FileOutputStream(args[i+1]);
} catch (FileNotFoundException e) {
System.out.println("error opening output file");
System.exit(1);
}
File dir = new File(args[i]);
IsoTreeNode root = null;
try {
root = IsoTreeNode.raddDir(null, dir);
} catch (FileNotFoundException e) {
System.out.println("Input directory not found");
System.exit(1);
}
if ( root == null ) {
System.out.println("Error opening input directory.");
System.exit(1);
}
IsoVolume volume = new IsoVolume("VOLID", "PUBID", "PREPID", root);
IsoVolSet volset = new IsoVolSet( volume, "VOLSETID" );
BurnSource src = new Source(volset, 0, level, flags);
byte [] buf = new byte[2048];
while ( src.read(buf, 2048) == 2048 ) {
f.write(buf);
}
f.close();
}
}

View File

@ -0,0 +1,212 @@
/*
* Test.java
*
* 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.
*/
package org.pykix.libburnia.test;
import java.util.Arrays;
import org.pykix.libburnia.libburn.BlockType;
import org.pykix.libburnia.libburn.Burn;
import org.pykix.libburnia.libburn.BurnException;
import org.pykix.libburnia.libburn.BurnSource;
import org.pykix.libburnia.libburn.Disc;
import org.pykix.libburnia.libburn.DiscStatus;
import org.pykix.libburnia.libburn.Drive;
import org.pykix.libburnia.libburn.DriveInfo;
import org.pykix.libburnia.libburn.DriveStatus;
import org.pykix.libburnia.libburn.FormatDesc;
import org.pykix.libburnia.libburn.Formats;
import org.pykix.libburnia.libburn.Message;
import org.pykix.libburnia.libburn.MultiCaps;
import org.pykix.libburnia.libburn.Profile;
import org.pykix.libburnia.libburn.Progress;
import org.pykix.libburnia.libburn.ReadOpts;
import org.pykix.libburnia.libburn.ScsiAdr;
import org.pykix.libburnia.libburn.Session;
import org.pykix.libburnia.libburn.Source;
import org.pykix.libburnia.libburn.SpeedDescriptor;
import org.pykix.libburnia.libburn.Track;
import org.pykix.libburnia.libburn.WriteOpts;
import org.pykix.libburnia.libburn.WriteType;
import org.pykix.libburnia.libburn.Message.Severity;
public class Test {
private static int blankDisc(Drive drive, boolean fast)
throws InterruptedException, BurnException {
DiscStatus state = drive.getDiscStatus();
Profile profile = drive.getProfile();
System.out.println("Disc state: " + state);
if (profile == Profile.DVD_RW_RESTRICTED_OVERWITE) {
/* formatted DVD-RW will get blanked to sequential state */
} else if (state == DiscStatus.BLANK) {
System.err.println(
"IDLE: Blank media detected. Will leave it untouched");
return 2;
} else if (state == DiscStatus.FULL ||
state == DiscStatus.APPENDABLE) {
/* this is what libburner is willing to blank */
} else if (state == DiscStatus.EMPTY) {
System.err.println("FATAL: No media detected in drive");
return 0;
} else {
System.err.println("FATAL: Unsuitable drive and media state");
return 0;
}
if( !drive.isErasable() ) {
System.err.println("FATAL : Media is not of erasable type");
return 0;
}
System.out.println("Beginning to " + (fast?"fast":"full") + "-blank media.");
drive.erase(fast);
Thread.sleep(1000);
Progress p = new Progress();
while ( drive.getDriveStatus(p) != DriveStatus.IDLE ) {
System.out.printf("Blanking ( %.1f%% done )\n",
(float) p.getSector() * 100 / p.getSectors() );
Thread.sleep(1000);
}
System.out.println("Done");
return 1;
}
private static int writeImage(Drive drive, String path)
throws InterruptedException, BurnException {
WriteOpts wo = drive.newWriteOpts();
wo.setMulti(true);
wo.setWriteType(WriteType.SAO, BlockType.MODE2_OK);
BurnSource src = new Source(path, null);
Disc disc = new Disc();
Session s = new Session();
Track t = new Track();
t.setSource(src);
s.addTrack(t, 0);
disc.addSession(s, 0);
wo.precheckWrite(disc, false);
drive.write(wo, disc);
Thread.sleep(1000);
Progress p = new Progress();
while ( drive.getDriveStatus(p) != DriveStatus.IDLE ) {
System.out.printf("Blanking ( %.1f%% done )\n",
(float) p.getSector() * 100 / p.getSectors() );
Thread.sleep(1000);
}
return 0;
}
public static void main(String[] args) throws BurnException, InterruptedException {
Burn.initialize();
// Message.setSeverities(Severity.ALL, Severity.ALL, "Test: ");
// DriveInfo[] drives = Burn.scan();
// Drive drive = drives[0].getDrive();
// drive.grab(true);
System.out.println(Burn.convertFsAdr("/dev/sr0"));
DriveInfo info = Burn.scanAndGrab("/dev/sg1", true);
Drive drive = info.getDrive();
// ScsiAdr ad = ScsiAdr.obtainScsiAdr(info.getAdr());
// System.out.println(Burn.getVersion());
// Burn.setSignalHandler( new Burn.SignalHandler() {
// public int handleSignal(int signum, int flag) {
// System.err.println("handled signal " + signum);
// System.err.flush();
// return -1;
// }
// }, 0);
Formats fs = drive.getFormats();
System.out.println("blsas = " + fs.getBlSas() +
", size = " + fs.getSize() +
", status = " + fs.getStatus());
FormatDesc fd = drive.getFormatDescr(0);
System.out.println(" Type = " + fd.getType() +
", size = " + fd.getSize() );
// WriteOpts wo = drive.newWriteOpts();
//
// System.out.println(drive.getAvailableSpace(wo));
// drive.readAtip();
//
// MultiCaps mc = drive.getMultiCaps(WriteType.SAO);
//
// System.out.println( mc.getCurrentProfile() );
//
// mc = drive.getMultiCaps(WriteType.SAO);
// System.out.println( mc.isWritingPossible() );
// System.out.println( drive.getTrackNwa(null, 2) );
// SpeedDescriptor[] sl = drive.getSpeedList();
//
// for ( SpeedDescriptor sd : sl ) {
// System.out.println( sd.getWriteSpeed() + " " + sd.getSource() );
// }
//
// Message msg;
// while ( (msg = Message.obtain(Severity.ALL)) != null ) {
// System.out.println(msg.getMsgText());
// }
// blankDisc(drive, true);
// writeImage(drive, "/home/metalpain/image.iso");
// ReadOpts opts = drive.newReadOpts();
// System.out.println( drive.getWriteSpeed() );
// long i = 0;
// while( i++ < 10000000000L) {
// //System.out.print("aa");
// }
drive.release(false);
// drives[0].forget(0);
info.forget(0);
Burn.finish();
}
}