Merge commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3'

* commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3':
  bitstream: forward error values and drop few abort()

Conflicts:
	libavcodec/bitstream.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/24/merge
Michael Niedermayer 12 years ago
commit 301522f521
  1. 10
      libavcodec/bitstream.c

@ -112,7 +112,7 @@ static int alloc_table(VLC *vlc, int size, int use_static)
vlc->table_allocated += (1 << vlc->bits);
vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
if (!vlc->table)
return -1;
return AVERROR(ENOMEM);
}
return index;
}
@ -166,7 +166,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)
return -1;
return table_index;
table = &vlc->table[table_index];
for (i = 0; i < table_size; i++) {
@ -193,7 +193,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
if (table[j][1] /*bits*/ != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
return -1;
return AVERROR_INVALIDDATA;
}
table[j][1] = n; //bits
table[j][0] = symbol;
@ -224,7 +224,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
j, codes[i].bits + table_nb_bits);
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
if (index < 0)
return -1;
return index;
/* note: realloc has been done, so reload tables */
table = &vlc->table[table_index];
table[j][0] = index; //code
@ -339,7 +339,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
av_free(buf);
if (ret < 0) {
av_freep(&vlc->table);
return -1;
return ret;
}
return 0;
}

Loading…
Cancel
Save