* This function is based on av_fifo_generic_read, which is why there is a comment
* about a memory barrier for SMP.
*/
* This function is based on av_fifo_generic_read, which is why there is a comment
* about a memory barrier for SMP.
*/
-static uint8_t* flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
- uint8_t** wrap_buf, int* allocated_size)
+static uint8_t *flac_fifo_read_wrap(FLACParseContext *fpc, int offset, int len,
+ uint8_t **wrap_buf, int *allocated_size)
* A second call to flac_fifo_read (with new offset and len) should be called
* to get the post-wrap buf if the returned len is less than the requested.
**/
* A second call to flac_fifo_read (with new offset and len) should be called
* to get the post-wrap buf if the returned len is less than the requested.
**/
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
(*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
(*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
-static int find_headers_search(FLACParseContext *fpc, uint8_t *buf, int buf_size,
- int search_start)
-
+static int find_headers_search(FLACParseContext *fpc, uint8_t *buf,
+ int buf_size, int search_start)
{
int size = 0, mod_offset = (buf_size - 1) % 4, i, j;
uint32_t x;
for (i = 0; i < mod_offset; i++) {
{
int size = 0, mod_offset = (buf_size - 1) % 4, i, j;
uint32_t x;
for (i = 0; i < mod_offset; i++) {
- if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8)
- size = find_headers_search_validate(fpc, search_start + i);
+ if ((AV_RB16(buf + i) & 0xFFFE) == 0xFFF8) {
+ int ret = find_headers_search_validate(fpc, search_start + i);
+ size = FFMAX(size, ret);
+ }
}
for (; i < buf_size - 1; i += 4) {
x = AV_RN32(buf + i);
if (((x & ~(x + 0x01010101)) & 0x80808080)) {
for (j = 0; j < 4; j++) {
}
for (; i < buf_size - 1; i += 4) {
x = AV_RN32(buf + i);
if (((x & ~(x + 0x01010101)) & 0x80808080)) {
for (j = 0; j < 4; j++) {
- if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8)
- size = find_headers_search_validate(fpc, search_start + i + j);
+ if ((AV_RB16(buf + i + j) & 0xFFFE) == 0xFFF8) {
+ int ret = find_headers_search_validate(fpc, search_start + i + j);
+ size = FFMAX(size, ret);
+ }
/* If there are frames in the middle we expect this deduction,
as they are probably valid and this one follows it */
/* If there are frames in the middle we expect this deduction,
as they are probably valid and this one follows it */
if (header->fi.is_var_size)
fpc->pc->pts = header->fi.frame_or_sample_num;
else if (header->best_child)
if (header->fi.is_var_size)
fpc->pc->pts = header->fi.frame_or_sample_num;
else if (header->best_child)
read_end = read_start + MAX_FRAME_HEADER_SIZE;
} else {
/* The maximum read size is the upper-bound of what the parser
read_end = read_start + MAX_FRAME_HEADER_SIZE;
} else {
/* The maximum read size is the upper-bound of what the parser
- s->duration = 0;
- *poutbuf_size = fpc->best_header->offset;
- *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size,
- &fpc->wrap_buf,
- &fpc->wrap_buf_allocated_size);
+ s->duration = 0;
+ *poutbuf_size = fpc->best_header->offset;
+ *poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size,
+ &fpc->wrap_buf,
+ &fpc->wrap_buf_allocated_size);
.codec_ids = { AV_CODEC_ID_FLAC },
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
.codec_ids = { AV_CODEC_ID_FLAC },
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,