Find the answer to your Linux question:
Results 1 to 2 of 2
I have realized the function about capturing the picture and transmit it by the command line gst-launch ~but now i want to realize it by a farsight problem~but it has ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    5

    hi~farsight problem:)


    I have realized the function about capturing the picture and transmit it by the command line gst-launch ~but now i want to realize it by a farsight problem~but it has many faults i can not solve these~
    If i can have your help ,it is my greatest honor.
    my program is as following :


    #include <gst/gst.h>


    GstElement *main_pipe;
    static gboolean
    bus_call (GstBus *bus,
    GstMessage *msg,
    gpointer data)
    {
    GMainLoop *loop = data;

    switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_EOS:
    g_print ("End-of-stream\n");
    g_main_loop_quit (loop);
    break;
    case GST_MESSAGE_ERROR: {
    gchar *debug;
    GError *err;

    gst_message_parse_error (msg, &err, &debug);
    g_free (debug);

    g_print ("Error: %s\n", err->message);
    g_error_free (err);

    g_main_loop_quit (loop);
    break;
    }
    default:
    break;
    }

    return TRUE;
    }


    int main(int argc,char ** argv)
    {

    GMainLoop *loop;
    //GstBus *bus;
    loop = g_main_loop_new (NULL, FALSE);
    main_pipe = gst_parse_launch("v4lsrc ! videoscale ! video/x-raw-yuv,width=352,height=288 ! videorate ! video/x-raw-yuv,framerate=20/1 ! videobalance brightness=0.3 contrast=1.5 ! ffmpegcolorspace ! ffenc_h263p ! rtph263ppay ! udpsink host=192.168.1.112 port=5000",NULL);

    //bus = gst_pipeline_get_bus (GST_PIPELINE (main_pipe));
    //gst_bus_add_watch (bus, bus_call, loop);
    //gst_object_unref (bus);

    gst_element_set_state (GST_ELEMENT (main_pipe), GST_STATE_PLAYING);
    //gst_element_set_state (p1, GST_STATE_READY);


    //while (gst_bin_iterate (GST_BIN (main_pipe)));
    g_main_loop_run (loop);

    g_print ("Returned, stopping playback\n");
    gst_element_set_state (main_pipe, GST_STATE_NULL);
    g_print ("Deleting pipeline\n");
    gst_object_unref (GST_OBJECT (main_pipe));


    /* 停止管道处理流程 */
    //gst_element_set_state (main_pipe, GST_STATE_NULL);

    /* 释放占用的资源 */
    //gst_object_unref (GST_OBJECT (main_pipe));
    return 0;


    //gst_element_set_state (GST_ELEMENT (main_pipe), GST_STATE_NULL);


    //g_print ("Normal Program Termination\n");


    //exit (0);
    }



    I can compile the program but when running the faults is so many:


    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

    (process:10259): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed

    (process:10259): GStreamer-CRITICAL **: gst_object_ref: assertion `object != NULL' failed

    (process:10259): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.16.3/gobject/gtype.c:2248: initialization assertion failed, use IA__g_type_init() prior to this function

    (process:10259): GStreamer-CRITICAL **: gst_object_sink: assertion `GST_IS_OBJECT (object)' failed

  2. #2
    Just Joined!
    Join Date
    Nov 2007
    Posts
    5
    main_pipe = gst_parse_launch("v4lsrc ! videoscale ! video/x-raw-yuv,width=352,height=288 ! videorate ! video/x-raw-yuv,framerate=20/1 ! videobalance brightness=0.3 contrast=1.5 ! ffmpegcolorspace ! ffenc_h263p ! rtph263pay",NULL);


    udp_sink = gst_element_factory_make ("udpsink", "udp_sink");

    g_object_set (G_OBJECT (udp_sink), "host",receiveclientaddr, NULL);
    //receiveclientaddr is the buf to store the client's ip address.
    g_object_set (G_OBJECT (udp_sink),"post","5000",NULL);
    //g_assert (udp_sink != NULL);
    gst_element_get_pad(udp_sink, "sink");

    gst_bin_add (GST_BIN (main_pipe), udp_sink);

    gst_element_set_state (GST_ELEMENT (main_pipe), GST_STATE_PLAYING);

    thanks agains.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •