annotate libmpdemux/muxer.h @ 17351:2518f4341587

OS X compilation fix: Include inttypes.h so that uint32_t is not undefined.
author diego
date Sun, 08 Jan 2006 22:57:59 +0000
parents dd5be8f8d16d
children 3993a5fad89a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
1
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
2 #define MUXER_MAX_STREAMS 16
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
3
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
4 #define MUXER_TYPE_VIDEO 0
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
5 #define MUXER_TYPE_AUDIO 1
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
6
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
7 #define MUXER_TYPE_AVI 0
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
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
7b0599d9614a rawaudio muxer
ranma
parents: 14955
diff changeset
11 #define MUXER_TYPE_RAWAUDIO 4
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
12
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
13
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
14 typedef struct {
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
15 // muxer data:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
16 int type; // audio or video
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
17 int id; // stream no
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
18 uint32_t ckid; // chunk id (00dc 01wb etc)
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
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
656a1b45b309 Use aspect from encoder for AVI vprp header
ranma
parents: 12036
diff changeset
21 float aspect; // aspect ratio of this stream (set by ve_*.c)
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
22 // buffering:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
23 unsigned char *buffer;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
24 unsigned int buffer_size;
2592
2efa0d20e4c4 buffer_len added
arpi
parents: 2529
diff changeset
25 unsigned int buffer_len;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
26 // mpeg block buffer:
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
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
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
33 // source stream:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
34 void* source; // sh_audio or sh_video
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
35 int codec; // codec used for encoding. 0 means copy
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
36 // avi stream header:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
37 AVIStreamHeader h; // Rate/Scale and SampleSize must be filled by caller!
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
38 // stream specific:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
39 WAVEFORMATEX *wf;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
40 BITMAPINFOHEADER *bih; // in format
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
41 // mpeg specific:
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
42 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
43 // muxer of that stream
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
44 struct muxer_t *muxer;
11222
b82e3ecb11e0 some updates in muxer api
alex
parents: 9007
diff changeset
45 void *priv; // private stream specific data stored by the muxer
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
46 } muxer_stream_t;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
47
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
48 typedef struct {
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
49 uint32_t id;
7145
3854945aefbb new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents: 5572
diff changeset
50 char *text;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
51 } muxer_info_t;
7145
3854945aefbb new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents: 5572
diff changeset
52
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
53 typedef struct muxer_t{
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
54 // encoding:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
55 MainAVIHeader avih;
12036
846ed866f86c OpenDML read/write support
ranma
parents: 12016
diff changeset
56 off_t movi_start;
846ed866f86c OpenDML read/write support
ranma
parents: 12016
diff changeset
57 off_t movi_end;
846ed866f86c OpenDML read/write support
ranma
parents: 12016
diff changeset
58 off_t file_end; // for MPEG it's system timestamp in 1/90000 s
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
59 // index:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
60 AVIINDEXENTRY *idx;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
61 int idx_pos;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
62 int idx_size;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
63 // streams:
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
64 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
65 int num_audios;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
66 unsigned int sysrate; // max rate in bytes/s
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
67 //int num_streams;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
68 muxer_stream_t* def_v; // default video stream (for general headers)
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
69 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
70 // 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
71 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
72 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
73 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
74 // 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
75 void (*fix_stream_parameters)(muxer_stream_t *);
9007
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
76 void (*cont_write_chunk)(muxer_stream_t *,size_t,unsigned int);
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
77 void (*cont_write_header)(struct muxer_t *);
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
78 void (*cont_write_index)(struct muxer_t *);
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
79 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
80 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
81 void *priv;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
82 } muxer_t;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
83
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
84 /* 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
85 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
86 muxer_stream_t *stream; /* pointer back to corresponding stream */
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 double timer; /* snapshot of stream timer */
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 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
89 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
90 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
91 } 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
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
93
9007
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
94 muxer_t *muxer_new_muxer(int type,FILE *);
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
95 #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
96 #define muxer_stream_fix_parameters(muxer, a) muxer->fix_stream_parameters(a)
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
97 void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags);
9007
12fc55eb3373 Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents: 8585
diff changeset
98 #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
99 #define muxer_write_index(muxer) muxer->cont_write_index(muxer)
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
100
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
101 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
102 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
103 int muxer_init_muxer_rawvideo(muxer_t *);
14955
081167e3d000 missing declaration, fixes:
rathann
parents: 14757
diff changeset
104 int muxer_init_muxer_lavf(muxer_t *);
15754
7b0599d9614a rawaudio muxer
ranma
parents: 14955
diff changeset
105 int muxer_init_muxer_rawaudio(muxer_t *);