annotate libmpdemux/muxer.h @ 8950:8fd72eae8886

Small updates for correctness and consistency.
author diego
date Mon, 13 Jan 2003 23:45:14 +0000
parents 27da710563c2
children 12fc55eb3373
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
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
9
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
10 #define MUXER_MPEG_BLOCKSIZE 2048 // 2048 or 2324 - ?
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
11
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
12 typedef struct {
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
13 // muxer data:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
14 int type; // audio or video
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
15 int id; // stream no
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
16 uint32_t ckid; // chunk id (00dc 01wb etc)
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
17 double timer;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 2652
diff changeset
18 off_t size;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
19 // buffering:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
20 unsigned char *buffer;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
21 unsigned int buffer_size;
2592
2efa0d20e4c4 buffer_len added
arpi
parents: 2529
diff changeset
22 unsigned int buffer_len;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
23 // mpeg block buffer:
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
24 unsigned char *b_buffer;
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
25 unsigned int b_buffer_ptr;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
26 // source stream:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
27 void* source; // sh_audio or sh_video
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
28 int codec; // codec used for encoding. 0 means copy
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
29 // avi stream header:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
30 AVIStreamHeader h; // Rate/Scale and SampleSize must be filled by caller!
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
31 // stream specific:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
32 WAVEFORMATEX *wf;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
33 BITMAPINFOHEADER *bih; // in format
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
34 // mpeg specific:
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
35 unsigned int gop_start; // frame number of this GOP start
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
36 size_t ipb[3]; // sizes of I/P/B frames
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
37 } muxer_stream_t;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
38
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
39 typedef struct {
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
40 uint32_t id;
7145
3854945aefbb new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents: 5572
diff changeset
41 char *text;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
42 } muxer_info_t;
7145
3854945aefbb new mencoder option -info, to store copyright, title, encoder version etc in AVI
arpi
parents: 5572
diff changeset
43
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
44 typedef struct muxer_t{
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
45 // encoding:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
46 MainAVIHeader avih;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
47 unsigned int movi_start;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
48 unsigned int movi_end;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
49 unsigned int file_end; // for MPEG it's system timestamp in 1/90000 s
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
50 // index:
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
51 AVIINDEXENTRY *idx;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
52 int idx_pos;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
53 int idx_size;
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
54 // streams:
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
55 int num_videos; // for MPEG recalculations
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
56 unsigned int sysrate; // max rate in bytes/s
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
57 //int num_streams;
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
58 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
59 muxer_stream_t* streams[MUXER_MAX_STREAMS];
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
60 void (*cont_write_chunk)(struct muxer_t *,muxer_stream_t *,FILE *,size_t,unsigned int);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
61 void (*cont_write_header)(struct muxer_t *,FILE *);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
62 void (*cont_write_index)(struct muxer_t *,FILE *);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
63 muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
64 } muxer_t;
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
65
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
66 muxer_t* muxer_new_muxer(int type);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
67 #define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a)
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
68 #define muxer_write_chunk(muxer,a,b,c,d) muxer->cont_write_chunk(muxer,a,b,c,d)
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
69 #define muxer_write_header(muxer,f) muxer->cont_write_header(muxer,f)
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
70 #define muxer_write_index(muxer,f) muxer->cont_write_index(muxer,f)
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
71
8585
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
72 void muxer_init_muxer_avi(muxer_t *);
27da710563c2 the long-waited MUXER layer, and new MPEG-PS muxer
arpi
parents: 7145
diff changeset
73 void muxer_init_muxer_mpeg(muxer_t *);
2529
266dab71162b AVI muxer rewritten
arpi
parents:
diff changeset
74