How to capture a yuv frame from h.264 stream
glenne
glenne at engel.org
Tue Nov 7 00:29:19 UTC 2017
Here is my current iteration code and an attempt to get an image. My stream
is "videotestsrc ! autovideosink enable-last-buffer=true"
Unfortunately, I always get NULL for from_sample after calling g_object_get.
Do I have an error in my
use of item or does autovideosink not pass on the enable-last-buffer setting
to the sink?
static void take_pic(CustomData *data) {
GstIterator *sink_iterator =
gst_bin_iterate_sinks(GST_BIN(data->pipeline));
GValue item = G_VALUE_INIT;
while (gst_iterator_next (sink_iterator, &item) == GST_ITERATOR_OK)
{
}
GstElement *sink = GST_ELEMENT(g_value_get_object (&item));
g_object_get (sink, "last-sample", &from_sample, (char*)NULL);
if (from_sample == NULL) {
GST_ERROR ("Error getting last sample form sink");
return;
}
GError *err = NULL;
GstCaps *caps = gst_caps_from_string ("image/jpeg");
GstSample *to_sample = gst_video_convert_sample (from_sample, caps,
GST_CLOCK_TIME_NONE, &err);
if (to_sample == NULL) {
GST_ERROR ("Error converting video sample");
return;
}
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list