//#include <QCoreApplication>
//#include <QtCore>
#include <stdlib.h>
#include <stdio.h>
#include <libsoup/soup.h>
#include "gst/gst.h"


int main(int argc, char *argv[])
{
    //QCoreApplication a(argc, argv);
    gst_init(&argc,&argv);
    GType type = SOUP_TYPE_PROXY_RESOLVER_DEFAULT;
    g_print ("%d\n", (int) sizeof (GType));
    g_print ("%d\n", (int) sizeof (void *));
    g_print ("%s\n", g_type_name (type));
    GMainLoop *loop;
    GstElement *source, *sink, *pipe;
    loop=g_main_loop_new(NULL,FALSE);
    pipe = gst_pipeline_new("pipe");
    source = gst_element_factory_make("souphttpsrc","http_src");
    sink = gst_element_factory_make("fakesink","sink");
    if (!source || !sink || !pipe){
        g_print("Error creating elements\n");
        return 1;
    }
    g_object_set(source,"location","http://admin:password@192.168.2.251:12011/stream?want_rec_quality=1","is-live",TRUE,"timeout",(guint)10,"ssl-strict",FALSE,NULL);
    gst_bin_add_many(GST_BIN(pipe),source,sink,NULL);
    if (!gst_element_link_many(source,sink,NULL)){
        g_print("Error linking elements\n");
        return 1;
    }
    gst_element_set_state(pipe,GST_STATE_PLAYING);
    g_print("pipeline started\n");
    //return a.exec();
    g_main_loop_run(loop);
    gst_object_unref(pipe);
    g_main_loop_unref(loop);
    return 0;
}
