X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=fecdec_filter.c;h=901a91694b3f22c71e3ead710da95d0faed0391b;hb=1e012cf40238883621692051a22fb9c7cad5e944;hp=a6218e436506d8000192a3cbb8f7a44da1133d32;hpb=7b4830d1d2191f0affd0aeedb7fa08e59d3148f7;p=paraslash.git diff --git a/fecdec_filter.c b/fecdec_filter.c index a6218e43..901a9169 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -6,12 +6,16 @@ /** \file fecdec_filter.c A filter that fec-decodes an audio stream. */ +#include +#include + #include #include "para.h" #include "error.h" #include "list.h" #include "sched.h" #include "ggo.h" +#include "buffer_tree.h" #include "filter.h" #include "string.h" #include "portable_io.h" @@ -38,7 +42,7 @@ struct fec_header { uint8_t slices_per_group; /** Number of slices needed to start decoding. */ uint8_t data_slices_per_group; - /** Size of the ogg vorbis header (zero for mp3, aac). */ + /** Size of the ogg vorbis/wma header (zero for mp3, aac). */ uint32_t audio_header_size; /** Number of the FEC group this slice belongs to. */ uint32_t group_num; @@ -108,7 +112,9 @@ static void clear_group(struct fecdec_group *fg) fg->idx[i] = -1; } free(fg->data); + fg->data = NULL; free(fg->idx); + fg->idx = NULL; fg->num_slices = 0; memset(&fg->h, 0, sizeof(struct fec_header)); fg->num_received_slices = 0; @@ -241,10 +247,21 @@ static int add_slice(char *buf, struct fecdec_group *fg) return 1; } +/** + * 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 };