Long changelog, I hope I've not missed nothing, and long mail...

The patch is huge also, so I'll briefly explain what it does. I'm going
to commit this in the next half hour or so, because it is almost the
same patch I've posted few weeks ago, just a little polished (more love
is needed too, and will come in the next days), and because the backend
is disabled by default.

The code actually works that way, it adds a provider to the list of
service providers for the Sound API on the META-INF directory. This is a
temp measure until we come up with some better way to deal with
services, I'am a fan of the preferences and I guess they would work
really well in that case, but I leave this discussion for later posts.

The gstreamer backed, when compiled, is the first to be checked. As you
can see, the entry point is the Mixer class. It still has lots of stubs
returning null or throwing exceptions. Next work will be done in that
area, for now, the only code that does something is the code that
produces an AudioFileReader, namely GstAudioFileReader. This class also
contains some stubs (the code is work in progress and I'm proceeding for
targets here), but when asked to create an input stream it goes native.
There is a class (GstAudioFileReaderNativePeer) that wraps the real
native stuff. This class works closely with gstreamer. In the native
code, it creates a gstreamer source, a pipeline, parses the pipeline and
searches all the information that we need. After, it returns that data
to the calling java stack.

We set a property in the java side that is needed to show that the sound
file was actually parsed by gstreamer. There is a reason for that. Each
implementation is required to handle PCM data, that is, raw audio data.
But as the specification is quite old, it does not take into account
compressed data. Some implementation return that data as is, while
usually PCM data (ie, data that comes from a wave file) is returned with
the header stripped. As GStreamer does not give the ability to strip
headers from a sound file and only return raw data, we use this property
so that if the user obtains an audio stream from some other provider
(say a custom provider), we proceed as normal if the data is RAW (we can
always read PCM data), but fail if the data is not in PCM format (throws
UnsupportedFormat), because there is the possibility that if the data is
not in PCM the provider has stripped the header in some way we can't
handle.

The native code has two entry point, one for files and one for streams.
While is normal for any implementation to have the two to coincide, I
give two different implementations for both cases. This is so because
files can be seeked, while a stream can or cannot be. The file case is
easy, gstreamer takes care of everything. The stream is a bit tricky,
and requires a special gstreamer plugin that reads from a java input
stream and returns data in form of bytes, which can be a bit buggy and
I'm not very comfortable yet to use in all cases. Moreover, this source
element is a Push type, that is, can be buffered, but not seeked, so it
is slower.

As said, the code is not compiled by default, but if you enable it and
give me some feedback this would be a lot appreciated.

Thanks for the time to read this long mail (and the long patch!),
Mario

P.S. At 00.00 CET was one year exactly of commit access, it was a nice
year, I'm very happy to have meet all of you! This patch is to celebrate
this :)

2007-07-08  Mario Torre  <[EMAIL PROTECTED]>

        * gnu/javax/sound/sampled/gstreamer: new package hierarchy.
        * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java: new
file.
        *
gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java:
        likewise.
        * gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java: likewise.
        * gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java: likewise.
        * gnu/javax/sound/sampled/gstreamer/GStreamerMixerProvider.java:
likewise.
        * gnu/javax/sound/AudioSecurityManager.java: likewise. 
        * gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java:
likewise.
        * gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java:
likewise.
        * gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java: likewise.
        * gnu/javax/sound/sampled/gstreamer/io/GstAudioFileWriter.java:
likewise. 
        *
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in:
        likewise.
        * resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in:
        likewise.
        * resource/META-INF/services/javax.sound.sampled.spi.MixerProvider:
        likewise.
        * native/jni/gstreamer-peer/gstclasspathsrc.c: likewise.
        * native/jni/gstreamer-peer/gstclasspathsrc.h: likewise.
        * native/jni/gstreamer-peer/gstinputstream.c: likewise.
        * native/jni/gstreamer-peer/gstinputstream.h: likewise.
        * native/jni/gstreamer-peer/GStreamerIOPeer.c: likewise.
        * native/jni/gstreamer-peer/Makefile.am: likewise.
        *
include/gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer.h:
        likewise.
        * include/Makefile.am: add gstreamer generated headers.
        * configure.ac: add gstreamer sound backend configuration.
        The backend is currently disabled by default.
        * native/jni/Makefile.am: code to allow compilation of the gstreamer
        sound backend.
        * javax/sound/sampled/spi/MixerProvider.java (isMixerSupported):
        indentation fixes.
        * javax/sound/sampled/AudioFormat.java (toString): fix method to
display
        informations only when available.
        * javax/sound/sampled/DataLine.java:
        (Info.isFormatSupported):  indentation fixes.
        (Info):  indentation fixes.
        (Info.toString):  indentation fixes.
        (Info.matches):  indentation fixes.
-- 
Lima Software - http://www.limasoftware.net/
GNU Classpath Developer - http://www.classpath.org/
Fedora Ambassador - http://fedoraproject.org/wiki/MarioTorre
Jabber: [EMAIL PROTECTED]
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

Please, support open standards:
http://opendocumentfellowship.org/petition/
http://www.nosoftwarepatents.com/

Attachment: 2007-07-09-gsoc.patch.tar.gz
Description: application/compressed-tar

Reply via email to