gmyth-stream/client/test/main.c
author renatofilho
Thu Apr 19 18:13:51 2007 +0100 (2007-04-19)
branchtrunk
changeset 575 f7351f2fd6d8
parent 525 d616e308f6b6
permissions -rw-r--r--
[svn r580] * Fixed bug on reset element;
* added property max-try for specify number of chances to connect with livtv server;
     1 #include <glib.h>
     2 #include "gmyth-stream-client.h"
     3 
     4 int main (int argc, char** argv)
     5 {
     6     GMythStreamClient *cli = NULL;
     7     gint ret = -1;
     8 
     9     g_type_init ();
    10 
    11     cli = gmyth_stream_client_new ();
    12     if (!gmyth_stream_client_connect (cli, "127.0.0.1", 50000)) {
    13         g_warning ("Fail to connect");
    14         return -1;
    15     }
    16 
    17     ret = gmyth_stream_client_open_stream (cli, "file:///tmp/dvb.mpg",
    18                                           "mpeg", "mpeg1video", 400, 25,
    19                                           "mp2", 192, 320, 240, "format=mpeg1");
    20 
    21     //myth:///tmp/mpg/bad_day.mpg mpeg mpeg1video 400 25 mp2 192 320 240 format=mpeg1
    22 
    23     if (ret < 0) {
    24         g_printerr ("Fail to open stream");
    25         return -1;
    26     }
    27 
    28     g_debug ("Stream created");
    29     g_debug ("Going to PLAY now...");
    30 
    31     gint fd = gmyth_stream_client_play_stream (cli);
    32 
    33     if (fd == -1) {
    34         g_printerr ("Fail to play stream");
    35         return -1;
    36     }
    37 
    38     g_debug ("started");
    39 
    40     gmyth_stream_client_close_stream(cli);
    41     gmyth_stream_client_disconnect(cli);
    42 
    43     g_debug ("finished");
    44 
    45     return 0;
    46 }