[gst-devel] Summer Of Code Project Help

Vincent Torri vtorri at univ-evry.fr
Fri Apr 13 12:50:03 CEST 2007


Hey,

I wrote a prog that extracts (some of ?) those data from any 
multimedia file (audio or video) 2 years ago. I've attached it.

Basically:
1) I build a basic pipeline : filesrc ! decodebin
2) I set the pipeline to the PAUSED state.
3) Each time a stream is found, I get its properties.

The program has 2 parts :
1) a lib one, that stores the properties
2) a binary one that uses the lib part. I've made a CLI one (no gui) and 3 
gui, one with gtk. You'll have to disable the other gui to compile the 
progs, iirc (or maybe they'll not be built as I think that you don't have 
those toolkits. I can't remember).

That means that you can even use directly the lib part and integrate it to 
your prog if you find it usefull. There is a GNU Copying licence, but I 
think that it has been automatically created. I didn't intend to use the 
GPL.

Or else, you can just look at how I wrote it and get only the audio part 
(as the lib extracts also the video informations)

Example of output with the CLI:

Filename....................: ********.mp3
Size........................: 6,2 MB (or 6305,8 KB, or 6457150 B)
Container...................:  no informations

Streams
  |
  +-Audio stream #0
     +-Mimetype..............: audio/mpeg
     +-Decoder info
     |  |
     |  +-Name...............: mad mp3 decoder
     |  +-Description........: Uses mad code to decode mp3 streams
     |  +-Class..............: Codec/Decoder/Audio
     |  +-Author.............: Wim Taymans <wim at fluendo.com>
     |
     +-Duration..............: 0:04:29.31916666
     +-Sample rate...........: 44100
     +-Sample count..........: 11864307
     +-Channels..............: 2
     +-Endianess.............: 0
     +-Width.................: 32
     +-Depth.................: 32
     +-Signed................: yes

I hope this helps.

Regards,

Vincent Torri

On Fri, 13 Apr 2007, Mario Torre wrote:

> 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/
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
> -- 
> Ce message a été vérifié par MailScanner
> pour des virus ou des polluriels et rien de
> suspect n'a été trouvé.
> Message délivré par le serveur de messagerie de l'Université d'Evry.
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eic-0.1.tar.gz
Type: application/octet-stream
Size: 320468 bytes
Desc: 
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070413/f8b93c82/attachment.obj>


More information about the gstreamer-devel mailing list