You can also install the following GST plugins:
Gstreamer0.10-tools
Gstreamer0.10-x
Gstreamer0.10-plugins-base
Gstreamer0.10-plugins-good
gstreamer0.10-plugins-ugly
Gstreamer0.10-plugins-bad
Gstreamer0.10-ffmpeg
Gstreamer0.10-alsa
Gstreamer0.10-schroedinger
Gstreamer0.10-pulseaudio
There may be software that needs to be installed:
sudo apt-get install Bison
sudo apt-get install Flex
sudo apt-get install zlib1g
Mad Decode Plugin
Apt-get Install Libmad0-dev
Apt-get Install gstreamer0.10-plugins-ugly
Second, GStreamer test code
#include <stdio.h>
#include <gst/gst.h>
int main (int argc, char *argv[])
{
Const Gchar *NANO_STR;
Guint major, minor, Micro, nano;
Third, command line MP3 player test
#include <gst/gst.h>
#include <glib.h>
Define the message handler function,
Static Gboolean Bus_call (Gstbus *bus,gstmessage *msg,gpointer data)
{
Gmainloop *loop = (Gmainloop *) data;//This is a pointer to the main loop that exits the loop when the EOS message is accepted
Switch (Gst_message_type (msg))
{
Case Gst_message_eos:
G_print ("End of stream\n");
G_main_loop_quit (loop);
Break
Case GST_MESSAGE_ERROR:
{
Gchar *debug;
Gerror *error;
Gst_message_parse_error (Msg,&error,&debug);
G_free (Debug);
G_printerr ("error:%s\n", error->message);
G_error_free (Error);
G_main_loop_quit (loop);
Break
}
Default
Break
}
return TRUE;
}
int main (int argc,char *argv[])
{
Gmainloop *loop;
Gstelement *pipeline,*source,*decoder,*sink;//Defining components
Gstbus *bus;
Gst_init (&ARGC,&ARGV);
loop = G_main_loop_new (null,false);//create main loop, formally start loop after executing G_main_loop_run
Add components to the pipeline. A pipeline is a special component that allows for better flow of data
Gst_bin_add_many (Gst_bin (pipeline), source,decoder,sink,null);
Connecting components in turn
Gst_element_link_many (Source,decoder,sink,null);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.