1.1 --- a/gmyth-stream/client/test/main.c Wed Apr 11 19:34:21 2007 +0100
1.2 +++ b/gmyth-stream/client/test/main.c Thu Apr 12 21:17:33 2007 +0100
1.3 @@ -3,37 +3,44 @@
1.4
1.5 int main (int argc, char** argv)
1.6 {
1.7 - GMainLoop *mainloop = NULL;
1.8 - GMythStreamClient *cli = NULL;
1.9 - gint id = -1;
1.10 + GMythStreamClient *cli = NULL;
1.11 + gint ret = -1;
1.12
1.13 - g_type_init ();
1.14 + g_type_init ();
1.15
1.16 - mainloop = g_main_loop_new (NULL, FALSE);
1.17 + cli = gmyth_stream_client_new ();
1.18 + if (!gmyth_stream_client_connect (cli, "127.0.0.1", 50000)) {
1.19 + g_warning ("Fail to connect");
1.20 + return -1;
1.21 + }
1.22
1.23 - cli = gmyth_stream_client_new ();
1.24 - if (!gmyth_stream_client_connect (cli, "localhost", 12345)) {
1.25 - g_warning ("Fail to connect");
1.26 - return -1;
1.27 - }
1.28 + ret = gmyth_stream_client_open_stream (cli, "file:///tmp/dvb.mpg",
1.29 + "mpeg", "mpeg1video", 400, 25,
1.30 + "mp2", 192, 320, 240, "format=mpeg1");
1.31
1.32 - 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",
1.33 - "X", "X", 0, 0, "X", 0, 800, 600, 5000, "X");
1.34 - if (id < 0) {
1.35 - g_printerr ("Fail to open stream");
1.36 - return -1;
1.37 - }
1.38 + //myth:///tmp/mpg/bad_day.mpg mpeg mpeg1video 400 25 mp2 192 320 240 format=mpeg1
1.39
1.40 - g_debug ("Strem created [%d]", id);
1.41 + if (ret < 0) {
1.42 + g_printerr ("Fail to open stream");
1.43 + return -1;
1.44 + }
1.45
1.46 - if (!gmyth_stream_client_play_stream (cli, id)) {
1.47 - g_printerr ("Fail to play stream");
1.48 - return -1;
1.49 - }
1.50 + g_debug ("Stream created");
1.51 + g_debug ("Going to PLAY now...");
1.52
1.53 - g_debug ("started");
1.54 - g_main_loop_run (mainloop);
1.55 - g_debug ("finished");
1.56 -
1.57 - return 0;
1.58 + gint fd = gmyth_stream_client_play_stream (cli);
1.59 +
1.60 + if (fd == -1) {
1.61 + g_printerr ("Fail to play stream");
1.62 + return -1;
1.63 + }
1.64 +
1.65 + g_debug ("started");
1.66 +
1.67 + gmyth_stream_client_close_stream(cli);
1.68 + gmyth_stream_client_disconnect(cli);
1.69 +
1.70 + g_debug ("finished");
1.71 +
1.72 + return 0;
1.73 }