8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 8, 8
};
+static const uint16_t sample_rate_tab[16] = {
+ 0, 42965, 43008, 44800, 53706, 53760
+};
+
static int skip_input(DBEContext *s, int nb_words)
{
if (nb_words > s->input_size) {
return 0;
}
-static int convert_input(DBEContext *s, int nb_words, int key)
+int ff_dolby_e_convert_input(DBEContext *s, int nb_words, int key)
{
const uint8_t *src = s->input;
uint8_t *dst = s->buffer;
av_assert0(nb_words <= 1024u);
if (nb_words > s->input_size) {
+ if (s->avctx)
+ av_log(s->avctx, AV_LOG_ERROR, "Packet too short\n");
return AVERROR_INVALIDDATA;
}
if ((key = parse_key(s)) < 0)
return key;
- if ((ret = convert_input(s, 1, key)) < 0)
+ if ((ret = ff_dolby_e_convert_input(s, 1, key)) < 0)
return ret;
skip_bits(&s->gb, 4);
return AVERROR_INVALIDDATA;
}
- if ((ret = convert_input(s, mtd_size, key)) < 0)
+ if ((ret = ff_dolby_e_convert_input(s, mtd_size, key)) < 0)
return ret;
skip_bits(&s->gb, 14);
header->fr_code = get_bits(&s->gb, 4);
header->fr_code_orig = get_bits(&s->gb, 4);
- if (!sample_rate_tab[header->fr_code] ||
+ if (!(header->sample_rate = sample_rate_tab[header->fr_code]) ||
!sample_rate_tab[header->fr_code_orig]) {
if (s->avctx)
av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n");