Mercurial > mplayer.hg
annotate libmpdemux/muxer.h @ 27485:88f74be78ee2
Fix rgb15/16 vs. bgr part2.
author | michael |
---|---|
date | Thu, 04 Sep 2008 18:24:25 +0000 |
parents | 268ecf0e1ba4 |
children | d643e4643313 |
rev | line source |
---|---|
26029 | 1 #ifndef MPLAYER_MUXER_H |
2 #define MPLAYER_MUXER_H | |
2529 | 3 |
26143
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
4 #include <stdint.h> |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
5 #include <sys/types.h> |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
6 #include "aviheader.h" |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
7 #include "ms_hdr.h" |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
8 #include "stream/stream.h" |
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
9 |
8585 | 10 #define MUXER_MAX_STREAMS 16 |
2529 | 11 |
8585 | 12 #define MUXER_TYPE_VIDEO 0 |
13 #define MUXER_TYPE_AUDIO 1 | |
14 | |
15 #define MUXER_TYPE_AVI 0 | |
16 #define MUXER_TYPE_MPEG 1 | |
12016
b962aaad2940
rawvideo muxer patch by John Earl <jwe21@cam.ac.uk>
ranma
parents:
11222
diff
changeset
|
17 #define MUXER_TYPE_RAWVIDEO 2 |
14757
7a2adc5e8928
initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents:
14753
diff
changeset
|
18 #define MUXER_TYPE_LAVF 3 |
15754 | 19 #define MUXER_TYPE_RAWAUDIO 4 |
8585 | 20 |
2529 | 21 |
22 typedef struct { | |
23 // muxer data: | |
24 int type; // audio or video | |
25 int id; // stream no | |
8585 | 26 uint32_t ckid; // chunk id (00dc 01wb etc) |
2529 | 27 double timer; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
2652
diff
changeset
|
28 off_t size; |
12061 | 29 float aspect; // aspect ratio of this stream (set by ve_*.c) |
2529 | 30 // buffering: |
31 unsigned char *buffer; | |
32 unsigned int buffer_size; | |
2592 | 33 unsigned int buffer_len; |
8585 | 34 // mpeg block buffer: |
35 unsigned char *b_buffer; | |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
36 unsigned int b_buffer_size; //size of b_buffer |
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
37 unsigned int b_buffer_ptr; //index to next data to write |
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
38 unsigned int b_buffer_len; //len of next data to write |
17023
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
39 // muxer frame buffer: |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
40 unsigned int muxbuf_seen; |
2529 | 41 // source stream: |
42 void* source; // sh_audio or sh_video | |
43 int codec; // codec used for encoding. 0 means copy | |
44 // avi stream header: | |
45 AVIStreamHeader h; // Rate/Scale and SampleSize must be filled by caller! | |
46 // stream specific: | |
47 WAVEFORMATEX *wf; | |
48 BITMAPINFOHEADER *bih; // in format | |
17660 | 49 int encoder_delay; // in number of frames |
50 int decoder_delay; // in number of frames | |
23308
f63408f61f0f
Add imgfmt (AKA pixel format) to muxer_stream_t so that encoders can
corey
parents:
21960
diff
changeset
|
51 int imgfmt; |
8585 | 52 // mpeg specific: |
53 size_t ipb[3]; // sizes of I/P/B frames | |
9007
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
54 // muxer of that stream |
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
55 struct muxer_t *muxer; |
11222 | 56 void *priv; // private stream specific data stored by the muxer |
17480
3993a5fad89a
pass vbv_size & max_rate from encoder to muxer over muxer_stream_t (if this is wrong/silly/10000000l then dont hesitate to flame / reverse)
michael
parents:
17023
diff
changeset
|
57 |
3993a5fad89a
pass vbv_size & max_rate from encoder to muxer over muxer_stream_t (if this is wrong/silly/10000000l then dont hesitate to flame / reverse)
michael
parents:
17023
diff
changeset
|
58 int vbv_size; |
3993a5fad89a
pass vbv_size & max_rate from encoder to muxer over muxer_stream_t (if this is wrong/silly/10000000l then dont hesitate to flame / reverse)
michael
parents:
17023
diff
changeset
|
59 int max_rate; |
19360
d4d72e5eea07
pass average bitrate from encoder to (lavf) muxer
michael
parents:
18241
diff
changeset
|
60 int avg_rate; |
8585 | 61 } muxer_stream_t; |
2529 | 62 |
63 typedef struct { | |
8585 | 64 uint32_t id; |
7145
3854945aefbb
new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents:
5572
diff
changeset
|
65 char *text; |
8585 | 66 } muxer_info_t; |
7145
3854945aefbb
new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents:
5572
diff
changeset
|
67 |
8585 | 68 typedef struct muxer_t{ |
2529 | 69 // encoding: |
70 MainAVIHeader avih; | |
12036 | 71 off_t movi_start; |
72 off_t movi_end; | |
73 off_t file_end; // for MPEG it's system timestamp in 1/90000 s | |
17648 | 74 float audio_delay_fix; |
2529 | 75 // index: |
76 AVIINDEXENTRY *idx; | |
77 int idx_pos; | |
78 int idx_size; | |
79 // streams: | |
8585 | 80 int num_videos; // for MPEG recalculations |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
81 int num_audios; |
8585 | 82 unsigned int sysrate; // max rate in bytes/s |
2529 | 83 //int num_streams; |
8585 | 84 muxer_stream_t* def_v; // default video stream (for general headers) |
85 muxer_stream_t* streams[MUXER_MAX_STREAMS]; | |
17023
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
86 // muxer frame buffer: |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
87 struct muxbuf_t * muxbuf; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
88 int muxbuf_num; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
89 int muxbuf_skip_buffer; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
90 // functions: |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
19360
diff
changeset
|
91 stream_t *stream; |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
92 void (*fix_stream_parameters)(muxer_stream_t *); |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17480
diff
changeset
|
93 void (*cont_write_chunk)(muxer_stream_t *,size_t,unsigned int, double dts, double pts); |
9007
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
94 void (*cont_write_header)(struct muxer_t *); |
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
95 void (*cont_write_index)(struct muxer_t *); |
8585 | 96 muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int); |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
97 void *priv; |
8585 | 98 } muxer_t; |
2529 | 99 |
17023
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
100 /* muxer frame buffer */ |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
101 typedef struct muxbuf_t { |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
102 muxer_stream_t *stream; /* pointer back to corresponding stream */ |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17480
diff
changeset
|
103 double dts; /* decode timestamp / time at which this packet should be feeded into the decoder */ |
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17480
diff
changeset
|
104 double pts; /* presentation timestamp / time at which the data in this packet will be presented to the user */ |
17023
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
105 unsigned char *buffer; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
106 size_t len; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
107 unsigned int flags; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
108 } muxbuf_t; |
dd5be8f8d16d
buffering in the muxer layer; patch by Corey Hickey (bugfood-ml ad fatooh punctum org) plus small fixes by me
nicodvb
parents:
15754
diff
changeset
|
109 |
21960 | 110 extern char *force_fourcc; |
111 | |
21660
ca9da45d13e9
muxers now write to output muxer->stream rather than to muxer->file
nicodvb
parents:
19360
diff
changeset
|
112 muxer_t *muxer_new_muxer(int type,stream_t *stream); |
8585 | 113 #define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a) |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
114 #define muxer_stream_fix_parameters(muxer, a) muxer->fix_stream_parameters(a) |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17480
diff
changeset
|
115 void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double dts, double pts); |
9007
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
116 #define muxer_write_header(muxer) muxer->cont_write_header(muxer) |
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
117 #define muxer_write_index(muxer) muxer->cont_write_index(muxer) |
2529 | 118 |
14753
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
119 int muxer_init_muxer_avi(muxer_t *); |
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
120 int muxer_init_muxer_mpeg(muxer_t *); |
70c446099f40
new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)
nicodvb
parents:
12061
diff
changeset
|
121 int muxer_init_muxer_rawvideo(muxer_t *); |
14955 | 122 int muxer_init_muxer_lavf(muxer_t *); |
15754 | 123 int muxer_init_muxer_rawaudio(muxer_t *); |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
23308
diff
changeset
|
124 |
26029 | 125 #endif /* MPLAYER_MUXER_H */ |