MythTV  master
mpg_common.h
Go to the documentation of this file.
1 /*
2  * mpg_common.h
3  *
4  *
5  * Copyright (C) 2003 Marcus Metzler <mocm@metzlerbros.de>
6  * Metzler Brothers Systementwicklung GbR
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * General Public License for more details.
18  *
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
24  *
25  */
26 
27 #ifndef MPG_COMMON_H
28 #define MPG_COMMON_H
29 
30 #include <cstdint>
31 #include "ringbuffer.h"
32 
33 
34 
35 struct index_unit {
36  uint8_t active;
37  uint32_t length;
38  uint32_t start;
39  uint64_t pts;
40  uint64_t dts;
41  uint8_t seq_header;
42  uint8_t seq_end;
43  uint8_t gop;
44  uint8_t end_seq;
45  uint8_t frame;
46  uint8_t gop_off;
47  uint8_t frame_off;
48  uint8_t frame_start;
49  uint8_t err;
50  uint32_t framesize;
51  uint64_t ptsrate;
52 };
53 
54 struct extdata_t {
56  uint64_t pts;
57  uint64_t pts_off;
58  int type;
59  int strmnum;
60  int frmperpkt;
61  char language[4];
63 };
64 
65 
66 #define NO_ERR 0
67 #define FRAME_ERR 1
68 
69 
70 void show_buf(uint8_t *buf, int length);
71 int find_mpg_header(uint8_t head, const uint8_t *buf, int length);
72 int find_any_header(uint8_t *head, const uint8_t *buf, int length);
73 uint64_t trans_pts_dts(const uint8_t *pts);
74 int mring_peek( ringbuffer *rbuf, uint8_t *buf, unsigned int l, uint32_t off);
75 int mring_peek( ringbuffer *rbuf, peek_poke_vec &buf, unsigned int l, uint32_t off);
76 int ring_find_mpg_header(ringbuffer *rbuf, uint8_t head, int off, int le);
77 int ring_find_any_header(ringbuffer *rbuf, uint8_t *head, int off, int le);
78 
79 #endif /* MPG_COMMON_H */
extdata_t::pts_off
uint64_t pts_off
Definition: mpg_common.h:57
extdata_t::type
int type
Definition: mpg_common.h:58
index_unit::ptsrate
uint64_t ptsrate
Definition: mpg_common.h:51
index_unit::frame_start
uint8_t frame_start
Definition: mpg_common.h:48
ringbuffer.h
find_any_header
int find_any_header(uint8_t *head, const uint8_t *buf, int length)
Definition: mpg_common.cpp:107
ringbuffer
Definition: ringbuffer.h:39
extdata_t::strmnum
int strmnum
Definition: mpg_common.h:59
index_unit::gop_off
uint8_t gop_off
Definition: mpg_common.h:46
index_unit::end_seq
uint8_t end_seq
Definition: mpg_common.h:44
index_unit::seq_end
uint8_t seq_end
Definition: mpg_common.h:42
index_unit::dts
uint64_t dts
Definition: mpg_common.h:40
find_mpg_header
int find_mpg_header(uint8_t head, const uint8_t *buf, int length)
Definition: mpg_common.cpp:71
extdata_t::language
char language[4]
Definition: mpg_common.h:61
ring_find_any_header
int ring_find_any_header(ringbuffer *rbuf, uint8_t *head, int off, int le)
Definition: mpg_common.cpp:216
extdata_t::iu
index_unit iu
Definition: mpg_common.h:55
mring_peek
int mring_peek(ringbuffer *rbuf, uint8_t *buf, unsigned int l, uint32_t off)
Definition: mpg_common.cpp:159
index_unit::seq_header
uint8_t seq_header
Definition: mpg_common.h:41
index_unit::frame_off
uint8_t frame_off
Definition: mpg_common.h:47
index_unit::active
uint8_t active
Definition: mpg_common.h:36
index_unit::start
uint32_t start
Definition: mpg_common.h:38
extdata_t
Definition: mpg_common.h:54
trans_pts_dts
uint64_t trans_pts_dts(const uint8_t *pts)
Definition: mpg_common.cpp:143
index_unit::frame
uint8_t frame
Definition: mpg_common.h:45
extdata_t::frmperpkt
int frmperpkt
Definition: mpg_common.h:60
index_unit::err
uint8_t err
Definition: mpg_common.h:49
index_unit::framesize
uint32_t framesize
Definition: mpg_common.h:50
index_unit::gop
uint8_t gop
Definition: mpg_common.h:43
dummy_buffer
Definition: ringbuffer.h:49
extdata_t::dbuf
dummy_buffer dbuf
Definition: mpg_common.h:62
extdata_t::pts
uint64_t pts
Definition: mpg_common.h:56
show_buf
void show_buf(uint8_t *buf, int length)
Definition: mpg_common.cpp:37
index_unit
Definition: mpg_common.h:35
ring_find_mpg_header
int ring_find_mpg_header(ringbuffer *rbuf, uint8_t head, int off, int le)
Definition: mpg_common.cpp:177
peek_poke_vec
std::vector< uint8_t > peek_poke_vec
Definition: ringbuffer.h:35
index_unit::pts
uint64_t pts
Definition: mpg_common.h:39
index_unit::length
uint32_t length
Definition: mpg_common.h:37