+/**
+ * The different states of a complete FEC group.
+ *
+ * Even if a FEC group has been received successfully, it probably can not be
+ * used right away because some streams (ogg, wma) need to receive an audio
+ * file header before decoding can start.
+ */
+enum fec_group_usability {
+ /** Drop the group (because we did not receive the header yet). */
+ FEC_GROUP_UNUSABLE,
+ /** Use all data in the group. */
+ FEC_GROUP_USABLE,
+ /** Use the group, but drop its audio file header. */
+ FEC_GROUP_USABLE_SKIP_HEADER,
+ /** Use the group, including its header. */
+ FEC_GROUP_USABLE_WITH_HEADER
+};
+
+static enum fec_group_usability group_is_usable(struct fecdec_group *fg,
+ struct private_fecdec_data *pfd)
+{
+ struct fec_header *h = &fg->h;
+
+ if (!h->header_stream)
+ return FEC_GROUP_USABLE;
+ if (pfd->have_header) {
+ if (h->audio_header_size)
+ return FEC_GROUP_USABLE_SKIP_HEADER;
+ return FEC_GROUP_USABLE;
+ }
+ if (fg->h.bos)
+ return FEC_GROUP_USABLE;
+ if (fg->h.audio_header_size)
+ return FEC_GROUP_USABLE_WITH_HEADER;
+ return FEC_GROUP_UNUSABLE;
+}
+