2 Copyright (C) 2017-2019 Michael Zucchi
4 See the section LICENSE for details.
9 jjmpeg is a JNI based Java binding for the suite of libraries provided
12 The original version of jjmpeg was released sometime in the distant
13 past and has slowly got further and further behind the current FFmpeg
14 version. This is a completely new implementation intended as a
15 project to catch up with the current API.
20 jdk (javac, jar) and native compiler tools (GNU make, cc, cpp, perl)
21 must be in path. In addition the program cproto must be installed.
22 JDK 13 is the baseline but JDK 9+ may work.
24 The prequisitve project notzed.nativez must also have previously been
25 compiled and will be automatically used if it is present in the
26 directory above this one (../nativez/).
28 First copy config.make.in to config.make and adjust configuration
31 Build everything for default target of linux-amd64:
35 Build everything for a specific target:
37 $ make TARGET=<target>
39 All intermediate and final results are place in `bin/'.
41 `bin/<target>/lib/<module>.jar' Modular jar for ide.
42 `bin/<target>/lib/*.so' Platform specific
43 `bin/<target>/bin/*.dll' runtime libraries.
45 `bin/<target>/jmods/<module>.jmod' Target specific .jmod.
49 Build everything but the jars and jmods.
53 Create a source archive. The source is found via $(find) so
54 this will include any droppings.
59 Before the source can be easily edited in NetBeans one must
60 first run the makefile to generate any auto-generated files.
64 This needs to be done each time `make clean' is executed or
65 files in `src/notzed.jjmpeg/gen' are edited.
70 Some notes on internals.
75 All jj-*.c files are independent of one another, they may only
76 reference functions and variables from jjmpeg.c.
78 The native interface is implemented using the notzed.nativez project.
79 This allows it to support full garbage collection of all relevant
80 objects. In some cases this currently requires references to be
81 manually kept to ensure they survive for the relevant C side objects.
82 All objects are unique (and keyed) based on their C pointer address.
84 If used with care, objects can also be manually released safely.
86 Unlike earlier versions of jjmpeg, version 3+ is implemented almost
87 entirely using hand-rolled Java and macro-assisted C source-code.
88 Also unlike earlier versions almost all code is written directly in C
89 with only skeleton Java wrappers of native method signatures. This
90 requires less work and produces smaller code than previous versions.
92 To further reduce code-size most initialisation is implemented via
98 A set of small(ish) perl scripts are used to extract various
99 enumeration and #define tables directly from the FFmpeg development
100 header files. They generate interfaces which are "implemented" to add
101 the defines to the desired structures. These reside in the scripts
104 All enumerations were converted to final integer values for
105 consistency. Where the corresponding functions exist, static
106 valueOf() and toString() are available for obvious purposes.
108 The perl scripts generate C code which is then compiled and executed
109 to create the Java interfaces.
114 Exceptions fall into two categories, AVIOException and AVException,
115 both checked exceptions. The former derives from IOException for
118 They contain the error code (errno and AVERROR defines) and a
121 Where it makes sense other Java checked and unchecked exceptions such
122 as FileNotFoundException or OutOfMemoryError are also thrown.
127 All libraries are dynamically linked at runtime. Missing functions
128 result in an initialisation failure.
130 Method signatures are automatically extracted from headers via the
131 script src/notzed.jjmpeg/jni/extract-proto.pl based on per-file .def
132 files. This also generates a table for initialising the pointers.
137 See java.make. It's a lot simpler than it looks and is based on
138 meta-make programming via macros and pattern variables.
143 Very lacking, but at least most of the enumerations now have the
144 comments present in the header files.
149 Enough core classes to read and write video frames is implemented as
150 well as a pair of high-level interfaces JJMediaReader and
151 JJMediaWriter. These have been simplified somewhat from the previous
152 implementation, but it takes less code to use them anyway.
154 Most functions that should throw exceptions do although that which
155 they throw may be tweaked.
157 Many accessors have been implemented, in some cases they have been
158 Javaised or NotZedised (e.g. setFlags(mask, value)) for a cleaner
159 interface. Because of the complexity of the libraries and objects it
160 is not always clear which members need to be accessed by user code so
161 some of the choices are arbitrary. Or I just gave up part way
162 through. They are easy to add.
164 There are two sub-modules notzed.jjmpeg.fx and notzed.jjmpeg.awt which
165 supply the JavaFX and Swing/AWT specific functionality.
172 This version is compatible with at least version 4.0 of FFmpeg.
174 No deprecated functions or fields have been made accessible from Java
175 or are used in the native code.
177 To support contrib/octave the main source-code (sans the module-info
178 files) is limited to Java 8.
183 * nativez <https://www.zedzone.space/software/nativez.html>
184 * jjmpeg <https://www.zedzone.space/software/jjmpeg.html>
185 * FFmpeg <http://www.ffmpeg.org/>
186 * OpenJDK <http://openjdk.java.net/>
191 Most of the code is licensed under GNU General Public License version
192 3, see src/<module>/legal/LICENSE for the full details for each module.
194 Copyright (C) 2017-2019 Michael Zucchi
196 This program is free software: you can redistribute it and/or
197 modify it under the terms of the GNU General Public License as
198 published by the Free Software Foundation, either version 3 of the
199 License, or (at your option) any later version.
201 This program is distributed in the hope that it will be useful,
202 but WITHOUT ANY WARRANTY; without even the implied warranty of
203 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
204 General Public License for more details.
206 You should have received a copy of the GNU General Public License
207 along with this program. If not, see
208 <http://www.gnu.org/licenses/>.
210 Portions are auto-generated from FFmpeg header files and are thus
211 copyright various authors but are also distributed under the GNU
212 General Public License Version 3 (or later) as per the copyright
215 These portions are clearly marked in the bin/gen/*Bits.java files.