[sushi] media-bin: only update tags when they change
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] media-bin: only update tags when they change
- Date: Wed, 19 Jun 2019 21:33:49 +0000 (UTC)
commit 19520318e115c7627032359405e8eada89c48fdf
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jun 19 14:23:24 2019 -0700
media-bin: only update tags when they change
Check if the tags have changed before considering them for an update.
src/libsushi/sushi-media-bin.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/libsushi/sushi-media-bin.c b/src/libsushi/sushi-media-bin.c
index c2469aa..35dd52c 100644
--- a/src/libsushi/sushi-media-bin.c
+++ b/src/libsushi/sushi-media-bin.c
@@ -1794,23 +1794,32 @@ sushi_media_bin_handle_msg_tag (SushiMediaBin *self, GstMessage *msg)
if (g_type_is_a (G_OBJECT_TYPE (src), GST_TYPE_VIDEO_SINK))
{
- type = "video-tags-changed";
old_tags = priv->video_tags;
- priv->video_tags = gst_tag_list_merge (old_tags, tags, GST_TAG_MERGE_REPLACE);
+ if (!old_tags || (old_tags && !gst_tag_list_is_equal (old_tags, tags)))
+ {
+ type = "video-tags-changed";
+ priv->video_tags = gst_tag_list_merge (old_tags, tags, GST_TAG_MERGE_REPLACE);
+ }
}
else if (g_type_is_a (G_OBJECT_TYPE (src), GST_TYPE_AUDIO_BASE_SINK))
{
- type = "audio-tags-changed";
old_tags = priv->audio_tags;
- priv->audio_tags = gst_tag_list_merge (old_tags, tags, GST_TAG_MERGE_REPLACE);
+ if (!old_tags || (old_tags && !gst_tag_list_is_equal (old_tags, tags)))
+ {
+ type = "audio-tags-changed";
+ priv->audio_tags = gst_tag_list_merge (old_tags, tags, GST_TAG_MERGE_REPLACE);
+ }
}
/* Post message on the bus for the main thread to pick it up */
if (type)
- sushi_media_bin_post_message_application (self, type);
+ {
+ sushi_media_bin_post_message_application (self, type);
+ g_signal_emit (self, sushi_media_bin_signals[TAGS_CHANGE], 0);
+ g_clear_pointer (&old_tags, gst_tag_list_unref);
+ }
gst_tag_list_unref (tags);
- g_clear_pointer (&old_tags, gst_tag_list_unref);
}
static inline void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]