|
Packit |
0652a1 |
/* GStreamer
|
|
Packit |
0652a1 |
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
Packit |
0652a1 |
*
|
|
Packit |
0652a1 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
0652a1 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
0652a1 |
* License as published by the Free Software Foundation; either
|
|
Packit |
0652a1 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
0652a1 |
*
|
|
Packit |
0652a1 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
0652a1 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
0652a1 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
0652a1 |
* Library General Public License for more details.
|
|
Packit |
0652a1 |
*
|
|
Packit |
0652a1 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
0652a1 |
* License along with this library; if not, write to the
|
|
Packit |
0652a1 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit |
0652a1 |
* Boston, MA 02110-1301, USA.
|
|
Packit |
0652a1 |
*/
|
|
Packit |
0652a1 |
#include <gst/gst.h>
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
static GMainLoop *loop;
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
static void
|
|
Packit |
0652a1 |
error_eos_cb (GstBus * bus, GstMessage * msg, GMainLoop * main_loop)
|
|
Packit |
0652a1 |
{
|
|
Packit |
0652a1 |
g_main_loop_quit (main_loop);
|
|
Packit |
0652a1 |
}
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
gint
|
|
Packit |
0652a1 |
main (gint argc, gchar * argv[])
|
|
Packit |
0652a1 |
{
|
|
Packit |
0652a1 |
GstElement *player;
|
|
Packit |
0652a1 |
GstStateChangeReturn res;
|
|
Packit |
0652a1 |
GstBus *bus;
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
gst_init (&argc, &argv);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
player = gst_element_factory_make ("playbin", "player");
|
|
Packit |
0652a1 |
g_assert (player);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
loop = g_main_loop_new (NULL, TRUE);
|
|
Packit |
0652a1 |
bus = gst_pipeline_get_bus (GST_PIPELINE (player));
|
|
Packit |
0652a1 |
gst_bus_add_signal_watch (bus);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
g_signal_connect (bus, "message::eos", G_CALLBACK (error_eos_cb), loop);
|
|
Packit |
0652a1 |
g_signal_connect (bus, "message::error", G_CALLBACK (error_eos_cb), loop);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
res = gst_element_set_state (player, GST_STATE_PLAYING);
|
|
Packit |
0652a1 |
if (res == GST_STATE_CHANGE_FAILURE) {
|
|
Packit |
0652a1 |
g_print ("could not play\n");
|
|
Packit |
0652a1 |
return -1;
|
|
Packit |
0652a1 |
}
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
g_main_loop_run (loop);
|
|
Packit |
0652a1 |
|
|
Packit |
0652a1 |
return 0;
|
|
Packit |
0652a1 |
}
|