diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-13 01:43:25 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-13 01:43:25 +0300 |
commit | ad92410d900b985cdabc499f0badaad72dd5ea2d (patch) | |
tree | 22dba2b13f99b444fdf03dc6f3ba0ea5ce7b7e37 /libavcodec/hevc_parse.c | |
parent | bcc6c7bb65f3b7adc525de4f7fed6d9648a01b1b (diff) |
avcodec/hevc: Move skipped_bytes_pos_nal to HEVCNAL, simplify code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hevc_parse.c')
-rw-r--r-- | libavcodec/hevc_parse.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c index 01c28d8ea1..453a656cd3 100644 --- a/libavcodec/hevc_parse.c +++ b/libavcodec/hevc_parse.c @@ -218,29 +218,25 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in memset(pkt->nals + pkt->nals_allocated, 0, (new_size - pkt->nals_allocated) * sizeof(*pkt->nals)); - tmp = av_realloc_array(s->skipped_bytes_pos_nal, new_size, sizeof(*s->skipped_bytes_pos_nal)); - if (!tmp) - return AVERROR(ENOMEM); - s->skipped_bytes_pos_nal = tmp; - nal = &pkt->nals[pkt->nb_nals]; nal->skipped_bytes_pos_size_nal = 1024; // initial buffer size - s->skipped_bytes_pos_nal[pkt->nals_allocated] = av_malloc_array(nal->skipped_bytes_pos_size_nal, sizeof(*s->skipped_bytes_pos)); - if (!s->skipped_bytes_pos_nal[pkt->nals_allocated]) + nal->skipped_bytes_pos_nal = av_malloc_array(nal->skipped_bytes_pos_size_nal, sizeof(*s->skipped_bytes_pos)); + if (!nal->skipped_bytes_pos_nal) return AVERROR(ENOMEM); pkt->nals_allocated = new_size; } nal = &pkt->nals[pkt->nb_nals]; s->skipped_bytes_pos_size = nal->skipped_bytes_pos_size_nal; - s->skipped_bytes_pos = s->skipped_bytes_pos_nal[pkt->nb_nals]; + s->skipped_bytes_pos = nal->skipped_bytes_pos_nal; consumed = ff_hevc_extract_rbsp(s, buf, extract_length, nal); if (consumed < 0) return consumed; nal->skipped_bytes_pos_size_nal = s->skipped_bytes_pos_size; - s->skipped_bytes_pos_nal[pkt->nb_nals++] = s->skipped_bytes_pos; + nal->skipped_bytes_pos_nal = s->skipped_bytes_pos; + pkt->nb_nals++; ret = init_get_bits8(&nal->gb, nal->data, nal->size); if (ret < 0) |