Hi, I am facing difficulties with the use of gstAppSrc : my idea is to feed the pipeline with buffer that I have already treated from a streaming flow (data are in an avpacket => avPacket.data and avPacket.size....). I've try to follow API explanations and examples to implement my application but i still have a green display... What am I doing wrong? 1 - I have succesfully tested the pipeline with cmd line, 2 - I defined the GstAppSrc's caps... but still not sure... The stream is a mpeg2 video with mepgTS container. 3 - Is it an incompatible format pixel....? 4 - It works with a raw format and the simple pipeline : appsrc -> autovideosink _________________________________________ Here is part of my code : GMainLoop *loop; GstBus *bus; GstElement *pipeline, *appsrc, *demuxer, *decoder, *postprocess, *videosink; loop = g_main_loop_new (NULL, FALSE); /* Create gstreamer elements */ pipeline = gst_pipeline_new ("pipeline"); appsrc = gst_element_factory_make ("appsrc", "app-src"); decoder = gst_element_factory_make ("vdpaumpegdec", "vdpau-decoder"); demuxer = gst_element_factory_make ("mpegtsdemux", "mpeg-demux"); postprocess = gst_element_factory_make ("vdpauvideopostprocess", "vdpau-video-post-process"); videosink = gst_element_factory_make ("vdpausink", "vdpau-sink"); /* set the capabilities of the appsrc element */ GstCaps *caps = gst_caps_new_simple ("video/mpeg", "width", G_TYPE_INT, 720, "height", G_TYPE_INT, 576, "framerate", GST_TYPE_FRACTION, 25, 1, "bpp", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL); gst_app_src_set_caps(GST_APP_SRC(appsrc), caps); /* we add all elements into the pipeline */ /* we link the elements together */ gst_element_link (appsrc, demuxer); gst_element_link_many (decoder, postprocess, videosink, NULL); g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder); /* play */ gst_element_set_state (pipeline, GST_STATE_PLAYING); /* create the buffer */ GstBuffer *buffer = gst_buffer_new(); GST_BUFFER_DATA (buffer) = _avPacket.data; // Data from the original buffer GST_BUFFER_SIZE (buffer) = _avPacket.size; // Size of the original buffer printf("BUFFER_SIZE = %d \n", _avPacket.size); /* push the buffer to pipeline via appsrc */ GstFlowReturn gstFlowReturn = gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer); /* and loop... */ g_main_loop_run (loop); /* clean up */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); ________________________________________________ Thanks for your help! _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
To precise my problem, here is the result of the GST_DEBUG :
2023.68 Kbps 13 frames received 6.31579 fps Decoding... Media type video/mpeg, systemstream=(boolean)false, mpegversion=(int)2, framerate=(fraction)25/1, width=(int)720, height=(int)576 found, probability 100% 0:00:01.858608759 18267 0x23f4550 WARN basevideodecoder gstbasevideodecoder.c:664:gst_base_video_decoder_chain: Received buffer without a new-segment. Assuming timestamps start from 0. 2081.5 Kbps 14 frames received 6.5 fps Decoding... Media type video/mpeg, systemstream=(boolean)false, mpegversion=(int)2, framerate=(fraction)25/1, width=(int)720, height=(int)576 found, probability 100% 0:00:02.038699964 18267 0x23f4550 WARN basevideodecoder gstbasevideodecoder.c:664:gst_base_video_decoder_chain: Received buffer without a new-segment. Assuming timestamps start from 0. 0:00:02.038733007 18267 0x23f4550 ERROR basevideodecoder gstbasevideodecoder.c:677:gst_base_video_decoder_chain: new segment event ret=0 0:00:02.038752871 18267 0x23f4550 WARN basesrc gstbasesrc.c:2582:gst_base_src_loop:<app-src> error: Erreur interne de flux de données. 0:00:02.038761733 18267 0x23f4550 WARN basesrc gstbasesrc.c:2582:gst_base_src_loop:<app-src> error: streaming task paused, reason error (-5) The code I used :
printf("Accelerated vdpau decoding from appsrc...\n"); // Gstreamer initialisation gst_init (NULL, NULL); GMainLoop *loop; GstBus *bus; GstElement *pipeline, *appsrc, *demuxer, *decoder, *postprocess, *videosink, *typefind; loop = g_main_loop_new (NULL, FALSE); //Create gstreamer elements pipeline = gst_pipeline_new ("pipeline"); appsrc = gst_element_factory_make ("appsrc", "app-src"); // VDPAU traitement : decoder = gst_element_factory_make ("vdpaumpegdec", "vdpau-decoder"); postprocess = gst_element_factory_make ("vdpauvideopostprocess", "vdpau-video-post-process"); videosink = gst_element_factory_make ("vdpausink", "vdpau-sink"); // detection elements typefind = gst_element_factory_make ("typefind", "typefinder"); g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), loop); if (!pipeline || !appsrc || !decoder || !videosink || !typefind || !postprocess) { g_printerr ("One element could not be created. Exiting.\n"); return -1; } /* we add a message handler */ bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_add_watch (bus, bus_call, loop); gst_object_unref (bus); /* set the capabilities of the appsrc element */ GstCaps *caps = gst_caps_new_simple ("video/mpeg", "systemstream", G_TYPE_BOOLEAN, false, "mpegversion", G_TYPE_INT, 2, "framerate",GST_TYPE_FRACTION,25,1, "width",G_TYPE_INT,720, "height",G_TYPE_INT,576, NULL); gst_app_src_set_caps(GST_APP_SRC(appsrc), caps); /* we add all elements into the pipeline */ gst_bin_add_many (GST_BIN (pipeline), appsrc, typefind, decoder, postprocess, videosink, NULL); gst_element_link_many(appsrc, typefind, decoder, postprocess, videosink, NULL); /* play */ printf("Now playing...\n"); gst_element_set_state (pipeline, GST_STATE_PLAYING); /* create the buffer */ int BUFFER_SIZE = _avPacket.size; GstBuffer *buffer = gst_buffer_new(); GST_BUFFER_DATA (buffer) = _avPacket.data; GST_BUFFER_SIZE (buffer) = BUFFER_SIZE; /* push the buffer to pipeline via appsrc */ GstFlowReturn gstFlowReturn = gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer); printf("Return flow value = %d \n", gstFlowReturn); /* and loop... */ g_main_loop_run (loop); /* clean up */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |