[gstreamer-bugs] [Bug 549171] appsrc for video/audio recorder

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Tue Sep 9 06:28:32 PDT 2008


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=549171

  GStreamer | gst-plugins-bad | Ver: 0.10.11

Yan Chang changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |UNCONFIRMED




------- Comment #4 from Yan Chang  2008-09-09 13:28 UTC -------

thanks you result.

There days I try to find out , where is worg, but i am failed. 

But I see gst_app_src_push_buffer result are GST_FLOW_OK. Please such pipeline
, it stilln't work good.

static gboolean write_frame(GstElement* appsrc)
{
    GstBuffer *buf;
    GstFlowReturn ret;
    char tmpbuf[176*144*2] = {0};
    buf = gst_app_buffer_new(tmpbuf, 176*144*2, gst_app_buf_free, tmpbuf);
    if( (ret = gst_app_src_push_buffer(GST_APP_SRC (appsrc), buf) )!=
GST_FLOW_OK)
    {
        printf("gst_buf push data error value is %d  \n", ret);
    }
    else
    {
        printf("gst buf pust data ok\n");
    }
    return TRUE;
}
static gpointer camera_capture_thread(gpointer data)
{
    do
    {
        if(g_quit)
        {
            break;
        }
        write_frame(data);
        usleep(200000);
    }while(1);

    g_thread_exit(NULL);
}

int main(int argc, char** argv)
{
    GMainLoop *mainloop;
    GstElement* pipeline;

    g_type_init();
    g_thread_init(NULL);
    gst_init(&argc, &argv);

   pipeline = gst_parse_launch("appsrc name=v_src ! ffmpegcolorspace !
ffenc_h263 name=v_enc ! ffmux_3gp name=mux location=test.3gp alsasrc name=a_src
!  audio/x-raw-int,channels=1,rate=8000 ! audioresample ! amrnbenc name=a_enc 
a_enc. ! mux. mux. ! filesink location=test.3gp", NULL);

    GstElement* v_src = gst_bin_get_by_name(GST_BIN(pipeline), "v_src");
    GstElement* a_src = gst_bin_get_by_name(GST_BIN(pipeline), "a_src");
    GstCaps* caps = gst_caps_from_string("video/x-raw-rgb, width=(int)176,
height=(int)144, framerate=  (fraction)25/2, bpp=(int)16, depth=(int)16,
red_mask=(int)63488, green_mask=(int)2016,
blue_mask=(int)31,endianness=(int)1234");

    gst_app_src_set_caps(GST_APP_SRC(v_src), caps);
    if(gst_element_set_state (pipeline, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE)
    {
    }

    GThread* capture_thread = g_thread_create(camera_capture_thread, v_src,
TRUE, NULL);

    sleep(10);
    g_quit = 1;

  if(gst_element_set_state (GST_ELEMENT(a_src), GST_STATE_NULL) ==
GST_STATE_CHANGE_FAILURE)
    {
    }
    gst_app_src_end_of_stream(GST_APP_SRC(v_src));
    if(gst_element_set_state (GST_ELEMENT(v_src), GST_STATE_NULL) ==
GST_STATE_CHANGE_FAILURE)
    {

    }

    if(gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_NULL) ==
GST_STATE_CHANGE_FAILURE)
    {

    }

    gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);

}


I run this programe , I found I only get audio data, at sleep time.   and i
could get appsrc data untill gst_element_set_state (GST_ELEMENT(a_src),
GST_STATE_NULL) 
is do.

THANK YOU VERY MUCH. 


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=549171.




More information about the Gstreamer-bugs mailing list