Mercurial > libavformat.hg
changeset 3495:ed5686879cdb libavformat
matroskadec: decode track private data if needed
original patch by Evgeniy Stepanov eugeni.stepanov _at_ gmail _dot_ com
author | aurel |
---|---|
date | Sun, 22 Jun 2008 15:52:28 +0000 |
parents | 8bf1a8e12b43 |
children | cdbf302a3c00 |
files | matroskadec.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/matroskadec.c Sun Jun 22 15:49:44 2008 +0000 +++ b/matroskadec.c Sun Jun 22 15:52:28 2008 +0000 @@ -1610,6 +1610,23 @@ } } + if (track->codec_priv_size && track->encoding_scope & 2) { + uint8_t *orig_priv = track->codec_priv; + int offset = matroska_decode_buffer(&track->codec_priv, + &track->codec_priv_size, track); + if (offset > 0) { + track->codec_priv = av_malloc(track->codec_priv_size + offset); + memcpy(track->codec_priv, track->encoding_settings, offset); + memcpy(track->codec_priv+offset, orig_priv, track->codec_priv_size); + track->codec_priv_size += offset; + av_free(orig_priv); + } else if (!offset) { + av_free(orig_priv); + } else + av_log(matroska->ctx, AV_LOG_ERROR, + "Failed to decode codec private data\n"); + } + if (track->type && matroska->num_tracks < ARRAY_SIZE(matroska->tracks)) { matroska->tracks[matroska->num_tracks++] = track; } else {