[gst-devel] Summer Of Code Project Help
Mario Torre
neugens at limasoftware.net
Fri Apr 13 12:27:08 CEST 2007
Hello!
My project for the Google Summer Of Code was accepted as part of the GNU
Project:
http://code.google.com/soc/gnu/appinfo.html?csaid=FDB6DFFB07FE351C
As I said in an earlier mail, my task is to hook GStreamer into GNU
Classpath.
Now, I've found a problem that is blocking me from a couple days and is
taking me away all my sleep :)
I need to write a (Java) class that displays this kind of information
about an audio file:
* Encoding type
* Sample rate
* Sample size in bits
* Channels
* Frame size
* Frame rate
* Endiannes
* Header size
Of course, I could just add a reader for any given kind of audio file,
but then this is pointless to have a gstreamer hook that can recognize
(almost) any type given the right plugin.
My problem is that I can't find an example of how to parse a file and
extract this data (I need to do that in C, not Java). The program should
return as soon as all these info are retrieved (if possible). I've see
the Discover class from the python bindings (which seems to be what I'm
looking for), but I hate to admit that I was unable to recreate its
behaviour, though I think I'm on the correct way. What I'm doing is this
(to see what capabilities an element has), I get a typefind element and
attach a signal handler to it, but this seems to be not enough, and all
the output I get is:
-----
application/ogg
print_pad
size of caps: 1
fields in structure: 0
-----
[...]
g_signal_connect (G_OBJECT (typefind), "have-type",
G_CALLBACK (have_type_callback), loop);
[...]
gboolean have_type_callback(GstElement *typefind,
guint probability,
const GstCaps *caps,
gpointer data)
{
[...]
GstStructure *st = NULL;
int size = 0;
g_fprintf (stderr, "print_pad\n");
size = gst_caps_get_size (caps);
g_fprintf (stderr, "size of caps: %d\n", size);
for (int j = 0; j < size; j++) {
st = gst_caps_get_structure (caps, j);
if (st != NULL) {
size = gst_structure_n_fields (st);
g_fprintf (stderr, "fields in structure: %d\n", size);
for (int i = 0; i < size; i++) {
g_fprintf (stderr, "field name: %s\n",
gst_structure_nth_field_name(st, i));
}
}
}
[...]
}
I'm a bit new to all that, so forgive me if I'm doing some incredibly
stupid mistake :)
Thanks for all the help,
Mario
--
Lima Software - http://www.limasoftware.net/
GNU Classpath Developer - http://www.classpath.org/
Jabber: neugens at jabber.org - Profile: http://www.gtalkprofile.com/profile/9661.html
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/
More information about the gstreamer-devel
mailing list