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