From a3a61f89403cd39fd08f2f1d0e1475f55b0a48f4 Mon Sep 17 00:00:00 2001 From: Filippo Argiolas Date: Fri, 14 Aug 2009 10:11:25 +0200 Subject: [PATCH] v4l2src: clear format list in READY->NULL Clear format list and probed caps when going to NULL so if a new device is set we'll probe the formats again instead of using previously detected ones. Fixes bug #591747. --- sys/v4l2/gstv4l2object.c | 4 ++++ sys/v4l2/gstv4l2src.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index ce6f7c9..f73ce21 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -604,6 +604,10 @@ gst_v4l2_object_stop (GstV4l2Object * v4l2object) if (!gst_v4l2_close (v4l2object)) return FALSE; + if (v4l2object->formats) { + gst_v4l2_object_clear_format_list (v4l2object); + } + return TRUE; } diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index f040051..2f0fef9 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -760,6 +760,11 @@ gst_v4l2src_change_state (GstElement * element, GstStateChange transition) /* close the device */ if (!gst_v4l2_object_stop (v4l2src->v4l2object)) return GST_STATE_CHANGE_FAILURE; + + if (v4l2src->probed_caps) { + gst_caps_unref (v4l2src->probed_caps); + v4l2src->probed_caps = NULL; + } break; default: break; -- 2.7.4