r584: Fixed crash when an UI update switches between Radial and Linear gradient.
[cinelerra_cv.git] / libmpeg3 / libmpeg3.h
blob1fef447763e0ce759023c23d32dcdc5f3cb66db7
1 #ifndef LIBMPEG3_H
2 #define LIBMPEG3_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 // FIXME: don't include private definitions in external header
9 #include "mpeg3private.h"
12 /* Supported color models for mpeg3_read_frame */
13 #define MPEG3_RGB565 2
14 #define MPEG3_BGR888 0
15 #define MPEG3_BGRA8888 1
16 #define MPEG3_RGB888 3
17 #define MPEG3_RGBA8888 4
18 #define MPEG3_RGBA16161616 5
20 /* Color models for the 601 to RGB conversion */
21 /* 601 not implemented for scalar code */
22 #define MPEG3_601_RGB565 11
23 #define MPEG3_601_BGR888 7
24 #define MPEG3_601_BGRA8888 8
25 #define MPEG3_601_RGB888 9
26 #define MPEG3_601_RGBA8888 10
28 /* Supported color models for mpeg3_read_yuvframe */
29 #define MPEG3_YUV420P 12
30 #define MPEG3_YUV422P 13
35 /* Get version information */
36 int mpeg3_major();
37 int mpeg3_minor();
38 int mpeg3_release();
41 /* Check for file compatibility. Return 1 if compatible. */
42 int mpeg3_check_sig(char *path);
44 /* Open the MPEG3 stream. */
45 mpeg3_t* mpeg3_open(char *path);
47 /* Open the MPEG3 stream and copy the tables from an already open stream. */
48 /* Eliminates the initial timecode search. */
49 mpeg3_t* mpeg3_open_copy(char *path, mpeg3_t *old_file);
50 int mpeg3_close(mpeg3_t *file);
55 /* Performance */
56 int mpeg3_set_cpus(mpeg3_t *file, int cpus);
57 int mpeg3_set_mmx(mpeg3_t *file, int use_mmx);
59 /* Query the MPEG3 stream about audio. */
60 int mpeg3_has_audio(mpeg3_t *file);
61 int mpeg3_total_astreams(mpeg3_t *file); /* Number of multiplexed audio streams */
62 int mpeg3_audio_channels(mpeg3_t *file, int stream);
63 int mpeg3_sample_rate(mpeg3_t *file, int stream);
64 char* mpeg3_audio_format(mpeg3_t *file, int stream);
66 /* Total length obtained from the timecode. */
67 /* For DVD files, this is unreliable. */
68 long mpeg3_audio_samples(mpeg3_t *file, int stream);
69 int mpeg3_set_sample(mpeg3_t *file, long sample, int stream); /* Seek to a sample */
70 long mpeg3_get_sample(mpeg3_t *file, int stream); /* Tell current position */
72 /* Read a PCM buffer of audio from 1 channel and advance the position. */
73 /* Return a 1 if error. */
74 /* Stream defines the number of the multiplexed stream to read. */
75 /* If both output arguments are null the audio is not rendered. */
76 int mpeg3_read_audio(mpeg3_t *file,
77 float *output_f, /* Pointer to pre-allocated buffer of floats */
78 short *output_i, /* Pointer to pre-allocated buffer of int16's */
79 int channel, /* Channel to decode */
80 long samples, /* Number of samples to decode */
81 int stream); /* Stream containing the channel */
83 /* Reread the last PCM buffer from a different channel and advance the position */
84 int mpeg3_reread_audio(mpeg3_t *file,
85 float *output_f, /* Pointer to pre-allocated buffer of floats */
86 short *output_i, /* Pointer to pre-allocated buffer of int16's */
87 int channel, /* Channel to decode */
88 long samples, /* Number of samples to decode */
89 int stream); /* Stream containing the channel */
91 /* Read the next compressed audio chunk. Store the size in size and return a */
92 /* 1 if error. */
93 /* Stream defines the number of the multiplexed stream to read. */
94 int mpeg3_read_audio_chunk(mpeg3_t *file,
95 unsigned char *output,
96 long *size,
97 long max_size,
98 int stream);
100 /* Query the stream about video. */
101 int mpeg3_has_video(mpeg3_t *file);
102 int mpeg3_total_vstreams(mpeg3_t *file); /* Number of multiplexed video streams */
103 int mpeg3_video_width(mpeg3_t *file, int stream);
104 int mpeg3_video_height(mpeg3_t *file, int stream);
105 float mpeg3_aspect_ratio(mpeg3_t *file, int stream); /* aspect ratio. 0 if none */
106 double mpeg3_frame_rate(mpeg3_t *file, int stream); /* Frames/sec */
108 /* Total length. */
109 /* This is meaningless except for TOC files. */
110 long mpeg3_video_frames(mpeg3_t *file, int stream);
111 int mpeg3_set_frame(mpeg3_t *file, long frame, int stream); /* Seek to a frame */
112 int mpeg3_skip_frames();
113 long mpeg3_get_frame(mpeg3_t *file, int stream); /* Tell current position */
115 /* Total bytes. Used for absolute byte seeking. */
116 int64_t mpeg3_get_bytes(mpeg3_t *file);
118 /* Seek all the tracks to the absolute byte in the */
119 /* file. This eliminates the need for tocs but doesn't */
120 /* give frame accuracy. */
121 int mpeg3_seek_byte(mpeg3_t *file, int64_t byte);
122 int64_t mpeg3_tell_byte(mpeg3_t *file);
125 /* To synchronize audio and video in percentage seeking mode, these must */
126 /* be called after percentage seeking the video file and before */
127 /* percentage seeking the audio file. Then when the audio file is percentage */
128 /* seeked it will search for the nearest pts to file->percentage_pts. */
130 * double mpeg3_get_percentage_pts(mpeg3_t *file);
131 * void mpeg3_set_percentage_pts(mpeg3_t *file, double pts);
134 int mpeg3_previous_frame(mpeg3_t *file, int stream);
135 int mpeg3_end_of_audio(mpeg3_t *file, int stream);
136 int mpeg3_end_of_video(mpeg3_t *file, int stream);
138 /* Give the seconds time in the last packet read */
139 double mpeg3_get_time(mpeg3_t *file);
141 /* Read a frame. The dimensions of the input area and output frame must be supplied. */
142 /* The frame is taken from the input area and scaled to fit the output frame in 1 step. */
143 /* Stream defines the number of the multiplexed stream to read. */
144 /* The last row of **output_rows must contain 4 extra bytes for scratch work. */
145 int mpeg3_read_frame(mpeg3_t *file,
146 unsigned char **output_rows, /* Array of pointers to the start of each output row */
147 int in_x, /* Location in input frame to take picture */
148 int in_y,
149 int in_w,
150 int in_h,
151 int out_w, /* Dimensions of output_rows */
152 int out_h,
153 int color_model, /* One of the color model #defines */
154 int stream);
156 /* Get the colormodel being used natively by the stream */
157 int mpeg3_colormodel(mpeg3_t *file, int stream);
158 /* Set the row stride to be used in mpeg3_read_yuvframe */
159 int mpeg3_set_rowspan(mpeg3_t *file, int bytes, int stream);
161 /* Read a frame in the native color model used by the stream. */
162 /* The Y, U, and V planes are copied into the y, u, and v */
163 /* buffers provided. */
164 /* The input is cropped to the dimensions given but not scaled. */
165 int mpeg3_read_yuvframe(mpeg3_t *file,
166 char *y_output,
167 char *u_output,
168 char *v_output,
169 int in_x,
170 int in_y,
171 int in_w,
172 int in_h,
173 int stream);
175 /* Read a frame in the native color model used by the stream. */
176 /* The Y, U, and V planes are not copied but the _output pointers */
177 /* are redirected to the frame buffer. */
178 int mpeg3_read_yuvframe_ptr(mpeg3_t *file,
179 char **y_output,
180 char **u_output,
181 char **v_output,
182 int stream);
184 /* Drop frames number of frames */
185 int mpeg3_drop_frames(mpeg3_t *file, long frames, int stream);
187 /* Read the next compressed frame including headers. */
188 /* Store the size in size and return a 1 if error. */
189 /* Stream defines the number of the multiplexed stream to read. */
190 int mpeg3_read_video_chunk(mpeg3_t *file,
191 unsigned char *output,
192 long *size,
193 long max_size,
194 int stream);
196 /* Master control */
197 int mpeg3_total_programs();
198 int mpeg3_set_program(int program);
200 #ifdef __cplusplus
202 #endif
204 #endif