Mercurial > mplayer.hg
annotate libmpdemux/muxer.h @ 17977:f70772d02eaa
Convert printfs in aviprint.c to mp_msg and give the information printing
functions in this file a verbosity_level parameter.
author | diego |
---|---|
date | Mon, 27 Mar 2006 17:25:41 +0000 |
parents | fbff80473a6d |
children | b19dada1aeeb |
rev | line source |
---|---|
2529 | 1 |
8585 | 2 #define MUXER_MAX_STREAMS 16 |
2529 | 3 |
8585 | 4 #define MUXER_TYPE_VIDEO 0 |
5 #define MUXER_TYPE_AUDIO 1 | |
6 | |
7 #define MUXER_TYPE_AVI 0 | |
8 #define MUXER_TYPE_MPEG 1 | |
12016
b962aaad2940
rawvideo muxer patch by John Earl <jwe21@cam.ac.uk>
ranma
parents:
11222
diff
changeset
|
9 #define MUXER_TYPE_RAWVIDEO 2 |
14757
7a2adc5e8928
initial, extremely experimental, libavformat muxer; don't expect anything to work yet
nicodvb
parents:
14753
diff
changeset
|
10 #define MUXER_TYPE_LAVF 3 |
15754 | 11 #define MUXER_TYPE_RAWAUDIO 4 |
8585 | 12 |
2529 | 13 |
14 typedef struct { | |
15 // muxer data: | |
16 int type; // audio or video | |
17 int id; // stream no | |
8585 | 18 uint32_t ckid; // chunk id (00dc 01wb etc) |
2529 | 19 double timer; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
2652
diff
changeset
|
20 off_t size; |
12061 | 21 float aspect; // aspect ratio of this stream (set by ve_*.c) |
2529 | 22 // buffering: |
23 unsigned char *buffer; | |
24 unsigned int buffer_size; | |
2592 | 25 unsigned int buffer_len; |
8585 | 26 // mpeg block buffer: |
27 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
|
28 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
|
29 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
|
30 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
|
31 // 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
|
32 unsigned int muxbuf_seen; |
2529 | 33 // source stream: |
34 void* source; // sh_audio or sh_video | |
35 int codec; // codec used for encoding. 0 means copy | |
36 // avi stream header: | |
37 AVIStreamHeader h; // Rate/Scale and SampleSize must be filled by caller! | |
38 // stream specific: | |
39 WAVEFORMATEX *wf; | |
40 BITMAPINFOHEADER *bih; // in format | |
17660 | 41 int encoder_delay; // in number of frames |
42 int decoder_delay; // in number of frames | |
8585 | 43 // mpeg specific: |
44 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
|
45 // muxer of that stream |
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
46 struct muxer_t *muxer; |
11222 | 47 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
|
48 |
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
|
49 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
|
50 int max_rate; |
8585 | 51 } muxer_stream_t; |
2529 | 52 |
53 typedef struct { | |
8585 | 54 uint32_t id; |
7145
3854945aefbb
new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents:
5572
diff
changeset
|
55 char *text; |
8585 | 56 } muxer_info_t; |
7145
3854945aefbb
new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents:
5572
diff
changeset
|
57 |
8585 | 58 typedef struct muxer_t{ |
2529 | 59 // encoding: |
60 MainAVIHeader avih; | |
12036 | 61 off_t movi_start; |
62 off_t movi_end; | |
63 off_t file_end; // for MPEG it's system timestamp in 1/90000 s | |
17648 | 64 float audio_delay_fix; |
2529 | 65 // index: |
66 AVIINDEXENTRY *idx; | |
67 int idx_pos; | |
68 int idx_size; | |
69 // streams: | |
8585 | 70 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
|
71 int num_audios; |
8585 | 72 unsigned int sysrate; // max rate in bytes/s |
2529 | 73 //int num_streams; |
8585 | 74 muxer_stream_t* def_v; // default video stream (for general headers) |
75 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
|
76 // 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
|
77 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
|
78 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
|
79 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
|
80 // functions: |
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 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
|
82 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
|
83 void (*cont_write_header)(struct muxer_t *); |
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
84 void (*cont_write_index)(struct muxer_t *); |
8585 | 85 muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int); |
9007
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
86 FILE* file; |
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
|
87 void *priv; |
8585 | 88 } muxer_t; |
2529 | 89 |
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
|
90 /* 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 } 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
|
99 |
17487
fa17424b4c7b
change muxer_write_chunk() so that pts/dts _could_ be passed from encoder to muxer
michael
parents:
17480
diff
changeset
|
100 #define MP_NOPTS_VALUE (-1LL<<63) //both int64_t and double should be able to represent this exactly |
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
|
101 |
9007
12fc55eb3373
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
102 muxer_t *muxer_new_muxer(int type,FILE *); |
8585 | 103 #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
|
104 #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
|
105 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
|
106 #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
|
107 #define muxer_write_index(muxer) muxer->cont_write_index(muxer) |
2529 | 108 |
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
|
109 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
|
110 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
|
111 int muxer_init_muxer_rawvideo(muxer_t *); |
14955 | 112 int muxer_init_muxer_lavf(muxer_t *); |
15754 | 113 int muxer_init_muxer_rawaudio(muxer_t *); |