diff options
Diffstat (limited to 'libjava/classpath/native/jni/gstreamer-peer')
7 files changed, 2447 insertions, 0 deletions
diff --git a/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c b/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c new file mode 100644 index 00000000000..f5d52e8a4b4 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/GStreamerIOPeer.c @@ -0,0 +1,772 @@ +/* GStreamerIOPeer.c -- Implements native methods for class GStreamerNativePeer + Copyright (C) 2007 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + + GNU Classpath 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, or (at your option) + any later version. + + GNU Classpath is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Classpath; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. */ + +#include <stdio.h> +#include <string.h> + +#include <jni.h> + +#include <glib.h> +#include <glib/gprintf.h> + +#include <gdk/gdk.h> + +#include <gst/gst.h> + +#include "jcl.h" + +#include "gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer.h" + +#include "gstclasspathsrc.h" +#include "gstinputstream.h" + +#define _GST_MALLOC_SIZE_ 256 + +typedef struct _AudioProperties AudioProperties; +struct _AudioProperties +{ + /* + * NOTE: descriptions of the properties are taken from: + * http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html#table-audio-types + */ + + /* decoder name */ + const char *name; + + /* audio endiannes */ + const char *endianness; + + /* header size */ + const char *header_size; + + /* mime */ + const char *mimetype; + + /* The sample rate of the data, in samples (per channel) per second */ + const char *samplerate; + + /* The number of channels of audio data */ + const char *channels; + + const char *layer; + + const char *bitrate; + + const char *framed; + + /* + * Defines if the values of the integer samples are signed or not. + * Signed samples use one bit to indicate sign (negative or positive) + * of the value. Unsigned samples are always positive. + */ + const char *signess; + + /* */ + const char *rate; + + /* Number of bits allocated per sample. */ + const char *width; + + /* + * The number of bits used per sample. + * If the depth is less than the width, the low bits are assumed to be the + * ones used. For example, a width of 32 and a depth of 24 means that + * each sample is stored in a 32 bit word, but only the low + * 24 bits are actually used. + */ + const char *depth; + + /* + * This is set in the case of the mpeg files. + */ + const char *type; + + gboolean done; + +}; + +/* ***** PRIVATE FUNCTIONS DECLARATION ***** */ + +static gboolean +set_strings (JNIEnv *env, const jclass GstHeader, + const AudioProperties *properties, jobject header); + +static gboolean +typefind_callback(GstElement *typefind, guint probability, const GstCaps *caps, + gpointer data); + +static void +element_added (GstBin *bin, GstElement *element, gpointer data); + +static void +new_decoded_pad (GstElement *decoder, GstPad *pad, + gboolean last, GstElement *pipeline); + +static gboolean +fill_info (GstElement *decoder, AudioProperties *properties); + +static gchar * +get_string_property (const GstStructure *structure, const gchar *property); + +static gchar * +get_boolean_property (const GstStructure *structure, const gchar *property); + +static gboolean +set_string (JNIEnv *env, const jclass GstHeader, jobject header, + const char *field, const gchar *property); + +static void +free_properties (AudioProperties *properties); + +static void +reset_properties (AudioProperties *properties); + +/* ***** END: PRIVATE FUNCTIONS DECLARATION ***** */ + +/* ***** NATIVE FUNCTIONS ***** */ + +JNIEXPORT jboolean JNICALL +Java_gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer_gstreamer_1get_1audio_1format_1stream + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject header __attribute__ ((unused)), + jobject jstream __attribute__ ((unused))) +{ + GstInputStream *istream = NULL; + JavaVM *vm = NULL; + jclass GstHeader = NULL; + + GstElement *pipeline = NULL; + + GstElement *typefind = NULL; + GstElement *decodebin = NULL; + GstElement *source = NULL; + + AudioProperties *properties = NULL; + + jboolean result = JNI_FALSE; + + GstHeader = (*env)->GetObjectClass(env, header); + + gst_init (NULL, NULL); + + properties = (AudioProperties *) g_malloc0 (sizeof (AudioProperties)); + if (properties == NULL) + { + g_warning ("unable to allocate memory for properties"); + return JNI_FALSE; + } + + /* create the GstInputStream object */ + istream = g_object_new (GST_TYPE_INPUT_STREAM, NULL); + if (istream == NULL) + { + free_properties (properties); + + g_warning ("unable to create an istream"); + return JNI_FALSE; + } + + source = gst_element_factory_make ("classpathsrc", "source"); + if (source == NULL) + { + free_properties (properties); + g_free ((gpointer) istream); + + g_warning ("unable to create a source"); + return JNI_FALSE; + } + + /* store the vm and the input stream in the gstinputstream class */ + (*env)->GetJavaVM(env, &vm); + g_object_set (G_OBJECT (istream), GST_ISTREAM_JVM, vm, + GST_ISTREAM_READER, jstream, + NULL); + g_object_set (G_OBJECT (source), GST_CLASSPATH_SRC_ISTREAM, istream, NULL); + + pipeline = gst_pipeline_new ("pipe"); + if (pipeline == NULL) + { + gst_object_unref (GST_OBJECT (source)); + g_free ((gpointer) istream); + free_properties (properties); + + g_warning ("unable to create the pipeline"); + return JNI_FALSE; + } + + decodebin = gst_element_factory_make ("decodebin", "decodebin"); + if (decodebin == NULL) + { + gst_object_unref (GST_OBJECT (source)); + + g_free ((gpointer) istream); + free_properties(properties); + + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("unable to create decodebin"); + return JNI_FALSE; + } + + g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (new_decoded_pad), + pipeline); + + gst_bin_add_many (GST_BIN (pipeline), source, decodebin, NULL); + gst_element_link (source, decodebin); + + typefind = gst_bin_get_by_name (GST_BIN (decodebin), "typefind"); + if (typefind == NULL) + { + g_free ((gpointer) istream); + free_properties(properties); + + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("unable to create decodebin"); + return JNI_FALSE; + } + + g_signal_connect (G_OBJECT (typefind), "have-type", + G_CALLBACK (typefind_callback), properties); + + gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING); + if (gst_element_get_state (pipeline, NULL, NULL, 100000) == + GST_STATE_CHANGE_FAILURE) + { + g_free ((gpointer) istream); + free_properties(properties); + gst_object_unref(GST_OBJECT(pipeline)); + + g_warning ("Failed to go into PLAYING state"); + return JNI_FALSE; + } + + result = JNI_FALSE; + if (fill_info (decodebin, properties)) + { + result = set_strings (env, GstHeader, properties, header); + } + + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); + + gst_object_unref (GST_OBJECT(pipeline)); + free_properties (properties); + + return result; +} + +JNIEXPORT jboolean JNICALL +Java_gnu_javax_sound_sampled_gstreamer_io_GstAudioFileReaderNativePeer_gstreamer_1get_1audio_1format_1file + (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject header) +{ + /* will contain the properties we need to put into the given GstHeader */ + AudioProperties *properties = NULL; + + /* source file */ + const char *file = NULL; + + /* GStreamer elements */ + GstElement *pipeline = NULL; + GstElement *source = NULL; + GstElement *decoder = NULL; + + GstElement *typefind = NULL; + + GstStateChangeReturn res; + + jboolean result = JNI_FALSE; + + /* java fields */ + jfieldID _fid = NULL; + jclass GstHeader = NULL; + jstring _file = NULL; + + GstHeader = (*env)->GetObjectClass(env, header); + _fid = (*env)->GetFieldID(env, GstHeader, "file", "Ljava/lang/String;"); + if (_fid == NULL) + { + return JNI_FALSE; /* failed to find the field */ + } + + _file = (*env)->GetObjectField(env, header, _fid); + file = JCL_jstring_to_cstring (env, _file); + if (file == NULL) + { + return JNI_FALSE; + } + + gst_init (NULL, NULL); + + properties = (AudioProperties *) g_malloc0 (sizeof (AudioProperties)); + if (properties == NULL) + { + free_properties (properties); + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* this is not really needed */ + reset_properties(properties); + + /* create the source element, will be used to read the file */ + source = gst_element_factory_make ("filesrc", "source"); + if (source == NULL) + { + free_properties (properties); + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* set the file name */ + g_object_set (G_OBJECT (source), "location", file, NULL); + + /* + * create the decoder element, this will decode the stream and retrieve + * its properties. + * We connect a signal to this element, to be informed when it is done + * in decoding the stream and to get the needed informations about the + * audio file. + */ + decoder = gst_element_factory_make ("decodebin", "decoder"); + if (decoder == NULL) + { + gst_object_unref (GST_OBJECT (source)); + free_properties(properties); + + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + g_signal_connect (decoder, "new-decoded-pad", G_CALLBACK (new_decoded_pad), + pipeline); + g_signal_connect (G_OBJECT (decoder), "element-added", + G_CALLBACK (element_added), properties); + + /* now, we create a pipeline and fill it with the other elements */ + pipeline = gst_pipeline_new ("pipeline"); + if (pipeline == NULL) + { + gst_object_unref (GST_OBJECT (source)); + gst_object_unref (GST_OBJECT (decoder)); + + free_properties(properties); + + JCL_free_cstring (env, _file, file); + return JNI_FALSE; + } + + /* + * we get the typefind from the decodebin to catch the additional properties + * that the decodebin does not expose to us + */ + typefind = gst_bin_get_by_name (GST_BIN (decoder), "typefind"); + if (typefind != NULL) + { + /* + * NOTE: the above is not a typo, we can live without the typefind, + * just, our stream detection will not be as accurate as we would. + * Anyway, if this fails, there is some problem, probabily a memory + * error. + */ + g_signal_connect (G_OBJECT (typefind), "have-type", + G_CALLBACK (typefind_callback), properties); + } + + gst_bin_add_many (GST_BIN (pipeline), source, decoder, NULL); + gst_element_link (source, decoder); + + /* + * now, we set the pipeline playing state to pause and traverse it + * to get the info we need. + */ + + res = gst_element_set_state (pipeline, GST_STATE_PAUSED); + if (res == GST_STATE_CHANGE_FAILURE) + { + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties(properties); + + return JNI_FALSE; + } + + /* (GstClockTime) 300000000 ? */ + res = gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE); + if (res != GST_STATE_CHANGE_SUCCESS) + { + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties(properties); + + return JNI_FALSE; + } + + result = JNI_FALSE; + if (fill_info (decoder, properties)) + { + result = set_strings (env, GstHeader, properties, header); + } + + /* free stuff */ + JCL_free_cstring (env, _file, file); + gst_element_set_state (pipeline, GST_STATE_NULL); + + gst_object_unref (GST_OBJECT (pipeline)); + + free_properties (properties); + + return result; +} + +/* ***** END: NATIVE FUNCTIONS ***** */ + +/* ***** PRIVATE FUNCTIONS IMPLEMENTATION ***** */ +static gboolean typefind_callback(GstElement *typefind __attribute__ ((unused)), + guint probability __attribute__ ((unused)), + const GstCaps *caps, + gpointer data) +{ + GstStructure *structure = NULL; + AudioProperties *properties = NULL; + + const char *mpeg = NULL; + + properties = (AudioProperties *) data; + + structure = gst_caps_get_structure (caps, 0); + + /* MIMETYPE */ + properties->mimetype = gst_structure_get_name (structure); + mpeg = get_string_property(structure, "mpegversion"); + + if (mpeg != NULL) + { + properties->layer = get_string_property(structure, "layer"); + properties->type = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + g_snprintf ((gpointer) properties->type, _GST_MALLOC_SIZE_, + "MPEG%sV%s", mpeg, + properties->layer); + + g_free ((gpointer) mpeg); + } + + return TRUE; +} + +static void +new_decoded_pad (GstElement *decoder __attribute__ ((unused)), + GstPad *pad, + gboolean last __attribute__ ((unused)), + GstElement *pipeline) +{ + GstElement *fakesink = NULL; + GstPad *sinkpad = NULL; + + fakesink = gst_element_factory_make ("fakesink", NULL); + gst_bin_add (GST_BIN (pipeline), fakesink); + + sinkpad = gst_element_get_pad (fakesink, "sink"); + if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sinkpad))) + { + gst_bin_remove (GST_BIN (pipeline), fakesink); + } + else + { + gst_element_set_state (fakesink, GST_STATE_PAUSED); + } +} + +static gboolean +set_strings (JNIEnv *env, const jclass GstHeader, + const AudioProperties *properties, jobject header) +{ + gboolean result = FALSE; + + /* + * we only need at least one of them to be sure we can handle this + * kind of audio data. + */ + + /* now, map our properties to the java class */ + set_string (env, GstHeader, header, "mimetype", properties->mimetype); + + if (set_string (env, GstHeader, header, "endianness", + properties->endianness)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "channels", + properties->channels)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "rate", + properties->rate)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "width", + properties->width)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "depth", + properties->depth)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "isSigned", + properties->signess)) result = JNI_TRUE; + + if (set_string (env, GstHeader, header, "name", + properties->name)) result = JNI_TRUE; + + /* non primary properties */ + set_string (env, GstHeader, header, "layer", properties->layer); + set_string (env, GstHeader, header, "bitrate", properties->bitrate); + set_string (env, GstHeader, header, "framed", properties->framed); + set_string (env, GstHeader, header, "type", properties->type); + + return result; +} + +static gboolean fill_info (GstElement *decoder, AudioProperties *properties) +{ + GstIterator *it = NULL; + gpointer data = NULL; + gboolean result = FALSE; + + it = gst_element_iterate_src_pads (decoder); + while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) + { + GstPad *pad = GST_PAD (data); + GstCaps *caps; + + GstStructure *structure; + + const gchar *caps_string = NULL; + + caps = gst_pad_get_caps (pad); + caps_string = gst_caps_to_string (caps); + + if (g_str_has_prefix (caps_string, "video")) + { + /* no video support, this is an audio library */ + + g_free ((gpointer) caps_string); + gst_caps_unref (caps); + gst_object_unref (pad); + + continue; + } + + g_free ((gpointer) caps_string); + + structure = gst_caps_get_structure (GST_CAPS (caps), 0); + + /* fill the properties we need */ + + /* SIGNESS */ + properties->signess = get_boolean_property(structure, "signed"); + if (properties->signess != NULL) + { + result = TRUE; + } + + /* ENDIANNESS */ + properties->endianness = get_string_property(structure, "endianness"); + if (properties->endianness != NULL) + { + result = TRUE; + } + + /* CHANNELS */ + properties->channels = get_string_property(structure, "channels"); + if (properties->channels != NULL) + { + result = TRUE; + } + + /* RATE */ + properties->rate = get_string_property(structure, "rate"); + if (properties->rate != NULL) + { + result = TRUE; + } + + /* WIDTH */ + properties->width = get_string_property(structure, "width"); + if (properties->width != NULL) + { + result = TRUE; + } + + /* DEPTH */ + properties->depth = get_string_property(structure, "depth"); + if (properties->depth != NULL) + { + result = TRUE; + } + + gst_caps_unref (caps); + gst_object_unref (pad); + } + + return result; +} + +static void free_properties (AudioProperties *properties) +{ + if (properties->name != NULL) g_free((gpointer) properties->name); + if (properties->endianness != NULL) g_free((gpointer) properties->endianness); + if (properties->channels != NULL) g_free((gpointer) properties->channels); + if (properties->rate != NULL) g_free((gpointer) properties->rate); + if (properties->width != NULL) g_free((gpointer) properties->width); + if (properties->depth != NULL) g_free((gpointer) properties->depth); + if (properties->layer != NULL) g_free((gpointer) properties->layer); + if (properties->bitrate != NULL) g_free((gpointer) properties->bitrate); + if (properties->framed != NULL) g_free((gpointer) properties->framed); + + if (properties != NULL) g_free ((gpointer) properties); +} + +static void reset_properties (AudioProperties *properties) +{ + properties->done = FALSE; + properties->signess = FALSE; + properties->name = NULL; + properties->endianness = NULL; + properties->channels = NULL; + properties->rate = NULL; + properties->width = NULL; + properties->depth = NULL; + properties->layer = NULL; + properties->bitrate = NULL; + properties->framed = NULL; +} + +static gchar *get_string_property (const GstStructure *structure, + const gchar *property) +{ + int props = 0; + gchar *result = NULL; + + if (property == NULL) + { + return NULL; + } + + /* we don't need more */ + result = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + if (result == NULL) + { + /* huston, we have a problem here... */ + return NULL; + } + + if (gst_structure_get_int (structure, property, &props)) + { + g_snprintf (result, _GST_MALLOC_SIZE_, "%d", props); + } + else + { + g_free ((gpointer) result); + return NULL; + } + + return result; +} + +static gchar *get_boolean_property (const GstStructure *structure, + const gchar *property) +{ + gchar *result = NULL; + gboolean props = FALSE; + + result = (gchar *) g_malloc0 (_GST_MALLOC_SIZE_); + if (result == NULL) + { + /* huston, we have a problem here... */ + return NULL; + } + + if (gst_structure_get_boolean (structure, property, &props)) + { + g_snprintf (result, _GST_MALLOC_SIZE_, "%s", (props ? "true" : "false" )); + } + else + { + g_free ((gpointer) result); + return NULL; + } + + return result; +} + +static gboolean set_string (JNIEnv *env, const jclass GstHeader, + jobject header, + const char *field, + const gchar *property) +{ + jfieldID _fid = NULL; + jstring property_string_field = NULL; + + if (property == NULL || field == NULL || header == NULL || GstHeader == NULL) + { + return JNI_FALSE; + } + + _fid = (*env)->GetFieldID(env, GstHeader, field, "Ljava/lang/String;"); + if (_fid == NULL) + { + return JNI_FALSE; /* failed to find the field */ + } + + property_string_field = (*env)->NewStringUTF(env, property); + if (property_string_field == NULL) + { + return JNI_FALSE; + } + + (*env)->SetObjectField(env, header, _fid, property_string_field); + + return JNI_TRUE; +} + +static void +element_added (GstBin *bin, GstElement *element, gpointer data) +{ + GstElementFactory *factory; + + factory = gst_element_get_factory (element); + ((AudioProperties *) data)->name = gst_element_factory_get_longname (factory); +} + +/* ***** END: PRIVATE FUNCTIONS IMPLEMENTATION ***** */ diff --git a/libjava/classpath/native/jni/gstreamer-peer/Makefile.am b/libjava/classpath/native/jni/gstreamer-peer/Makefile.am new file mode 100644 index 00000000000..c40170fc3d3 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/Makefile.am @@ -0,0 +1,22 @@ +nativeexeclib_LTLIBRARIES = libgstreamerpeer.la + +libgstreamerpeer_la_SOURCES = GStreamerIOPeer.c \ + gstinputstream.c \ + gstclasspathsrc.c \ + gstclasspathsrc.h \ + gstinputstream.h + +libgstreamerpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo + +libgstreamerpeer_la_LDFLAGS = $(AM_LDFLAGS) @GST_PLUGIN_LDFLAGS@ -avoid-version + +AM_LDFLAGS = @CLASSPATH_MODULE@ @GSTREAMER_LIBS@ @GSTREAMER_BASE_LIBS@ \ + @GSTREAMER_PLUGINS_BASE_LIBS@ @GDK_LIBS@ + +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ + +# We cannot use -Wwrite-strings and the strict flags since +# gstreamer contain broken prototypes (by design). +AM_CFLAGS = @WARNING_CFLAGS@ -Wno-write-strings -Wno-missing-field-initializers \ + @ERROR_CFLAGS@ -Wno-unused-parameter @GSTREAMER_BASE_CFLAGS@ \ + @GDK_CFLAGS@ @GSTREAMER_CFLAGS@ @GSTREAMER_PLUGINS_BASE_CFLAGS@ diff --git a/libjava/classpath/native/jni/gstreamer-peer/Makefile.in b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in new file mode 100644 index 00000000000..7d752f91f11 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in @@ -0,0 +1,640 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = native/jni/gstreamer-peer +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \ + $(top_srcdir)/../../config/lead-dot.m4 \ + $(top_srcdir)/../../config/multi.m4 \ + $(top_srcdir)/../../config/no-executables.m4 \ + $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \ + $(top_srcdir)/m4/acinclude.m4 \ + $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/ax_func_which_gethostbyname_r.m4 \ + $(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(nativeexeclibdir)" +nativeexeclibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(nativeexeclib_LTLIBRARIES) +libgstreamerpeer_la_DEPENDENCIES = \ + $(top_builddir)/native/jni/classpath/jcl.lo +am_libgstreamerpeer_la_OBJECTS = GStreamerIOPeer.lo gstinputstream.lo \ + gstclasspathsrc.lo +libgstreamerpeer_la_OBJECTS = $(am_libgstreamerpeer_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/../../depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgstreamerpeer_la_SOURCES) +DIST_SOURCES = $(libgstreamerpeer_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@ +BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLASSPATH_CONVENIENCE = @CLASSPATH_CONVENIENCE@ +CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@ +CLASSPATH_MODULE = @CLASSPATH_MODULE@ +COLLECTIONS_PREFIX = @COLLECTIONS_PREFIX@ +CP = @CP@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@ +CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@ +CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@ +CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@ +CREATE_COLLECTIONS_FALSE = @CREATE_COLLECTIONS_FALSE@ +CREATE_COLLECTIONS_TRUE = @CREATE_COLLECTIONS_TRUE@ +CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@ +CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@ +CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@ +CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@ +CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@ +CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@ +CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@ +CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@ +CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@ +CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@ +CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@ +CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@ +CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@ +CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@ +CREATE_PLUGIN_FALSE = @CREATE_PLUGIN_FALSE@ +CREATE_PLUGIN_TRUE = @CREATE_PLUGIN_TRUE@ +CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@ +CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@ +CREATE_WRAPPERS_FALSE = @CREATE_WRAPPERS_FALSE@ +CREATE_WRAPPERS_TRUE = @CREATE_WRAPPERS_TRUE@ +CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@ +CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATE = @DATE@ +DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECJ = @ECJ@ +ECJ_JAR = @ECJ_JAR@ +EGREP = @EGREP@ +ENABLE_LOCAL_SOCKETS_FALSE = @ENABLE_LOCAL_SOCKETS_FALSE@ +ENABLE_LOCAL_SOCKETS_TRUE = @ENABLE_LOCAL_SOCKETS_TRUE@ +ERROR_CFLAGS = @ERROR_CFLAGS@ +EXAMPLESDIR = @EXAMPLESDIR@ +EXEEXT = @EXEEXT@ +FASTJAR = @FASTJAR@ +FGREP = @FGREP@ +FIND = @FIND@ +FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@ +FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@ +FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@ +FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@ +FOUND_JAVAC_FALSE = @FOUND_JAVAC_FALSE@ +FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@ +FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@ +FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@ +FOUND_KJC_FALSE = @FOUND_KJC_FALSE@ +FOUND_KJC_TRUE = @FOUND_KJC_TRUE@ +FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@ +FREETYPE2_LIBS = @FREETYPE2_LIBS@ +GCJ = @GCJ@ +GCONF_CFLAGS = @GCONF_CFLAGS@ +GCONF_LIBS = @GCONF_LIBS@ +GDK_CFLAGS = @GDK_CFLAGS@ +GDK_LIBS = @GDK_LIBS@ +GENINSRC_FALSE = @GENINSRC_FALSE@ +GENINSRC_TRUE = @GENINSRC_TRUE@ +GJDOC = @GJDOC@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@ +GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@ +GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ +GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@ +GSTREAMER_LIBS = @GSTREAMER_LIBS@ +GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@ +GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@ +GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@ +GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ +INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@ +INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@ +INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JAVAC = @JAVAC@ +JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@ +JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@ +JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@ +JAY = @JAY@ +JAY_SKELETON = @JAY_SKELETON@ +JIKES = @JIKES@ +JIKESENCODING = @JIKESENCODING@ +JIKESWARNINGS = @JIKESWARNINGS@ +KJC = @KJC@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDEBUG = @LIBDEBUG@ +LIBICONV = @LIBICONV@ +LIBMAGIC = @LIBMAGIC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBVERSION = @LIBVERSION@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MKDIR = @MKDIR@ +MOC = @MOC@ +MOZILLA_CFLAGS = @MOZILLA_CFLAGS@ +MOZILLA_LIBS = @MOZILLA_LIBS@ +NM = @NM@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ +PANGOFT2_LIBS = @PANGOFT2_LIBS@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PATH_TO_ESCHER = @PATH_TO_ESCHER@ +PATH_TO_GLIBJ_ZIP = @PATH_TO_GLIBJ_ZIP@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PLUGIN_DIR = @PLUGIN_DIR@ +QT_CFLAGS = @QT_CFLAGS@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@ +REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@ +REMOVE = @REMOVE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@ +STRIP = @STRIP@ +USER_CLASSLIB = @USER_CLASSLIB@ +USER_JAVAH = @USER_JAVAH@ +USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@ +USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@ +USE_ESCHER_FALSE = @USE_ESCHER_FALSE@ +USE_ESCHER_TRUE = @USE_ESCHER_TRUE@ +USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@ +USE_PREBUILT_GLIBJ_ZIP_TRUE = @USE_PREBUILT_GLIBJ_ZIP_TRUE@ +VERSION = @VERSION@ +VM_BINARY = @VM_BINARY@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +XSLT_CFLAGS = @XSLT_CFLAGS@ +XSLT_LIBS = @XSLT_LIBS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ZIP = @ZIP@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +default_toolkit = @default_toolkit@ +exec_prefix = @exec_prefix@ +glibjdir = @glibjdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +multi_basedir = @multi_basedir@ +nativeexeclibdir = @nativeexeclibdir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexeclibdir = @toolexeclibdir@ +vm_classes = @vm_classes@ +nativeexeclib_LTLIBRARIES = libgstreamerpeer.la +libgstreamerpeer_la_SOURCES = GStreamerIOPeer.c \ + gstinputstream.c \ + gstclasspathsrc.c \ + gstclasspathsrc.h \ + gstinputstream.h + +libgstreamerpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo +libgstreamerpeer_la_LDFLAGS = $(AM_LDFLAGS) @GST_PLUGIN_LDFLAGS@ -avoid-version +AM_LDFLAGS = @CLASSPATH_MODULE@ @GSTREAMER_LIBS@ @GSTREAMER_BASE_LIBS@ \ + @GSTREAMER_PLUGINS_BASE_LIBS@ @GDK_LIBS@ + +AM_CPPFLAGS = @CLASSPATH_INCLUDES@ + +# We cannot use -Wwrite-strings and the strict flags since +# gstreamer contain broken prototypes (by design). +AM_CFLAGS = @WARNING_CFLAGS@ -Wno-write-strings -Wno-missing-field-initializers \ + @ERROR_CFLAGS@ -Wno-unused-parameter @GSTREAMER_BASE_CFLAGS@ \ + @GDK_CFLAGS@ @GSTREAMER_CFLAGS@ @GSTREAMER_PLUGINS_BASE_CFLAGS@ + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/gstreamer-peer/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu native/jni/gstreamer-peer/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-nativeexeclibLTLIBRARIES: $(nativeexeclib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(nativeexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(nativeexeclibdir)" + @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativeexeclibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(nativeexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativeexeclibdir)/$$f"; \ + else :; fi; \ + done + +uninstall-nativeexeclibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativeexeclibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativeexeclibdir)/$$p"; \ + done + +clean-nativeexeclibLTLIBRARIES: + -test -z "$(nativeexeclib_LTLIBRARIES)" || rm -f $(nativeexeclib_LTLIBRARIES) + @list='$(nativeexeclib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgstreamerpeer.la: $(libgstreamerpeer_la_OBJECTS) $(libgstreamerpeer_la_DEPENDENCIES) + $(LINK) -rpath $(nativeexeclibdir) $(libgstreamerpeer_la_LDFLAGS) $(libgstreamerpeer_la_OBJECTS) $(libgstreamerpeer_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GStreamerIOPeer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstclasspathsrc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gstinputstream.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(nativeexeclibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-nativeexeclibLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-nativeexeclibLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-nativeexeclibLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-nativeexeclibLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-nativeexeclibLTLIBRARIES install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-nativeexeclibLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c new file mode 100644 index 00000000000..afce1f1d4c2 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.c @@ -0,0 +1,332 @@ +/*gstclasspathsrc.c - Class file for the GstClasspathPlugin + Copyright (C) 2007 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +/* + * We don't really use version numbering here, we give it the same version + * number of classpath, so that gstreamer is happy. + * TODO: Maybe this should be moved in config.h instead? + */ +#define CLASSPATH_GST_PLUGIN_VERSION PACKAGE_VERSION + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include <gst/gst.h> +#include <gst/base/gstbasesrc.h> +#include <gst/base/gstpushsrc.h> + +#include <glib.h> +#include <glib/gprintf.h> + +#include <gdk/gdk.h> + +#include "gstclasspathsrc.h" +#include "gstinputstream.h" + +GST_DEBUG_CATEGORY_STATIC (gst_classpath_src_debug); +#define GST_CAT_DEFAULT gst_classpath_src_debug + +enum +{ + ARG_0, + ARG_INPUTSTREAM +}; + +static const GstElementDetails gst_classpath_src_details = +GST_ELEMENT_DETAILS ("ClasspathSrc", + "Source/Network", + "Read from a java input stream", + "Mario Torre <neugens@limasoftware.net>"); + +static GstStaticPadTemplate _template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +/* ***** plugin init ***** */ + +static void +_do_init (GType filesrc_type __attribute__ ((unused))) +{ + GST_DEBUG_CATEGORY_INIT (gst_classpath_src_debug, "classpathsrc", + 0, "classpathsrc"); +} + +GST_BOILERPLATE_FULL (GstClasspathSrc, gst_classpath_src, GstPushSrc, + GST_TYPE_PUSH_SRC, _do_init); + +static gboolean +plugin_init (GstPlugin *plugin) +{ + return gst_element_register (plugin, "classpathsrc", + GST_RANK_NONE, GST_TYPE_CLASSPATH_SRC); +} + +GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "classpathsrc", + "Java InputStream Reader", + plugin_init, CLASSPATH_GST_PLUGIN_VERSION, + GST_LICENSE_UNKNOWN, + "Classpath", "http://www.classpath.org/") + +/* ***** public class methods ***** */ + +static void gst_classpath_src_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); + +static void gst_classpath_src_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +static void gst_classpath_src_finalize (GObject *object); + +static gboolean gst_classpath_src_start (GstBaseSrc *basesrc); + +static gboolean gst_classpath_src_stop (GstBaseSrc *basesrc); + +static GstFlowReturn gst_classpath_src_create (GstPushSrc *src, + GstBuffer **buffer); + +/* ***** public class methods: end ***** */ + +static void +gst_classpath_src_base_init (gpointer gclass) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&_template)); + + gst_element_class_set_details (gstelement_class, &gst_classpath_src_details); +} + +static void +gst_classpath_src_class_init (GstClasspathSrcClass *klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstBaseSrcClass *gstbasesrc_class; + GstPushSrcClass *gstpushsrc_class; + + GParamSpec *pspec; + + gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); + gstbasesrc_class = GST_BASE_SRC_CLASS (klass); + gstpushsrc_class = GST_PUSH_SRC_CLASS (klass); + + /* getter and setters */ + + gobject_class->set_property = gst_classpath_src_set_property; + gobject_class->get_property = gst_classpath_src_get_property; + + /* register properties */ + pspec = g_param_spec_pointer (GST_CLASSPATH_SRC_ISTREAM, + "GstInputStream instance", + "GstInputStream instance", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_INPUTSTREAM, pspec); + + /* register callbacks */ + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_classpath_src_finalize); + + gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_classpath_src_start); + gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_classpath_src_stop); + + gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_classpath_src_create); +} + +/* ***** */ + +static void +gst_classpath_src_init (GstClasspathSrc *src, + GstClasspathSrcClass * g_class __attribute__ ((unused))) +{ + src->istream = NULL; + src->read_position = 0; +} + +static void +gst_classpath_src_finalize (GObject *object) +{ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/* ************************************************************************** */ + +static void +gst_classpath_src_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstClasspathSrc *src; + + g_return_if_fail (GST_IS_CLASSPATH_SRC (object)); + + src = GST_CLASSPATH_SRC (object); + + GST_OBJECT_LOCK (src); + switch (prop_id) + { + case ARG_INPUTSTREAM: + { + GST_STATE_LOCK (src); + { + GstState state; + state = GST_STATE (src); + + if (state != GST_STATE_READY && state != GST_STATE_NULL) + { + GST_DEBUG_OBJECT (src, "setting location in wrong state"); + GST_STATE_UNLOCK (src); + break; + } + } + GST_STATE_UNLOCK (src); + + if (GST_IS_INPUT_STREAM (g_value_get_pointer (value))) + { + src->istream = g_value_get_pointer (value); + } + else + { + GST_INFO_OBJECT (src, "invalid instance of GstInputStream"); + } + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + GST_OBJECT_UNLOCK (src); +} + +static void +gst_classpath_src_get_property (GObject *object, + guint prop_id __attribute__ ((unused)), + GValue *value __attribute__ ((unused)), + GParamSpec *pspec __attribute__ ((unused))) +{ + /* TODO */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/* ************************************************************************** */ + +static GstFlowReturn +gst_classpath_src_create (GstPushSrc *basesrc, + GstBuffer **buffer) +{ + GstClasspathSrc *src; + int read = -1; + + src = GST_CLASSPATH_SRC (basesrc); + + /* create the buffer */ + *buffer = gst_buffer_new_and_alloc (2048); + if (*buffer == NULL) + { + return GST_FLOW_ERROR; + } + + GST_BUFFER_SIZE (*buffer) = 0; + + GST_OBJECT_LOCK (src); + read = gst_input_stream_read (src->istream, (int *) GST_BUFFER_DATA (*buffer), 0, + 2048); + GST_OBJECT_UNLOCK (src); + + if (G_UNLIKELY (read < 0)) + { + gst_buffer_unref (*buffer); + return GST_FLOW_UNEXPECTED; + } + + GST_OBJECT_LOCK (src); + + GST_BUFFER_SIZE (*buffer) = read; + GST_BUFFER_OFFSET (*buffer) = src->read_position; + GST_BUFFER_OFFSET_END (*buffer) = src->read_position + read; + + src->read_position += read; + + GST_OBJECT_UNLOCK (src); + + gst_buffer_set_caps (*buffer, GST_PAD_CAPS (GST_BASE_SRC_PAD (src))); + + return GST_FLOW_OK; +} + +static gboolean +gst_classpath_src_start (GstBaseSrc *basesrc) +{ + GstClasspathSrc *src; + + src = GST_CLASSPATH_SRC (basesrc); + + if (src->istream == NULL) + { + GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), + ("GstInputStream is still null. you need to pass a valid InputStream")); + + return FALSE; + } + GST_OBJECT_LOCK (src); + src->read_position = 0; + GST_OBJECT_UNLOCK (src); + + return TRUE; +} + +static gboolean +gst_classpath_src_stop (GstBaseSrc *basesrc __attribute__ ((unused))) +{ + /* nothing to do */ + return TRUE; +} diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h new file mode 100644 index 00000000000..f5fa6c83d4f --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstclasspathsrc.h @@ -0,0 +1,88 @@ +/*gstclasspathsrc.h - Header file for the GstClasspathPlugin + Copyright (C) 2007 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#ifndef __GST_CLASSPATH_SRC_H__ +#define __GST_CLASSPATH_SRC_H__ + +#include <gst/gst.h> +#include <gst/base/gstpushsrc.h> + +#include "gstinputstream.h" + +G_BEGIN_DECLS + +/* #defines don't like whitespacey bits */ +#define GST_TYPE_CLASSPATH_SRC (gst_classpath_src_get_type()) + +#define GST_CLASSPATH_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CLASSPATH_SRC,GstClasspathSrc)) + +#define GST_CLASSPATH_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CLASSPATH_SRC,GstClasspathSrcClass)) + +#define GST_IS_CLASSPATH_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CLASSPATH_SRC)) + +#define GST_IS_CLASSPATH_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CLASSPATH_SRC)) + +typedef struct _GstClasspathSrc GstClasspathSrc; +typedef struct _GstClasspathSrcClass GstClasspathSrcClass; + +struct _GstClasspathSrc +{ + GstPushSrc element; + + /* TODO: move in a private structure */ + GstInputStream *istream; + int read_position; +}; + +struct _GstClasspathSrcClass +{ + GstPushSrcClass parent_class; +}; + +GType gst_classpath_src_get_type (void); + +/* exported properties */ + +#define GST_CLASSPATH_SRC_ISTREAM "input-stream" + +G_END_DECLS + +#endif /* __GST_CLASSPATH_SRC_H__ */ diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c new file mode 100644 index 00000000000..eb4969682f8 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.c @@ -0,0 +1,494 @@ +/*gstinputstream.c - Header file for the GstClasspathPlugin + Copyright (C) 2007 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#include <jni.h> +#include <jcl.h> + +#include <string.h> +#include <stdlib.h> + +#include <gdk/gdk.h> + +#include <glib.h> +#include <glib/gprintf.h> + +#include "gstinputstream.h" + +struct _GstInputStreamPrivate +{ + JavaVM *vm; + jobject *reader; + + gboolean eof; + guint8 *buffer; + long size; + long length; + + gboolean disposed; +}; + +#define INPUT_STREAM_GET_PRIVATE(o) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_INPUT_STREAM, GstInputStreamPrivate)) + +/* properties */ + +enum +{ + ARG_0, + ARG_JVM, + ARG_READER +}; + +/* ***** */ + +static JNIEnv *gst_input_stream_get_jenv(GstInputStream *self); + +static void gst_input_stream_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); + +static void gst_input_stream_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +static void gst_input_stream_instance_init (GTypeInstance *instance, + gpointer g_class); + +static void gst_input_stream_class_init (gpointer g_class, + gpointer g_class_data); + +static GObject * +gst_input_stream_constructor (GType type, guint n_construct_properties, + GObjectConstructParam *construct_properties); + +static void +gst_input_stream_dispose (GObject *obj); + +static void +gst_input_stream_finalize (GObject *obj); + +/* ************************************************************************** */ + +/* class methods */ + +int +gst_input_stream_read (GstInputStream *self, int *data, int offset, + int length) +{ + /* TODO: cache */ + jmethodID _readID = NULL; + jclass InputStream = NULL; + + JNIEnv *env = NULL; + + int ret = -1; + jbyteArray buffer; + jbyte *bytes = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return -1; + } + + env = gst_input_stream_get_jenv (self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_read failed to get java env"); + return -1; + } + + buffer = (*env)->NewByteArray (env, length); + if (buffer == NULL) + { + g_warning ("GstInputStream::gst_input_stream_read called, failed"); + return -1; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _readID = (*env)->GetMethodID(env, InputStream, "read", "([BII)I"); + if (_readID == NULL) + { + (*env)->DeleteLocalRef(env, buffer); + return -1; + } + + ret = (*env)->CallIntMethod (env, self->priv->reader, _readID, buffer, 0, + length); + if (ret == -1) + { + (*env)->DeleteLocalRef(env, buffer); + return ret; + } + + bytes = (*env)->GetByteArrayElements (env, buffer, NULL); + + /* copy bytes and release */ + memcpy (data + offset, bytes, ret); + + (*env)->ReleaseByteArrayElements (env, buffer, bytes, 0); + (*env)->DeleteLocalRef (env, buffer); + + return ret; +} + +gboolean +gst_input_stream_available (GstInputStream *self, guint64 *size) +{ + /* TODO: caching */ + + jmethodID _availableID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return FALSE; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_available failed to get java env"); + return FALSE; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _availableID = (*env)->GetMethodID(env, InputStream, "available", "()I"); + if (_availableID == NULL) + { + return FALSE; + } + + *size = (*env)->CallIntMethod (env, self->priv->reader, _availableID); + + return TRUE; +} + +void gst_input_stream_reset (GstInputStream *self) +{ + jmethodID _resetID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_reset failed to get java env"); + return; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _resetID = (*env)->GetMethodID(env, InputStream, "reset", "()V"); + if (_resetID == NULL) + { + return; + } + + (*env)->CallVoidMethod (env, self->priv->reader, _resetID); +} + +long gst_input_stream_skip (GstInputStream *self, long size) +{ + jmethodID _seekID = NULL; + jclass InputStream = NULL; + JNIEnv *env = NULL; + + long skipped = -1; + + if (self->priv->disposed || self->priv->vm == NULL || + self->priv->reader == NULL) + { + return skipped; + } + + env = gst_input_stream_get_jenv(self); + if (env == NULL) + { + g_warning("GstInputStream::gst_input_stream_skip failed to get java env"); + return size; + } + + InputStream = (*env)->GetObjectClass(env, self->priv->reader); + _seekID = (*env)->GetMethodID(env, InputStream, "skip", "(J)J"); + if (_seekID == NULL) + { + return skipped; + } + + size = (*env)->CallIntMethod (env, self->priv->reader, _seekID, size); + if (size != 0) + { + return skipped; + } + + return skipped; +} + +gboolean gst_input_stream_can_seek (GstInputStream *self) +{ + if (gst_input_stream_skip(self, 0) != 0) + { + g_warning ("GstInputStream::gst_input_stream_can_seek CANNOT seek"); + return FALSE; + } + + return TRUE; +} + +/* ************************************************************************** */ + +/* getter and setter */ + +static void +gst_input_stream_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GstInputStream *self = GST_INPUT_STREAM (object); + + switch (property_id) + { + case ARG_JVM: + { + self->priv->vm = g_value_get_pointer(value); + } + break; + + case ARG_READER: + { + self->priv->reader = g_value_get_pointer(value); + } + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); + break; + } /* switch */ +} + +static void +gst_input_stream_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GstInputStream *self = GST_INPUT_STREAM (object); + + switch (property_id) + { + case ARG_JVM: + { + g_value_set_pointer (value, self->priv->vm); + } + break; + + case ARG_READER: + { + g_value_set_pointer (value, self->priv->reader); + } + break; + + default: + /* We don't have any other property... */ + G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); + break; + } /* switch */ +} + +/* ************************************************************************** */ + +static void +gst_input_stream_instance_init (GTypeInstance *instance, + gpointer g_class __attribute__ ((unused))) +{ + GstInputStream *self = GST_INPUT_STREAM (instance); + + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GST_TYPE_INPUT_STREAM, + GstInputStreamPrivate); + + self->priv->vm = NULL; + self->priv->reader = NULL; + self->priv->disposed = FALSE; + self->priv->eof = FALSE; + self->priv->buffer = NULL; + self->priv->size = 0; + self->priv->length = 0; +} + +static void +gst_input_stream_class_init (gpointer g_class, + gpointer g_class_data __attribute__ ((unused))) +{ + GObjectClass *gobject_class; + GstInputStreamClass *klass; + GObjectClass *parent_class; + + GParamSpec *pspec; + + gobject_class = G_OBJECT_CLASS (g_class); + klass = GST_INPUT_STREAM_CLASS (g_class); + gobject_class = G_OBJECT_CLASS (g_class); + + g_type_class_add_private (klass, sizeof (GstInputStreamPrivate)); + + gobject_class->set_property = gst_input_stream_set_property; + gobject_class->get_property = gst_input_stream_get_property; + gobject_class->dispose = gst_input_stream_dispose; + gobject_class->finalize = gst_input_stream_finalize; + gobject_class->constructor = gst_input_stream_constructor; + + parent_class = g_type_class_peek_parent (klass); + + /* register properties */ + pspec = g_param_spec_pointer (GST_ISTREAM_JVM, + "Set the java environment property", + "Set the java environment property", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_JVM, pspec); + + pspec = g_param_spec_pointer (GST_ISTREAM_READER, + "Set the java reader property", + "Set the java reader property", + G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, ARG_READER, pspec); + +} + +/* class constructors */ + +static GObject * +gst_input_stream_constructor (GType type, guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GObject *obj; + GObjectClass *parent_class; + + /* parent */ + GstInputStreamClass *klass; + klass = GST_INPUT_STREAM_CLASS (g_type_class_peek (GST_TYPE_INPUT_STREAM)); + parent_class = g_type_class_peek_parent (klass); + obj = parent_class->constructor (type, n_construct_properties, + construct_properties); + return obj; +} + +static void +gst_input_stream_dispose (GObject *obj) +{ + GObjectClass *parent_class; + GstInputStream *self = GST_INPUT_STREAM (obj); + if (self->priv->disposed) + { + /* If dispose did already run, return. */ + return; + } + + /* Make sure dispose does not run twice. */ + self->priv->disposed = TRUE; + + if (self->priv->buffer != NULL) + g_free(self->priv->buffer); + + /* Chain up to the parent class */ + parent_class = g_type_class_peek_parent (GST_INPUT_STREAM_CLASS (obj)); + G_OBJECT_CLASS (parent_class)->dispose (obj); +} + +static void +gst_input_stream_finalize (GObject *obj) +{ + /* nothing else to do */ + GObjectClass *parent_class = + g_type_class_peek_parent (GST_INPUT_STREAM_CLASS (obj)); + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static JNIEnv * +gst_input_stream_get_jenv(GstInputStream *self) +{ + void *env = NULL; + + if ((*self->priv->vm)->GetEnv(self->priv->vm, &env, JNI_VERSION_1_2) != JNI_OK) + { + if ((*self->priv->vm)->AttachCurrentThreadAsDaemon(self->priv->vm, + &env, NULL) < 0) + { + g_warning ("GstInputStream:- env not attached"); + return NULL; + } + } + + return (JNIEnv *) env; +} + +GType gst_input_stream_get_type (void) +{ + static GType type = 0; + + if (type == 0) + { + static const GTypeInfo info = { + sizeof (GstInputStreamClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + gst_input_stream_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GstInputStream), + 0, /* n_preallocs */ + gst_input_stream_instance_init /* instance_init */ + }; + + type = g_type_register_static (G_TYPE_OBJECT, + "GstInputStreamType", + &info, 0); + } + + return type; +} diff --git a/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h new file mode 100644 index 00000000000..1930412fe16 --- /dev/null +++ b/libjava/classpath/native/jni/gstreamer-peer/gstinputstream.h @@ -0,0 +1,99 @@ +/*gstinputstream.h - Header file for the GstClasspathPlugin + Copyright (C) 2007 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#ifndef __GST_INPUT_STREAM_H__ +#define __GST_INPUT_STREAM_H__ + +#include <glib-object.h> + +/* TODO: is a gobject overkill for that? */ + +G_BEGIN_DECLS + +/* #defines don't like whitespacey bits */ +#define GST_TYPE_INPUT_STREAM (gst_input_stream_get_type()) + +#define GST_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INPUT_STREAM,GstInputStream)) + +#define GST_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INPUT_STREAM,GstInputStreamClass)) + +#define GST_IS_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INPUT_STREAM)) + +#define GST_IS_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INPUT_STREAM)) + +typedef struct _GstInputStream GstInputStream; +typedef struct _GstInputStreamClass GstInputStreamClass; +typedef struct _GstInputStreamPrivate GstInputStreamPrivate; + +struct _GstInputStream +{ + GObject parent; + + /* instance members */ + GstInputStreamPrivate *priv; +}; + +struct _GstInputStreamClass +{ + GObjectClass parent_class; +}; + +GType gst_input_stream_get_type (void); + +int gst_input_stream_read (GstInputStream *self, int *data, int offset, + int length); + +gboolean gst_input_stream_available (GstInputStream *self, guint64 *size); + +gboolean gst_input_stream_can_seek (GstInputStream *self); + +long gst_input_stream_skip (GstInputStream *self, long size); + +void gst_input_stream_reset (GstInputStream *self); + +/* exported properties */ + +#define GST_ISTREAM_JVM "vm" +#define GST_ISTREAM_READER "reader" + +G_END_DECLS + +#endif /* __GST_INPUT_STREAM_H__ */ |