diff --git a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c index 0005e690e0..d97767cd17 100644 --- a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c +++ b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.c @@ -1825,10 +1825,20 @@ gst_video_flip_sink_event (GstBaseTransform * trans, GstEvent * event) break; case GST_EVENT_STREAM_START: - GST_DEBUG_OBJECT (vf, "new stream, reset orientation from tags"); - vf->got_orientation_stream_tag = FALSE; - vf->global_tag_method = GST_VIDEO_ORIENTATION_IDENTITY; - gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_IDENTITY, TRUE); + { + const gchar *stream_id; + + gst_event_parse_stream_start (event, &stream_id); + if (g_strcmp0 (stream_id, vf->stream_id) != 0) { + GST_DEBUG_OBJECT (vf, "new stream, reset orientation from tags"); + vf->got_orientation_stream_tag = FALSE; + vf->global_tag_method = GST_VIDEO_ORIENTATION_IDENTITY; + gst_video_flip_set_method (vf, GST_VIDEO_ORIENTATION_IDENTITY, TRUE); + + g_clear_pointer (&vf->stream_id, g_free); + vf->stream_id = g_strdup (stream_id); + } + } break; default: break; @@ -1873,6 +1883,35 @@ gst_video_flip_get_property (GObject * object, guint prop_id, GValue * value, } } +static void +gst_video_flip_finalize (GObject * object) +{ + GstVideoFlip *videoflip = GST_VIDEO_FLIP (object); + + g_clear_pointer (&videoflip->stream_id, g_free); + + G_OBJECT_CLASS (gst_video_flip_parent_class)->finalize (object); +} + +static GstStateChangeReturn +gst_video_flip_change_state (GstElement * element, GstStateChange transition) +{ + GstVideoFlip *videoflip = GST_VIDEO_FLIP (element); + GstStateChangeReturn result; + + result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + g_clear_pointer (&videoflip->stream_id, g_free); + break; + default: + break; + } + + return result; +} + static void gst_video_flip_class_init (GstVideoFlipClass * klass) { @@ -1886,6 +1925,7 @@ gst_video_flip_class_init (GstVideoFlipClass * klass) gobject_class->set_property = gst_video_flip_set_property; gobject_class->get_property = gst_video_flip_get_property; + gobject_class->finalize = gst_video_flip_finalize; g_object_class_install_property (gobject_class, PROP_METHOD, g_param_spec_enum ("method", "method", @@ -1900,6 +1940,8 @@ gst_video_flip_class_init (GstVideoFlipClass * klass) pspec = g_object_class_find_property (gobject_class, "video-direction"); pspec->flags |= GST_PARAM_MUTABLE_PLAYING; + gstelement_class->change_state = gst_video_flip_change_state; + gst_element_class_set_static_metadata (gstelement_class, "Video flipper", "Filter/Effect/Video", "Flips and rotates video", "David Schleef "); diff --git a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.h b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.h index 15827cad62..5d993d7132 100644 --- a/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.h +++ b/subprojects/gst-plugins-good/gst/videofilter/gstvideoflip.h @@ -76,6 +76,7 @@ struct _GstVideoFlip { /* < private > */ GstVideoFormat v_format; + gchar *stream_id; GstVideoOrientationMethod method; GstVideoOrientationMethod tag_method;