diff -r d616e308f6b6 -r 4691abcf4f45 gmyth-stream/client/test/main.c --- a/gmyth-stream/client/test/main.c Wed Apr 11 19:34:21 2007 +0100 +++ b/gmyth-stream/client/test/main.c Thu May 03 14:39:25 2007 +0100 @@ -3,37 +3,44 @@ int main (int argc, char** argv) { - GMainLoop *mainloop = NULL; - GMythStreamClient *cli = NULL; - gint id = -1; + GMythStreamClient *cli = NULL; + gint ret = -1; - g_type_init (); + g_type_init (); - mainloop = g_main_loop_new (NULL, FALSE); + cli = gmyth_stream_client_new (); + if (!gmyth_stream_client_connect (cli, "127.0.0.1", 50000)) { + g_warning ("Fail to connect"); + return -1; + } - cli = gmyth_stream_client_new (); - if (!gmyth_stream_client_connect (cli, "localhost", 12345)) { - g_warning ("Fail to connect"); - return -1; - } + ret = gmyth_stream_client_open_stream (cli, "file:///tmp/dvb.mpg", + "mpeg", "mpeg1video", 400, 25, + "mp2", 192, 320, 240, "format=mpeg1"); - id = gmyth_stream_client_open_stream (cli, "/home/rfilho/Media/The.Pursuit.Of.Happyness[2006]DvDrip[Eng]-aXXo/The.Pursuit.Of.Happyness[2006]DvDrip[Eng]-aXXo.avi", - "X", "X", 0, 0, "X", 0, 800, 600, 5000, "X"); - if (id < 0) { - g_printerr ("Fail to open stream"); - return -1; - } + //myth:///tmp/mpg/bad_day.mpg mpeg mpeg1video 400 25 mp2 192 320 240 format=mpeg1 - g_debug ("Strem created [%d]", id); + if (ret < 0) { + g_printerr ("Fail to open stream"); + return -1; + } - if (!gmyth_stream_client_play_stream (cli, id)) { - g_printerr ("Fail to play stream"); - return -1; - } + g_debug ("Stream created"); + g_debug ("Going to PLAY now..."); - g_debug ("started"); - g_main_loop_run (mainloop); - g_debug ("finished"); - - return 0; + gint fd = gmyth_stream_client_play_stream (cli); + + if (fd == -1) { + g_printerr ("Fail to play stream"); + return -1; + } + + g_debug ("started"); + + gmyth_stream_client_close_stream(cli); + gmyth_stream_client_disconnect(cli); + + g_debug ("finished"); + + return 0; }