diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-08-16 13:51:47 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-08-16 14:30:57 -0300 |
commit | 0899529222d0660836e244b74ba09505936ff701 (patch) | |
tree | 434227de31679ed7ffc5751a657de5eb374139da | |
parent | a00546e0783f825d73b173b2fd4434fe9dbc0e4a (diff) |
flacenc: remove single entry if from loop
Iterate from the 2nd channel on and create the 1 channel struct
outside to make loop structure simpler and only slightly faster.
-rw-r--r-- | ext/flac/gstflacenc.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 377699d9e..1907066aa 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -739,19 +739,17 @@ gst_flac_enc_generate_sink_caps (void) "rate", GST_TYPE_INT_RANGE, 1, 655350, NULL); ret = gst_caps_new_empty (); - for (i = 1; i <= 8; i++) { - s2 = gst_structure_copy (s); - - if (i == 1) { - gst_structure_set (s2, "channels", G_TYPE_INT, 1, NULL); - } else { - guint64 channel_mask; + s2 = gst_structure_copy (s); + gst_structure_set (s2, "channels", G_TYPE_INT, 1, NULL); + gst_caps_append_structure (ret, s2); + for (i = 2; i <= 8; i++) { + guint64 channel_mask; - gst_audio_channel_positions_to_mask (channel_positions[i - 1], i, - FALSE, &channel_mask); - gst_structure_set (s2, "channels", G_TYPE_INT, i, "channel-mask", - GST_TYPE_BITMASK, channel_mask, NULL); - } + s2 = gst_structure_copy (s); + gst_audio_channel_positions_to_mask (channel_positions[i - 1], i, + FALSE, &channel_mask); + gst_structure_set (s2, "channels", G_TYPE_INT, i, "channel-mask", + GST_TYPE_BITMASK, channel_mask, NULL); gst_caps_append_structure (ret, s2); } |