Initial revision
[libav.git] / mpegenc.h
CommitLineData
9aeeeb63
FB
1
2#include "avcodec.h"
3
4/* byte stream handling */
5
6typedef struct {
7 unsigned char *buffer;
8 unsigned char *buf_ptr, *buf_end;
9 void *opaque;
10 void (*write_packet)(void *opaque, UINT8 *buf, int buf_size);
11 int (*write_seek)(void *opaque, long long offset, int whence);
12 long long pos; /* position in the file of the current buffer */
13} PutByteContext;
14
15int init_put_byte(PutByteContext *s,
16 unsigned char *buffer,
17 int buffer_size,
18 void *opaque,
19 void (*write_packet)(void *opaque, UINT8 *buf, int buf_size),
20 int (*write_seek)(void *opaque, long long offset, int whence));
21
22void put_byte(PutByteContext *s, int b);
23void put_buffer(PutByteContext *s, unsigned char *buf, int size);
24void put_le32(PutByteContext *s, unsigned int val);
25void put_le64(PutByteContext *s, unsigned long long val);
26void put_le16(PutByteContext *s, unsigned int val);
27void put_tag(PutByteContext *s, char *tag);
28
29long long put_seek(PutByteContext *s, long long offset, int whence);
30long long put_pos(PutByteContext *s);
31
32void put_flush_packet(PutByteContext *s);
33
34/* udp.c */
35
36typedef struct {
37 int udp_socket;
38 int max_payload_size; /* in bytes */
39} UDPContext;
40
41int udp_tx_open(UDPContext *s,
42 const char *uri,
43 int local_port);
44void udp_tx_close(UDPContext *s);
45void udp_write_data(void *opaque, UINT8 *buf, int size);
46
47/* generic functions */
48
49struct AVFormatContext;
50
51typedef struct AVFormat {
52 char *name;
53 char *long_name;
54 char *mime_type;
55 char *extensions; /* comma separated extensions */
56 enum CodecID audio_codec;
57 enum CodecID video_codec;
58 int (*write_header)(struct AVFormatContext *);
59 int (*write_audio_frame)(struct AVFormatContext *,
60 unsigned char *buf, int size);
61 int (*write_video_picture)(struct AVFormatContext *,
62 unsigned char *buf, int size);
63 int (*write_trailer)(struct AVFormatContext *);
64 struct AVFormat *next;
65} AVFormat;
66
67typedef struct AVFormatContext {
68 struct AVFormat *format;
69 void *priv_data;
70 PutByteContext pb;
71 AVEncodeContext *video_enc;
72 AVEncodeContext *audio_enc;
73 int is_streamed; /* true if the stream is generated as being streamed */
74} AVFormatContext;
75
76extern AVFormat *first_format;
77extern int data_out_size;
78extern const char *comment_string;
79
80/* rv10enc.c */
81extern AVFormat rm_format;
82extern AVFormat ra_format;
83
84/* mpegmux.c */
85extern AVFormat mpeg_mux_format;
86
87/* asfenc.c */
88extern AVFormat asf_format;
89
90/* jpegenc.c */
91extern AVFormat mpjpeg_format;
92extern AVFormat jpeg_format;
93
94/* swfenc.c */
95extern AVFormat swf_format;
96
97/* formats.c */
98void register_avformat(AVFormat *format);
99AVFormat *guess_format(const char *short_name, const char *filename, const char *mime_type);
100
101void register_avencoder(AVEncoder *format);
102AVEncoder *avencoder_find(enum CodecID id);
103void avencoder_string(char *buf, int buf_size, AVEncodeContext *enc);
104
105int avencoder_open(AVEncodeContext *avctx, AVEncoder *codec);
106int avencoder_encode(AVEncodeContext *avctx, UINT8 *buf, int buf_size, void *data);
107int avencoder_close(AVEncodeContext *avctx);
108
109extern AVFormat mp2_format;
110extern AVFormat ac3_format;
111extern AVFormat h263_format;
112extern AVFormat mpeg1video_format;
113
114int strstart(const char *str, const char *val, const char **ptr);
115
116
117/* grab.c */
118
119extern const char *v4l_device;
120
121long long gettime(void);
122int v4l_init(int rate, int width, int height);
123int v4l_read_picture(UINT8 *picture[3],
124 int width, int height,
125 int picture_number);
126
127int audio_open(int freq, int channels);