1 /*
2 * TAK parser
3 * Copyright (c) 2012 Michael Niedermayer
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * TAK parser
25 **/
26
27 #define BITSTREAM_READER_LE
30
36
38 const uint8_t **poutbuf,
int *poutbuf_size,
40 {
45 int consumed = 0;
47 int ret;
48
52 return ret;
57 *poutbuf_size = buf_size;
58 return buf_size;
59 }
60
61 while (buf_size || t->
index + needed <= pc->
index) {
64 buf_size);
66
69 consumed += tmp_buf_size;
70 buf += tmp_buf_size;
71 buf_size -= tmp_buf_size;
72 }
73
78
81 return ret;
92 } else {
96 goto found;
97 }
98 }
99 }
100 }
101 }
102 found:
103
107 *poutbuf_size = 0;
108 return buf_size + consumed;
109 }
110
112 next += consumed;
114 }
115
117 *poutbuf_size = buf_size;
118 return next;
119 }
120
126 };
int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, TAKStreamInfo *ti, int log_level_offset)
Validate and decode a frame header.
AVCodecParser ff_tak_parser
int duration
Duration of the current frame.
static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size)
#define TAK_FRAME_FLAG_HAS_INFO
static int get_bits_count(const GetBitContext *s)
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
void ff_parse_close(AVCodecParserContext *s)
int overread
the number of bytes which where irreversibly read from the next frame
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
TAK (Tom's lossless Audio Kompressor) decoder/demuxer common functions.
#define PARSER_FLAG_COMPLETE_FRAMES
#define TAK_MAX_FRAME_HEADER_BYTES
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.