diff options
Diffstat (limited to 'libavcodec/tak_parser.c')
-rw-r--r-- | libavcodec/tak_parser.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c index 295df2418a..0f2fbc2b35 100644 --- a/libavcodec/tak_parser.c +++ b/libavcodec/tak_parser.c @@ -2,20 +2,20 @@ * TAK parser * Copyright (c) 2012 Michael Niedermayer * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -67,23 +67,22 @@ static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx, buf_size); const uint8_t *tmp_buf = buf; - ff_combine_frame(pc, END_NOT_FOUND, &tmp_buf, &tmp_buf_size); + if (ff_combine_frame(pc, END_NOT_FOUND, &tmp_buf, &tmp_buf_size) != -1) + return AVERROR(ENOMEM); consumed += tmp_buf_size; buf += tmp_buf_size; buf_size -= tmp_buf_size; } - for (; t->index + needed <= pc->index; t->index++) - if (pc->buffer[t->index] == 0xFF && - pc->buffer[t->index + 1] == 0xA0) { + for (; t->index + needed <= pc->index; t->index++) { + if (pc->buffer[ t->index ] == 0xFF && + pc->buffer[ t->index + 1 ] == 0xA0) { TAKStreamInfo ti; init_get_bits(&gb, pc->buffer + t->index, 8 * (pc->index - t->index)); if (!ff_tak_decode_frame_header(avctx, &gb, - pc->frame_start_found ? &ti - : &t->ti, - 127) && + pc->frame_start_found ? &ti : &t->ti, 127) && !ff_tak_check_crc(pc->buffer + t->index, get_bits_count(&gb) / 8)) { if (!pc->frame_start_found) { @@ -99,9 +98,10 @@ static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx, } } } + } } - found: + if (consumed && !buf_size && next == END_NOT_FOUND || ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; |