From 19f5fda87d4967268f285945b9fc94d8b27fbfeb Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 14 Jun 2010 13:24:06 +0200 Subject: [PATCH] ffmpegcolorspace: Transfer structures instead of copying them Avoids many expensive structure copies --- common | 2 +- gst/ffmpegcolorspace/gstffmpegcolorspace.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/common b/common index c804988..733fca9 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c804988a15bf68d5661a7af7799a51140d03c425 +Subproject commit 733fca913736edad29dea6a8dded921282ecee20 diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 344693b..f278758 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -128,7 +128,6 @@ gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans, GstCaps *template; GstCaps *tmp, *tmp2; GstCaps *result; - guint i, n; GstStructure *s; GstCaps *alpha, *non_alpha; @@ -143,18 +142,14 @@ gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans, /* Now move alpha formats to the beginning if caps is an alpha format * or at the end if caps is no alpha format */ - n = gst_caps_get_size (tmp); - alpha = gst_caps_new_empty (); non_alpha = gst_caps_new_empty (); - for (i = 0; i < n; i++) { - s = gst_caps_get_structure (tmp, i); - + while ((s = gst_caps_steal_structure (tmp, 0))) { if (gst_ffmpegcsp_structure_is_alpha (s)) - gst_caps_append_structure (alpha, gst_structure_copy (s)); + gst_caps_append_structure (alpha, s); else - gst_caps_append_structure (non_alpha, gst_structure_copy (s)); + gst_caps_append_structure (non_alpha, s); } s = gst_caps_get_structure (caps, 0); -- 2.7.4