Play multiple files one after the other

ge_keep pcouliba at yahoo.com
Wed Mar 4 08:04:09 PST 2015


I am writing a test gstreamer code to play 2 files one after the other. I
guess the best way to do that is to call couple GST APIs in the a callback
function when EOS (GST_MESSAGE_EOS) happens. 

*But I am not sure how to keep the current pipeline open, remove the current
file(object) that just reached EOS and add the next file to play.
*
Can anyone suggests steps and gstreamer APIs to call in sequence to achieve
this?

*Let say I am playing file1.wav and got EOS message in the callback
function, what should I do to replace file1.wav with file2.wav and start
playing file2.wav???
*
Here is my callback function:

gboolean my_bus_callback (GstBus *bus, GstMessage *message, gpointer data)
{
	g_print ("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));

	switch (GST_MESSAGE_TYPE (message)) {

	case GST_MESSAGE_EOS:
		/* end-of-stream for file1.wav */
		
               */* Now setup to play next file file2.wav */
		/* THIS IS WHERE I NEED HELP */*
		
         break;

	case GST_MESSAGE_ERROR: {
		GError *err;
		gchar *debug;
		gst_message_parse_error (message, &err, &debug);
		g_print ("Error: %s\n", err->message);
		g_error_free (err);
		g_free (debug);
		g_main_loop_quit (loop);
	break;
	}
	default:
		/* unhandled message */
		break;
	}
return TRUE;
}



And in my main function, this is how I have started playing the first file:
//////////////////////////////////////////////////
	/* set up */
	play = gst_element_factory_make ("playbin", "play");
	g_object_set (G_OBJECT (play), "uri", argv[1], NULL);
	bus = gst_pipeline_get_bus (GST_PIPELINE (play));
	gst_bus_add_watch (bus, my_bus_callback, loop);
	gst_object_unref (bus);
	gst_element_set_state (play, GST_STATE_PLAYING);
	g_print ("Gst Init and Setup are Done\n");
      
       /* now Playback Audio */
	g_print ("Start Audio now\n");
	g_main_loop_run (loop);
//////////////////////////////////////////////////////////



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Play-multiple-files-one-after-the-other-tp4670981.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list