MythTV master
bytereader.h
Go to the documentation of this file.
1/*
2 * find_start_code from libavcodec/FFmpeg
3 * Copyright (c) 2022 Scott Theisen
4 *
5 * This file is part of MythTV. The functions have been adapted to use C++.
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 BYTEREADER_H
23#define BYTEREADER_H
24
25#include <cstdint>
26
27#include "mythtvexp.h"
28
41namespace ByteReader
42{
54inline bool start_code_is_valid(uint32_t start_code)
55{
56 return (start_code & 0xFFFFFF00) == 0x100;
57}
58
78const uint8_t* find_start_code(const uint8_t *p,
79 const uint8_t *end,
80 uint32_t *start_code);
81
97const uint8_t *find_start_code_truncated(const uint8_t * p,
98 const uint8_t * end,
99 uint32_t * start_code);
100
101} // namespace ByteReader
102
103#endif // BYTEREADER_H
#define MTV_PUBLIC
Definition: mythtvexp.h:15
These functions are rewritten copies from FFmpeg's libavcodec, where find_start_code() is prefixed wi...
Definition: bytereader.h:42
bool start_code_is_valid(uint32_t start_code)
Test whether a start code found by find_start_code() is valid.
Definition: bytereader.h:54
MTV_PUBLIC const uint8_t * find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *start_code)
Find the first start code in the buffer p.
Definition: bytereader.cpp:26
MTV_PUBLIC const uint8_t * find_start_code_truncated(const uint8_t *p, const uint8_t *end, uint32_t *start_code)
By preserving the start_code value between subsequent calls, the caller can detect start codes across...
Definition: bytereader.cpp:74