Coverage Report

Created: 2025-11-16 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libavformat/mpeg.h
Line
Count
Source
1
/*
2
 * MPEG-1/2 muxer and demuxer common defines
3
 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
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
#ifndef AVFORMAT_MPEG_H
23
#define AVFORMAT_MPEG_H
24
25
#include <stdint.h>
26
#include "libavutil/intreadwrite.h"
27
28
80.6M
#define PACK_START_CODE             ((unsigned int)0x000001ba)
29
44.4M
#define SYSTEM_HEADER_START_CODE    ((unsigned int)0x000001bb)
30
#define SEQUENCE_END_CODE           ((unsigned int)0x000001b7)
31
#define PACKET_START_CODE_MASK      ((unsigned int)0xffffff00)
32
#define PACKET_START_CODE_PREFIX    ((unsigned int)0x00000100)
33
#define ISO_11172_END_CODE          ((unsigned int)0x000001b9)
34
35
/* mpeg2 */
36
8.14M
#define PROGRAM_STREAM_MAP 0x1bc
37
131M
#define PRIVATE_STREAM_1   0x1bd
38
8.14M
#define PADDING_STREAM     0x1be
39
16.4M
#define PRIVATE_STREAM_2   0x1bf
40
41
128M
#define AUDIO_ID 0xc0
42
140M
#define VIDEO_ID 0xe0
43
#define H264_ID  0xe2
44
#define AC3_ID   0x80
45
#define DTS_ID   0x88
46
#define LPCM_ID  0xa0
47
#define SUB_ID   0x20
48
49
141k
#define STREAM_TYPE_VIDEO_MPEG1     0x01
50
141k
#define STREAM_TYPE_VIDEO_MPEG2     0x02
51
282k
#define STREAM_TYPE_AUDIO_MPEG1     0x03
52
482k
#define STREAM_TYPE_AUDIO_MPEG2     0x04
53
371
#define STREAM_TYPE_PRIVATE_SECTION 0x05
54
431k
#define STREAM_TYPE_PRIVATE_DATA    0x06
55
309k
#define STREAM_TYPE_AUDIO_AAC       0x0f
56
141k
#define STREAM_TYPE_VIDEO_MPEG4     0x10
57
141k
#define STREAM_TYPE_VIDEO_H264      0x1b
58
141k
#define STREAM_TYPE_VIDEO_HEVC      0x24
59
140k
#define STREAM_TYPE_VIDEO_VVC       0x33
60
#define STREAM_TYPE_VIDEO_CAVS      0x42
61
62
140k
#define STREAM_TYPE_AUDIO_AC3       0x81
63
64
static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
65
66
/**
67
 * Parse MPEG-PES five-byte timestamp
68
 */
69
6.35M
static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
70
6.35M
    return (int64_t)(*buf & 0x0e) << 29 |
71
6.35M
            (AV_RB16(buf+1) >> 1) << 15 |
72
6.35M
             AV_RB16(buf+3) >> 1;
73
6.35M
}
mpeg.c:ff_parse_pes_pts
Line
Count
Source
69
4.21M
static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
70
4.21M
    return (int64_t)(*buf & 0x0e) << 29 |
71
4.21M
            (AV_RB16(buf+1) >> 1) << 15 |
72
4.21M
             AV_RB16(buf+3) >> 1;
73
4.21M
}
mpegts.c:ff_parse_pes_pts
Line
Count
Source
69
2.13M
static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
70
2.13M
    return (int64_t)(*buf & 0x0e) << 29 |
71
2.13M
            (AV_RB16(buf+1) >> 1) << 15 |
72
2.13M
             AV_RB16(buf+3) >> 1;
73
2.13M
}
pva.c:ff_parse_pes_pts
Line
Count
Source
69
2.20k
static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
70
2.20k
    return (int64_t)(*buf & 0x0e) << 29 |
71
2.20k
            (AV_RB16(buf+1) >> 1) << 15 |
72
2.20k
             AV_RB16(buf+3) >> 1;
73
2.20k
}
ty.c:ff_parse_pes_pts
Line
Count
Source
69
1.73k
static inline int64_t ff_parse_pes_pts(const uint8_t *buf) {
70
1.73k
    return (int64_t)(*buf & 0x0e) << 29 |
71
1.73k
            (AV_RB16(buf+1) >> 1) << 15 |
72
1.73k
             AV_RB16(buf+3) >> 1;
73
1.73k
}
74
75
#endif /* AVFORMAT_MPEG_H */