Hello everybody!
I have a little problem in a project of mine that uses a GStreamer pipeline to get a video stream from an IP camera. The pipeline ends with an appsink, where a few image processing is made. The problem is that I cannot detect the video stream resolution because the properties I read does not have meaningful values. Please note that the code was written on GStreamer 0.10, and later moved to GStreamer 1.0, but it was not used for a while, so I cannot say if this problem is due to changing gst-0.10 with gst-1.0 or not. However... In the code I start building the pipeline, which is actually just an uridecodebin plugin. On this plugin "pad-added" signal, I add the app-sink, query the pad caps and inspect the GstStructure to detect what kind of video stream I have to handle. The problem is that the fields in the caps GstStructure seems not have valid values to read. Properties are read with: GstStructure* props = gst_caps_get_structure(caps, 0); and cycled with a for loop on the number of fields (read with gst_structure_n_fields(props)). For each property, I read the fieldname: const gchar* fieldname = gst_structure_nth_field_name(props,j); and then read the value into a variable, according to the field name. For example: if (g_strrstr(fieldname, "width")) { res = gst_structure_get_int(props, fieldname, &width); } The problem is that gst_structure_get_int() returns false, and investigating further I've found that the fields I cannot read are not Int but GstIntRange. However, dumping them with g_strdup_value_contents(gst_structure_get_value(props, fieldname)) showed that their content is useless. For example, the field "width" had content "[1,2147483647]" while "framerate" was "[ 0/1, 2147483647/1 ]". I googled a lot but couldn't find an explanation to this behavior. So, here's my questions: What is the correct way to detect video stream properties with GStreamer 1.0? Am I supposed to do that in the callback that receives the buffers? Can it be done on pad creation? Thank you very much for your help, and sorry for the long mail... Fabrizio Dini _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Once you pulled a sample with gst_app_sink_pull_sample you can extract its
buffer with gst_sample_get_buffer and following get the video frame and video info with gst_video_frame_map. The video info object got the information you're looking for. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Mon, 2018-01-29 at 07:23 -0700, tobatrance wrote:
Hi, > Once you pulled a sample with gst_app_sink_pull_sample you can > extract its buffer with gst_sample_get_buffer and following get the > video frame and video info with gst_video_frame_map. The video info > object got the information you're looking for. That should work. Alternatively, you can also look at the GstCaps in the GstSample with gst_sample_get_caps() and either poke at the fields directly or parse it into a VideoInfo struct with gst_video_info_from_caps(). Or you look at the caps on the element's sink pad with gst_pad_get_current_caps(). Cheers -tim -- Tim Müller, Centricular Ltd - http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi there! Given the way my code has been written, the fastest way to fix this was to change the call GstCaps* queried_caps = gst_pad_query_caps(pad, NULL); with the call GstCaps* queried_caps = gst_pad_get_current_caps(pad); and it worked! Thank you all for your help! Cheers Fabrizio On Mon, Jan 29, 2018 at 3:55 PM, Tim Müller <[hidden email]> wrote: On Mon, 2018-01-29 at 07:23 -0700, tobatrance wrote: Fabrizio Dini Magenta srl - Via Pasquini 6, 50127 Firenze - Italy+39 393 5672224 (mobile) +39 055 286 856 [hidden email] Company web page: www.magentalab.it, trafficflow.magentalab.it _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |