MythTV  master
avi.h
Go to the documentation of this file.
1 /*
2  * avi.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 _AVI_H_
28 #define _AVI_H_
29 
30 #include <stdint.h>
31 #include "mpg_common.h"
32 #include "pes.h"
33 
34 #define TAG_IT(a,b,c,d) ((d<<24) | (c<<16) | (b<<8)|a)
35 #define ALIGN(a) (((4-a)%3)%3)
36 
37 #define AVI_HASINDEX 0x00000010
38 #define AVI_USEINDEX 0x00000020
39 #define AVI_INTERLEAVED 0x00000100
40 
41 typedef struct avi_index_s {
42  uint32_t id;
43  uint32_t flags, len;
44  uint32_t off;
46 
47 typedef struct avi_audio_s
48 {
49  uint32_t dw_scale, dw_rate;
50  uint32_t dw_sample_size;
51  uint32_t fps;
52  uint32_t type;
53  uint32_t initial_frames;
54  uint32_t dw_start;
55  uint32_t dw_ssize;
57 
58 typedef struct avi_video_s
59 {
62  uint32_t dw_scale, dw_rate;
63  uint32_t fps;
64  uint32_t pos_off;
65  uint32_t initial_frames;
66  uint32_t dw_start;
68 
69 #define MAX_TRACK 10
70 typedef struct {
71  int64_t riff_end;
72  int64_t movi_start;
73  int64_t movi_length;
74  int last_size;
75  int done;
76 
77  uint64_t next_frame;
78 
79  int ntracks;
80  uint32_t num_idx_alloc;
81  uint32_t num_idx_frames;
82  uint32_t msec_per_frame;
83  uint32_t avih_flags;
84  uint32_t total_frames;
85  uint32_t init_frames;
86  uint32_t width;
87  uint32_t height;
88  uint32_t nstreams;
89  uint32_t vhandler;
90  uint32_t ahandler;
91  uint32_t vchunks;
92  uint32_t achunks;
93  uint32_t zero_vchunks;
94  uint32_t zero_achunks;
95 
96  uint32_t current_idx;
97 
100 
102 } avi_context;
103 
104 int check_riff(avi_context *ac, uint8_t *buf, int len);
105 int read_avi_header( avi_context *ac, int fd);
106 void get_avi(pes_in_t *p, uint8_t *buf, int count, void (*func)(pes_in_t *p));
107 int avi_read_index(avi_context *ac, int fd);
108 int get_avi_from_index(pes_in_t *p, int fd, avi_context *ac,
109  void (*func)(pes_in_t *p), uint32_t insize);
110 
111 
112 #endif /* _AVI_H_ */
avi_audio_s::dw_scale
uint32_t dw_scale
Definition: avi.h:49
avi_audio_s::fps
uint32_t fps
Definition: avi.h:51
avi_context::zero_vchunks
uint32_t zero_vchunks
Definition: avi.h:93
avi_audio_s::type
uint32_t type
Definition: avi.h:52
pes.h
check_riff
int check_riff(avi_context *ac, uint8_t *buf, int len)
Definition: avi.cpp:79
avi_video_s::width
uint16_t width
Definition: avi.h:60
MAX_TRACK
#define MAX_TRACK
Definition: avi.h:69
avi_context::movi_length
int64_t movi_length
Definition: avi.h:73
avi_context::riff_end
int64_t riff_end
Definition: avi.h:71
avi_context::num_idx_alloc
uint32_t num_idx_alloc
Definition: avi.h:80
avi_audio_s
Definition: avi.h:48
avi_context::width
uint32_t width
Definition: avi.h:86
avi_video_s::pos_off
uint32_t pos_off
Definition: avi.h:64
avi_video_s::dw_start
uint32_t dw_start
Definition: avi.h:66
avi_context::vhandler
uint32_t vhandler
Definition: avi.h:89
avi_audio_s::dw_rate
uint32_t dw_rate
Definition: avi.h:49
avi_context::last_size
int last_size
Definition: avi.h:74
avi_context::ahandler
uint32_t ahandler
Definition: avi.h:90
avi_audio_s::dw_ssize
uint32_t dw_ssize
Definition: avi.h:55
avi_video_s::fps
uint32_t fps
Definition: avi.h:63
get_avi
void get_avi(pes_in_t *p, uint8_t *buf, int count, void(*func)(pes_in_t *p))
Definition: avi.cpp:525
avi_context::total_frames
uint32_t total_frames
Definition: avi.h:84
avi_index
struct avi_index_s avi_index
avi_read_index
int avi_read_index(avi_context *ac, int fd)
Definition: avi.cpp:142
hardwareprofile.config.p
p
Definition: config.py:33
avi_context::done
int done
Definition: avi.h:75
avi_context::current_idx
uint32_t current_idx
Definition: avi.h:96
avi_index_s::len
uint32_t len
Definition: avi.h:43
read_avi_header
int read_avi_header(avi_context *ac, int fd)
Definition: avi.cpp:215
mpg_common.h
avi_context::avih_flags
uint32_t avih_flags
Definition: avi.h:83
avi_context::ntracks
int ntracks
Definition: avi.h:79
avi_video_s::height
uint16_t height
Definition: avi.h:61
avi_audio_info
struct avi_audio_s avi_audio_info
avi_context::height
uint32_t height
Definition: avi.h:87
get_avi_from_index
int get_avi_from_index(pes_in_t *p, int fd, avi_context *ac, void(*func)(pes_in_t *p), uint32_t insize)
Definition: avi.cpp:426
avi_context::msec_per_frame
uint32_t msec_per_frame
Definition: avi.h:82
avi_context::next_frame
uint64_t next_frame
Definition: avi.h:77
avi_video_s::dw_rate
uint32_t dw_rate
Definition: avi.h:62
avi_context::achunks
uint32_t achunks
Definition: avi.h:92
avi_index_s::id
uint32_t id
Definition: avi.h:42
avi_context
Definition: avi.h:70
avi_context::init_frames
uint32_t init_frames
Definition: avi.h:85
avi_video_s::initial_frames
uint32_t initial_frames
Definition: avi.h:65
avi_context::vchunks
uint32_t vchunks
Definition: avi.h:91
avi_index_s::flags
uint32_t flags
Definition: avi.h:43
avi_audio_s::dw_start
uint32_t dw_start
Definition: avi.h:54
avi_index_s
Definition: avi.h:41
avi_context::num_idx_frames
uint32_t num_idx_frames
Definition: avi.h:81
avi_video_s
Definition: avi.h:59
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
avi_audio_s::dw_sample_size
uint32_t dw_sample_size
Definition: avi.h:50
avi_audio_s::initial_frames
uint32_t initial_frames
Definition: avi.h:53
pes_in_t
Definition: pes.h:70
avi_context::idx
avi_index * idx
Definition: avi.h:101
avi_context::vi
avi_video_info vi
Definition: avi.h:98
avi_context::zero_achunks
uint32_t zero_achunks
Definition: avi.h:94
avi_video_s::dw_scale
uint32_t dw_scale
Definition: avi.h:62
avi_index_s::off
uint32_t off
Definition: avi.h:44
avi_video_info
struct avi_video_s avi_video_info
avi_context::movi_start
int64_t movi_start
Definition: avi.h:72
avi_context::nstreams
uint32_t nstreams
Definition: avi.h:88