[gst-devel] Summer Of Code Project Help

Erwan Masson masson.erwan1 at gmail.com
Fri Apr 13 15:35:25 CEST 2007


Hi,

 Try this in your callback function:
    myInfo = gst_caps_to_string(caps);
    g_print(myInfo);

You will see something like that for a video pipeline in your console:
  video/x-raw-rgb, bpp=(int)16, depth=(int)16, width=(int)640,
height=(int)464, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)1/1,
red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31,
endianness=(int)1234

hope this help you,
Erwan Masson



2007/4/13, Vincent Torri <vtorri at univ-evry.fr>:
>
>
> 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.
> >
> >
> -------------------------------------------------------------------------
> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070413/dbd92fcb/attachment.htm>


More information about the gstreamer-devel mailing list