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.
This commit is contained in:
Thiago Santos 2015-08-16 13:51:47 -03:00
parent a00546e078
commit 0899529222

View file

@ -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);
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;
s2 = gst_structure_copy (s);
if (i == 1) {
gst_structure_set (s2, "channels", G_TYPE_INT, 1, NULL);
} else {
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);
}
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);
}