Mercurial > mplayer.hg
annotate libmpeg2/mpeg2.h @ 17050:cd540846d052
Add support to get the list of files from a file containing one filename
per line. Patch from devik (devik .at. cdi .dot. cz).
author | albeu |
---|---|
date | Sat, 26 Nov 2005 17:10:17 +0000 |
parents | 1385ec491ffb |
children | 24b2d27f2407 |
rev | line source |
---|---|
1 | 1 /* |
2 * mpeg2.h | |
12932 | 3 * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> |
9852 | 4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> |
1 | 5 * |
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
9852 | 7 * See http://libmpeg2.sourceforge.net/ for updates. |
36 | 8 * |
1 | 9 * mpeg2dec is free software; you can redistribute it and/or modify |
10 * it under the terms of the GNU General Public License as published by | |
36 | 11 * the Free Software Foundation; either version 2 of the License, or |
12 * (at your option) any later version. | |
13 * | |
1 | 14 * mpeg2dec is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
36 | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1 | 17 * GNU General Public License for more details. |
36 | 18 * |
1 | 19 * You should have received a copy of the GNU General Public License |
36 | 20 * along with this program; if not, write to the Free Software |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
14732
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
12932
diff
changeset
|
22 * |
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
12932
diff
changeset
|
23 * Modified for use with MPlayer, see libmpeg-0.4.0.diff for the exact changes. |
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
12932
diff
changeset
|
24 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
1385ec491ffb
Mark locally modified files as such to comply more closely with GPL 2a.
diego
parents:
12932
diff
changeset
|
25 * $Id$ |
1 | 26 */ |
27 | |
9852 | 28 #ifndef MPEG2_H |
29 #define MPEG2_H | |
30 | |
12932 | 31 #define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) |
32 #define MPEG2_RELEASE MPEG2_VERSION (0, 4, 0) /* 0.4.0 */ | |
33 | |
9852 | 34 #define SEQ_FLAG_MPEG2 1 |
35 #define SEQ_FLAG_CONSTRAINED_PARAMETERS 2 | |
36 #define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4 | |
37 #define SEQ_FLAG_LOW_DELAY 8 | |
38 #define SEQ_FLAG_COLOUR_DESCRIPTION 16 | |
36 | 39 |
9852 | 40 #define SEQ_MASK_VIDEO_FORMAT 0xe0 |
41 #define SEQ_VIDEO_FORMAT_COMPONENT 0 | |
42 #define SEQ_VIDEO_FORMAT_PAL 0x20 | |
43 #define SEQ_VIDEO_FORMAT_NTSC 0x40 | |
44 #define SEQ_VIDEO_FORMAT_SECAM 0x60 | |
45 #define SEQ_VIDEO_FORMAT_MAC 0x80 | |
46 #define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0 | |
47 | |
12932 | 48 typedef struct mpeg2_sequence_s { |
9852 | 49 unsigned int width, height; |
50 unsigned int chroma_width, chroma_height; | |
51 unsigned int byte_rate; | |
52 unsigned int vbv_buffer_size; | |
53 uint32_t flags; | |
54 | |
55 unsigned int picture_width, picture_height; | |
56 unsigned int display_width, display_height; | |
57 unsigned int pixel_width, pixel_height; | |
58 unsigned int frame_period; | |
36 | 59 |
9852 | 60 uint8_t profile_level_id; |
61 uint8_t colour_primaries; | |
62 uint8_t transfer_characteristics; | |
63 uint8_t matrix_coefficients; | |
12932 | 64 } mpeg2_sequence_t; |
65 | |
66 #define GOP_FLAG_DROP_FRAME 1 | |
67 #define GOP_FLAG_BROKEN_LINK 2 | |
68 #define GOP_FLAG_CLOSED_GOP 4 | |
69 | |
70 typedef struct mpeg2_gop_s { | |
71 uint8_t hours; | |
72 uint8_t minutes; | |
73 uint8_t seconds; | |
74 uint8_t pictures; | |
75 uint32_t flags; | |
76 } mpeg2_gop_t; | |
9852 | 77 |
78 #define PIC_MASK_CODING_TYPE 7 | |
79 #define PIC_FLAG_CODING_TYPE_I 1 | |
80 #define PIC_FLAG_CODING_TYPE_P 2 | |
81 #define PIC_FLAG_CODING_TYPE_B 3 | |
82 #define PIC_FLAG_CODING_TYPE_D 4 | |
1 | 83 |
9852 | 84 #define PIC_FLAG_TOP_FIELD_FIRST 8 |
85 #define PIC_FLAG_PROGRESSIVE_FRAME 16 | |
86 #define PIC_FLAG_COMPOSITE_DISPLAY 32 | |
87 #define PIC_FLAG_SKIP 64 | |
12932 | 88 #define PIC_FLAG_TAGS 128 |
10509 | 89 #define PIC_FLAG_REPEAT_FIRST_FIELD 256 |
9852 | 90 #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000 |
91 | |
12932 | 92 typedef struct mpeg2_picture_s { |
9852 | 93 unsigned int temporal_reference; |
94 unsigned int nb_fields; | |
12932 | 95 uint32_t tag, tag2; |
9852 | 96 uint32_t flags; |
97 struct { | |
98 int x, y; | |
99 } display_offset[3]; | |
12932 | 100 } mpeg2_picture_t; |
1 | 101 |
12932 | 102 typedef struct mpeg2_fbuf_s { |
9852 | 103 uint8_t * buf[3]; |
104 void * id; | |
12932 | 105 } mpeg2_fbuf_t; |
1 | 106 |
12932 | 107 typedef struct mpeg2_info_s { |
108 const mpeg2_sequence_t * sequence; | |
109 const mpeg2_gop_t * gop; | |
110 const mpeg2_picture_t * current_picture; | |
111 const mpeg2_picture_t * current_picture_2nd; | |
112 const mpeg2_fbuf_t * current_fbuf; | |
113 const mpeg2_picture_t * display_picture; | |
114 const mpeg2_picture_t * display_picture_2nd; | |
115 const mpeg2_fbuf_t * display_fbuf; | |
116 const mpeg2_fbuf_t * discard_fbuf; | |
9852 | 117 const uint8_t * user_data; |
12932 | 118 unsigned int user_data_len; |
9852 | 119 } mpeg2_info_t; |
120 | |
121 typedef struct mpeg2dec_s mpeg2dec_t; | |
12932 | 122 typedef struct mpeg2_decoder_s mpeg2_decoder_t; |
123 | |
124 typedef enum { | |
125 STATE_BUFFER = 0, | |
126 STATE_SEQUENCE = 1, | |
127 STATE_SEQUENCE_REPEATED = 2, | |
128 STATE_GOP = 3, | |
129 STATE_PICTURE = 4, | |
130 STATE_SLICE_1ST = 5, | |
131 STATE_PICTURE_2ND = 6, | |
132 STATE_SLICE = 7, | |
133 STATE_END = 8, | |
134 STATE_INVALID = 9, | |
135 STATE_INVALID_END = 10 | |
136 } mpeg2_state_t; | |
9852 | 137 |
12932 | 138 typedef struct mpeg2_convert_init_s { |
139 unsigned int id_size; | |
140 unsigned int buf_size[3]; | |
141 void (* start) (void * id, const mpeg2_fbuf_t * fbuf, | |
142 const mpeg2_picture_t * picture, const mpeg2_gop_t * gop); | |
143 void (* copy) (void * id, uint8_t * const * src, unsigned int v_offset); | |
144 } mpeg2_convert_init_t; | |
145 typedef enum { | |
146 MPEG2_CONVERT_SET = 0, | |
147 MPEG2_CONVERT_STRIDE = 1, | |
148 MPEG2_CONVERT_START = 2 | |
149 } mpeg2_convert_stage_t; | |
150 typedef int mpeg2_convert_t (int stage, void * id, | |
151 const mpeg2_sequence_t * sequence, int stride, | |
152 uint32_t accel, void * arg, | |
153 mpeg2_convert_init_t * result); | |
154 int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg); | |
155 int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride); | |
9852 | 156 void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id); |
157 void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf); | |
36 | 158 |
9852 | 159 #define MPEG2_ACCEL_X86_MMX 1 |
160 #define MPEG2_ACCEL_X86_3DNOW 2 | |
161 #define MPEG2_ACCEL_X86_MMXEXT 4 | |
162 #define MPEG2_ACCEL_PPC_ALTIVEC 1 | |
163 #define MPEG2_ACCEL_ALPHA 1 | |
164 #define MPEG2_ACCEL_ALPHA_MVI 2 | |
12932 | 165 #define MPEG2_ACCEL_SPARC_VIS 1 |
166 #define MPEG2_ACCEL_SPARC_VIS2 2 | |
9852 | 167 #define MPEG2_ACCEL_DETECT 0x80000000 |
36 | 168 |
9852 | 169 uint32_t mpeg2_accel (uint32_t accel); |
170 mpeg2dec_t * mpeg2_init (void); | |
171 const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec); | |
172 void mpeg2_close (mpeg2dec_t * mpeg2dec); | |
36 | 173 |
9852 | 174 void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end); |
12932 | 175 int mpeg2_getpos (mpeg2dec_t * mpeg2dec); |
176 mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec); | |
9852 | 177 |
12932 | 178 void mpeg2_reset (mpeg2dec_t * mpeg2dec, int full_reset); |
9852 | 179 void mpeg2_skip (mpeg2dec_t * mpeg2dec, int skip); |
180 void mpeg2_slice_region (mpeg2dec_t * mpeg2dec, int start, int end); | |
181 | |
12932 | 182 void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2); |
183 | |
184 void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3], | |
185 uint8_t * forward_fbuf[3], uint8_t * backward_fbuf[3]); | |
186 void mpeg2_slice (mpeg2_decoder_t * decoder, int code, const uint8_t * buffer); | |
187 | |
188 typedef enum { | |
189 MPEG2_ALLOC_MPEG2DEC = 0, | |
190 MPEG2_ALLOC_CHUNK = 1, | |
191 MPEG2_ALLOC_YUV = 2, | |
192 MPEG2_ALLOC_CONVERT_ID = 3, | |
193 MPEG2_ALLOC_CONVERTED = 4 | |
194 } mpeg2_alloc_t; | |
195 | |
196 void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason); | |
197 void mpeg2_free (void * buf); | |
198 void mpeg2_malloc_hooks (void * malloc (unsigned, mpeg2_alloc_t), | |
199 int free (void *)); | |
9852 | 200 |
201 #endif /* MPEG2_H */ |