FFmpeg
|
#include "libavutil/attributes.h"
#include "libavutil/crc.h"
#include "libavutil/fifo.h"
#include "bytestream.h"
#include "parser.h"
#include "flac.h"
Go to the source code of this file.
Data Structures | |
struct | FLACHeaderMarker |
struct | FLACParseContext |
Macros | |
#define | FLAC_MAX_SEQUENTIAL_HEADERS 4 |
maximum number of adjacent headers that compare CRCs against each other More... | |
#define | FLAC_MIN_HEADERS 10 |
minimum number of headers buffered and checked before returning frames More... | |
#define | FLAC_AVG_FRAME_SIZE 8192 |
estimate for average size of a FLAC frame More... | |
#define | FLAC_HEADER_BASE_SCORE 10 |
scoring settings for score_header More... | |
#define | FLAC_HEADER_CHANGED_PENALTY 7 |
#define | FLAC_HEADER_CRC_FAIL_PENALTY 50 |
#define | FLAC_HEADER_NOT_PENALIZED_YET 100000 |
#define | FLAC_HEADER_NOT_SCORED_YET -100000 |
#define | MAX_FRAME_HEADER_SIZE 16 |
largest possible size of flac header More... | |
#define | MAX_FRAME_VERIFY_SIZE (MAX_FRAME_HEADER_SIZE) |
Variables | |
AVCodecParser | ff_flac_parser |
FLAC parser
The FLAC parser buffers input until FLAC_MIN_HEADERS has been found. Each time it finds and verifies a CRC-8 header it sees which of the FLAC_MAX_SEQUENTIAL_HEADERS that came before it have a valid CRC-16 footer that ends at the newly found header. Headers are scored by FLAC_HEADER_BASE_SCORE plus the max of its crc-verified children, penalized by changes in sample rate, frame number, etc. The parser returns the frame with the highest score.
Definition in file flac_parser.c.
#define FLAC_MAX_SEQUENTIAL_HEADERS 4 |
maximum number of adjacent headers that compare CRCs against each other
Definition at line 43 of file flac_parser.c.
#define FLAC_MIN_HEADERS 10 |
minimum number of headers buffered and checked before returning frames
Definition at line 45 of file flac_parser.c.
#define FLAC_AVG_FRAME_SIZE 8192 |
estimate for average size of a FLAC frame
Definition at line 47 of file flac_parser.c.
#define FLAC_HEADER_BASE_SCORE 10 |
scoring settings for score_header
Definition at line 50 of file flac_parser.c.
#define FLAC_HEADER_CHANGED_PENALTY 7 |
Definition at line 51 of file flac_parser.c.
#define FLAC_HEADER_CRC_FAIL_PENALTY 50 |
Definition at line 52 of file flac_parser.c.
#define FLAC_HEADER_NOT_PENALIZED_YET 100000 |
Definition at line 53 of file flac_parser.c.
#define FLAC_HEADER_NOT_SCORED_YET -100000 |
Definition at line 54 of file flac_parser.c.
#define MAX_FRAME_HEADER_SIZE 16 |
largest possible size of flac header
Definition at line 57 of file flac_parser.c.
#define MAX_FRAME_VERIFY_SIZE (MAX_FRAME_HEADER_SIZE) |
Definition at line 58 of file flac_parser.c.
|
static |
Definition at line 96 of file flac_parser.c.
Referenced by find_headers_search_validate(), and flac_parse().
|
static |
Non-destructive fast fifo pointer fetching Returns a pointer from the specified offset.
If possible the pointer points within the fifo buffer. Otherwise (if it would cause a wrap around,) a pointer to a user-specified buffer is used. The pointer can be NULL. In any case it will be reallocated to hold the size. If the returned pointer will be used after subsequent calls to flac_fifo_read_wrap then the subsequent calls should pass in a different wrap_buf so as to not overwrite the contents of the previous wrap_buf. This function is based on av_fifo_generic_read, which is why there is a comment about a memory barrier for SMP.
Definition at line 117 of file flac_parser.c.
Referenced by find_headers_search_validate(), flac_parse(), and get_best_header().
|
static |
Return a pointer in the fifo buffer where the offset starts at until the wrap point or end of request.
len will contain the valid length of the returned buffer. 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.
Definition at line 157 of file flac_parser.c.
Referenced by check_header_mismatch(), and find_new_headers().
|
static |
Definition at line 168 of file flac_parser.c.
Referenced by find_headers_search(), and find_new_headers().
|
static |
Definition at line 205 of file flac_parser.c.
Referenced by find_new_headers().
|
static |
Definition at line 232 of file flac_parser.c.
Referenced by flac_parse().
|
static |
Definition at line 276 of file flac_parser.c.
Referenced by check_header_mismatch(), and score_header().
|
static |
Definition at line 306 of file flac_parser.c.
Referenced by get_best_header(), and score_header().
|
static |
Score a header.
Give FLAC_HEADER_BASE_SCORE points to a frame for existing. If it has children, (subsequent frames of which the preceding CRC footer validates against this one,) then take the maximum score of the children, with a penalty of FLAC_HEADER_CHANGED_PENALTY applied for each change to bps, sample rate, channels, but not decorrelation mode, or blocksize, because it can change often.
Definition at line 414 of file flac_parser.c.
Referenced by score_sequences().
|
static |
Definition at line 454 of file flac_parser.c.
Referenced by flac_parse().
|
static |
Definition at line 471 of file flac_parser.c.
Referenced by flac_parse().
|
static |
Definition at line 515 of file flac_parser.c.
|
static |
Definition at line 716 of file flac_parser.c.
|
static |
Definition at line 731 of file flac_parser.c.
AVCodecParser ff_flac_parser |
Definition at line 746 of file flac_parser.c.