Home > C > Gstreamer – to use for media

Gstreamer – to use for media

#include <gst/gst.h>
#include <stdio.h>

int main (int argc, char *argv[])
{
/* Always initialize stuff. You’re never sure what value will the variable
* take! */

gchar *nano_str = NULL; /* No longer const otherwise you won’t be able to
* modify it. */
guint major = 0;
guint minor = 0;
guint micro = 0;
guint nano = 0;

gst_init (&argc, &argv);
gst_version (&major, &minor, &micro, &nano);
if (nano == 1)
nano_str = “(CVS)”;
else if (nano == 2)
nano_str = “(Prerelease)”;
else
nano_str = “”;

printf (“This program is linked against GStreamer %d.%d.%d %s\n”,
major, minor, micro, nano_str);
return 0;
}

[root@example CppApplication_1]# gcc main.c -o main -Wall `pkg-config –cflags –libs gstreamer-0.10`
[root@example CppApplication_1]# ls
build  dist  main  main.c  Makefile  nbproject
[root@example CppApplication_1]# ./main
This program is linked against GStreamer 0.10.29
[root@example CppApplication_1]#

 

 

Option 2:

[sun@example ~]$ cd /tmp

[sun@example tmp]$ gst-launch pulsesrc ! filesink location=dump.rawSetting pipeline to PAUSED …Pipeline is live and does not need PREROLL …Setting pipeline to PLAYING …New clock: GstAudioSrcClock
^CCaught interrupt — handling interrupt.Interrupt: Stopping pipeline …Execution ended after 40181185781 ns.Setting pipeline to PAUSED …Setting pipeline to READY …Setting pipeline to NULL …Freeing pipeline …

[sun@example tmp]$ gst-launch pulsesrc ! audioconvert ! vorbissenc ! oggmux ! filesink location=dump.ogg

WARNING: erroneous pipeline: no element “vorbissenc”

[sun@example tmp]$ gst-launch pulsesrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=dump.oggSetting pipeline to PAUSED …Pipeline is live and does not need PREROLL …Setting pipeline to PLAYING …New clock: GstAudioSrcClock
^CCaught interrupt — handling interrupt.Interrupt: Stopping pipeline …Execution ended after 23210724917 ns.Setting pipeline to PAUSED …Setting pipeline to READY …Setting pipeline to NULL …Freeing pipeline …

[sun@example tmp]$

 

Advertisements
Categories: C
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: