Coverage Report

Created: 2025-08-28 07:12

/src/ffmpeg/libavcodec/flac.h
Line
Count
Source
1
/*
2
 * FLAC (Free Lossless Audio Codec) common stuff
3
 * Copyright (c) 2008 Justin Ruggles
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
 * FLAC (Free Lossless Audio Codec) common stuff
25
 */
26
27
#ifndef AVCODEC_FLAC_H
28
#define AVCODEC_FLAC_H
29
30
#include "libavutil/intreadwrite.h"
31
32
70.0k
#define FLAC_STREAMINFO_SIZE   34
33
16.9M
#define FLAC_MAX_CHANNELS       8
34
721
#define FLAC_MIN_BLOCKSIZE     16
35
3.60k
#define FLAC_MAX_BLOCKSIZE  65535
36
1.36M
#define FLAC_MIN_FRAME_SIZE    10
37
38
enum {
39
    FLAC_CHMODE_INDEPENDENT = 0,
40
    FLAC_CHMODE_LEFT_SIDE   = 1,
41
    FLAC_CHMODE_RIGHT_SIDE  = 2,
42
    FLAC_CHMODE_MID_SIDE    = 3,
43
};
44
45
enum {
46
    FLAC_METADATA_TYPE_STREAMINFO = 0,
47
    FLAC_METADATA_TYPE_PADDING,
48
    FLAC_METADATA_TYPE_APPLICATION,
49
    FLAC_METADATA_TYPE_SEEKTABLE,
50
    FLAC_METADATA_TYPE_VORBIS_COMMENT,
51
    FLAC_METADATA_TYPE_CUESHEET,
52
    FLAC_METADATA_TYPE_PICTURE,
53
    FLAC_METADATA_TYPE_INVALID = 127
54
};
55
56
/**
57
 * Parse the metadata block parameters from the header.
58
 * @param[in]  block_header header data, at least 4 bytes
59
 * @param[out] last indicator for last metadata block
60
 * @param[out] type metadata block type
61
 * @param[out] size metadata block size
62
 */
63
static av_always_inline void flac_parse_block_header(const uint8_t *block_header,
64
                                                      int *last, int *type, int *size)
65
115k
{
66
115k
    int tmp = *block_header;
67
115k
    if (last)
68
114k
        *last = tmp & 0x80;
69
115k
    if (type)
70
87.1k
        *type = tmp & 0x7F;
71
115k
    if (size)
72
115k
        *size = AV_RB24(block_header + 1);
73
115k
}
Unexecuted instantiation: flac.c:flac_parse_block_header
cafdec.c:flac_parse_block_header
Line
Count
Source
65
233
{
66
233
    int tmp = *block_header;
67
233
    if (last)
68
233
        *last = tmp & 0x80;
69
233
    if (type)
70
233
        *type = tmp & 0x7F;
71
233
    if (size)
72
233
        *size = AV_RB24(block_header + 1);
73
233
}
flacdec.c:flac_parse_block_header
Line
Count
Source
65
74.7k
{
66
74.7k
    int tmp = *block_header;
67
74.7k
    if (last)
68
73.6k
        *last = tmp & 0x80;
69
74.7k
    if (type)
70
46.4k
        *type = tmp & 0x7F;
71
74.7k
    if (size)
72
74.7k
        *size = AV_RB24(block_header + 1);
73
74.7k
}
matroskadec.c:flac_parse_block_header
Line
Count
Source
65
40.4k
{
66
40.4k
    int tmp = *block_header;
67
40.4k
    if (last)
68
40.4k
        *last = tmp & 0x80;
69
40.4k
    if (type)
70
40.4k
        *type = tmp & 0x7F;
71
40.4k
    if (size)
72
40.4k
        *size = AV_RB24(block_header + 1);
73
40.4k
}
Unexecuted instantiation: mov.c:flac_parse_block_header
Unexecuted instantiation: oggparseflac.c:flac_parse_block_header
Unexecuted instantiation: iamf_parse.c:flac_parse_block_header
Unexecuted instantiation: flacenc.c:flac_parse_block_header
74
75
#endif /* AVCODEC_FLAC_H */