Hi. I want to accept the buffer from a custom
buffer and transfer it to a gst-rtsp-server. So, I am using appsrc, to do this.
Using a code similar to below, I was able to write to a file. For this, I need
the pipeline (as a GstElement) which is being executed by the
gst_rtsp_media_facory_set_launch (factory, string), so that I can procure the
appsrc element, bus, and change the state of the pipeline. I have tried using a similar code and
writing to a file via filesink and it worked successfully. Can someone help me out in getting the
pipeline (appsrc ! rtpmp4vpay) as a GstElement???? Is there any other way to
achieve this??? I am aware that the GstRTSPMedia has a pipeline, but I am
unable to get it. The code that I am using (I am mentioning
the most important part of the code only. The complete code is there in the attached
appsrc_rtspserver.txt) is: typedef struct { GstElement *pipeline; GstElement *source; guint source_id; } AppData; GstRTSPServer *server; GstRTSPMediaFactory *factory; GstRTSPMediaMapping *mapping; server = gst_rtsp_server_new (); factory = gst_rtsp_media_factory_new (); gst_rtsp_media_factory_set_shared
(factory, TRUE); gchar *string = NULL; string = g_strdup_printf ("(appsrc
is-live=TRUE name=source caps=\"%s\" ! rtpmp4vpay pt=96 name=pay0
)", video_caps); gst_rtsp_media_factory_set_launch
(factory, string); g_free (string); AppData *app = NULL; GstBus *bus = NULL; GstElement *appsrc = NULL; gst_init (NULL, NULL); app = g_new0 (AppData, 1); /*app->pipeline
=
;*/ /* I need the pipeline for this */ if (app->pipeline == NULL) { g_print ("Bad
pipeline\n"); } appsrc = gst_bin_get_by_name
(GST_BIN (app->pipeline), "source"); /* configure for time-based format
*/ g_object_set (appsrc,
"format", GST_FORMAT_TIME, NULL); /* setting maximum of bytes queued.
default is 200000 */
gst_app_src_set_max_bytes((GstAppSrc *)appsrc, QUEUED_FRAMES * BUFFER_SIZE); /* uncomment the next line to block
when appsrc has buffered enough */ /* g_object_set (appsrc,
"block", TRUE, NULL); */ app->source = appsrc; bus = gst_element_get_bus
(app->pipeline); gst_bus_add_watch (bus,
(GstBusFunc) on_pipeline_message, app); gst_element_set_state
(app->pipeline, GST_STATE_PLAYING); GstBuffer *app_buffer; GstFlowReturn ret; /* While (Infinite loop) */ /* Procuring of the custom buffer (we) */ app_buffer = gst_app_buffer_new
(we.encodedBuffer, we.frameSize, g_free, we.encodedBuffer); gst_buffer_set_caps (app_buffer,
gst_caps_from_string (video_caps)); GST_BUFFER_TIMESTAMP(app_buffer) =
(GstClockTime)((we.timestamp) * 1e6); g_signal_emit_by_name
(app->source, "push-buffer", app_buffer, &ret); /* end of infinite loop */ Thanks in advance. Regards, Neel. ------------------------------------------------------------------------------ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel appsrc_rtspserver.txt (4K) Download Attachment |
Hi. Someone please help. I am stuck with this since
quite some time. Thanks. Regards, Neel. From: Hi. I want to accept the buffer from a custom
buffer and transfer it to a gst-rtsp-server. So, I am using appsrc, to do this.
Using a code similar to below, I was able to write to a file. For this, I need the
pipeline (as a GstElement) which is being executed by the
gst_rtsp_media_facory_set_launch (factory, string), so that I can procure the
appsrc element, bus, and change the state of the pipeline. I have tried using a similar code and
writing to a file via filesink and it worked successfully. Can someone help me out in getting the
pipeline (appsrc ! rtpmp4vpay) as a GstElement???? Is there any other way to
achieve this??? I am aware that the GstRTSPMedia has a pipeline, but I am
unable to get it. The code that I am using (I am mentioning
the most important part of the code only. The complete code is there in the
attached appsrc_rtspserver.txt) is: typedef struct { GstElement *pipeline; GstElement *source; guint source_id; } AppData; GstRTSPServer *server; GstRTSPMediaFactory *factory; GstRTSPMediaMapping *mapping; server = gst_rtsp_server_new (); factory = gst_rtsp_media_factory_new (); gst_rtsp_media_factory_set_shared
(factory, TRUE); gchar *string = NULL; string = g_strdup_printf ("(appsrc is-live=TRUE
name=source caps=\"%s\" ! rtpmp4vpay pt=96 name=pay0 )",
video_caps); gst_rtsp_media_factory_set_launch
(factory, string); g_free (string); AppData *app = NULL; GstBus *bus = NULL; GstElement *appsrc = NULL; gst_init (NULL, NULL); app = g_new0 (AppData, 1); /*app->pipeline
=
;*/ /* I need the pipeline for this */ if (app->pipeline == NULL) { g_print ("Bad
pipeline\n"); } appsrc = gst_bin_get_by_name
(GST_BIN (app->pipeline), "source"); /* configure for time-based format
*/ g_object_set (appsrc,
"format", GST_FORMAT_TIME, NULL); /* setting maximum of bytes queued.
default is 200000 */
gst_app_src_set_max_bytes((GstAppSrc *)appsrc, QUEUED_FRAMES * BUFFER_SIZE); /* uncomment the next line to block
when appsrc has buffered enough */ /* g_object_set (appsrc,
"block", TRUE, NULL); */ app->source = appsrc; bus = gst_element_get_bus
(app->pipeline); gst_bus_add_watch (bus,
(GstBusFunc) on_pipeline_message, app); gst_element_set_state (app->pipeline,
GST_STATE_PLAYING); GstBuffer *app_buffer; GstFlowReturn ret; /* While (Infinite loop) */ /* Procuring of the custom buffer (we) */ app_buffer = gst_app_buffer_new
(we.encodedBuffer, we.frameSize, g_free, we.encodedBuffer); gst_buffer_set_caps (app_buffer,
gst_caps_from_string (video_caps)); GST_BUFFER_TIMESTAMP(app_buffer) =
(GstClockTime)((we.timestamp) * 1e6); g_signal_emit_by_name
(app->source, "push-buffer", app_buffer, &ret); /* end of infinite loop */ Thanks in advance. Regards, Neel. ------------------------------------------------------------------------------ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel appsrc_rtspserver.txt (4K) Download Attachment ATT00001.txt (112 bytes) Download Attachment ATT00002.txt (260 bytes) Download Attachment |
Coming a little late..however if anyone would be interested, a possible solution is posted here:
http://gstreamer-devel.966125.n4.nabble.com/GstAppSrc-and-GstRTSPServer-td4656822.html#a4656872 Regards, rezils |
Free forum by Nabble | Edit this page |