- else if(enc->codec_id == CODEC_ID_AMR_WB)
- {
- static uint8_t packed_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
- uint8_t toc, mode;
- int read;
- int size;
-
- if (url_feof(&s->pb))
- {
- return AVERROR_IO;
- }
-
- toc=get_byte(&s->pb);
- mode = (uint8_t)((toc >> 3) & 0x0F);
+
+ // FIXME this is wrong, this should rather be in a AVParset
+ toc = avio_r8(s->pb);
+ mode = (toc >> 3) & 0x0F;
+
+ if (enc->codec_id == AV_CODEC_ID_AMR_NB) {
+ static const uint8_t packed_size[16] = {
+ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ size = packed_size[mode] + 1;
+ } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) {
+ static const uint8_t packed_size[16] = {
+ 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1
+ };
+