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;
45 } avi_index;
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), int insize);
110 
111 
112 #endif /* _AVI_H_ */
struct avi_video_s avi_video_info
int done
Definition: avi.h:75
uint32_t achunks
Definition: avi.h:92
uint32_t dw_rate
Definition: avi.h:49
int get_avi_from_index(pes_in_t *p, int fd, avi_context *ac, void(*func)(pes_in_t *p), int insize)
Definition: avi.c:412
uint32_t dw_scale
Definition: avi.h:49
uint32_t id
Definition: avi.h:42
uint32_t flags
Definition: avi.h:43
avi_index * idx
Definition: avi.h:101
int64_t movi_start
Definition: avi.h:72
uint32_t initial_frames
Definition: avi.h:65
void get_avi(pes_in_t *p, uint8_t *buf, int count, void(*func)(pes_in_t *p))
Definition: avi.c:508
uint32_t width
Definition: avi.h:86
uint32_t vchunks
Definition: avi.h:91
uint32_t zero_achunks
Definition: avi.h:94
int64_t movi_length
Definition: avi.h:73
uint32_t num_idx_alloc
Definition: avi.h:80
int check_riff(avi_context *ac, uint8_t *buf, int len)
Definition: avi.c:76
uint16_t width
Definition: avi.h:60
struct avi_index_s avi_index
uint64_t next_frame
Definition: avi.h:77
avi_video_info vi
Definition: avi.h:98
uint32_t init_frames
Definition: avi.h:85
uint32_t nstreams
Definition: avi.h:88
uint32_t len
Definition: avi.h:43
unsigned short uint16_t
Definition: iso6937tables.h:1
int64_t riff_end
Definition: avi.h:71
uint32_t height
Definition: avi.h:87
uint32_t initial_frames
Definition: avi.h:53
int read_avi_header(avi_context *ac, int fd)
Definition: avi.c:208
uint32_t num_idx_frames
Definition: avi.h:81
uint32_t dw_sample_size
Definition: avi.h:50
struct avi_audio_s avi_audio_info
Definition: pes.h:71
uint32_t vhandler
Definition: avi.h:89
uint32_t dw_ssize
Definition: avi.h:55
int avi_read_index(avi_context *ac, int fd)
Definition: avi.c:135
uint32_t dw_rate
Definition: avi.h:62
uint32_t fps
Definition: avi.h:63
int last_size
Definition: avi.h:74
uint32_t type
Definition: avi.h:52
uint32_t msec_per_frame
Definition: avi.h:82
uint32_t total_frames
Definition: avi.h:84
uint32_t avih_flags
Definition: avi.h:83
uint32_t pos_off
Definition: avi.h:64
uint32_t zero_vchunks
Definition: avi.h:93
uint32_t dw_start
Definition: avi.h:54
int ntracks
Definition: avi.h:79
#define MAX_TRACK
Definition: avi.h:69
uint32_t dw_start
Definition: avi.h:66
uint32_t off
Definition: avi.h:44
uint16_t height
Definition: avi.h:61
uint32_t fps
Definition: avi.h:51
uint32_t dw_scale
Definition: avi.h:62
uint32_t ahandler
Definition: avi.h:90
uint32_t current_idx
Definition: avi.h:96