]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blob - mpegenc.h
test
[frescor/ffmpeg.git] / mpegenc.h
1
2 #include "avcodec.h"
3
4 /* byte stream handling */
5
6 typedef 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
15 int 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
22 void put_byte(PutByteContext *s, int b);
23 void put_buffer(PutByteContext *s, unsigned char *buf, int size);
24 void put_le32(PutByteContext *s, unsigned int val);
25 void put_le64(PutByteContext *s, unsigned long long val);
26 void put_le16(PutByteContext *s, unsigned int val);
27 void put_tag(PutByteContext *s, char *tag);
28
29 long long put_seek(PutByteContext *s, long long offset, int whence);
30 long long put_pos(PutByteContext *s);
31
32 void put_flush_packet(PutByteContext *s);
33
34 /* udp.c */
35
36 typedef struct {
37     int udp_socket;
38     int max_payload_size; /* in bytes */
39 } UDPContext;
40
41 int udp_tx_open(UDPContext *s,
42                 const char *uri,
43                 int local_port);
44 void udp_tx_close(UDPContext *s);
45 void udp_write_data(void *opaque, UINT8 *buf, int size);
46
47 /* generic functions */
48
49 struct AVFormatContext;
50
51 typedef 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
67 typedef 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
76 extern AVFormat *first_format;
77 extern int data_out_size;
78 extern const char *comment_string;
79
80 /* rv10enc.c */
81 extern AVFormat rm_format;
82 extern AVFormat ra_format;
83
84 /* mpegmux.c */
85 extern AVFormat mpeg_mux_format;
86
87 /* asfenc.c */
88 extern AVFormat asf_format;
89
90 /* jpegenc.c */
91 extern AVFormat mpjpeg_format;
92 extern AVFormat jpeg_format;
93
94 /* swfenc.c */
95 extern AVFormat swf_format;
96
97 /* formats.c */
98 void register_avformat(AVFormat *format);
99 AVFormat *guess_format(const char *short_name, const char *filename, const char *mime_type);
100
101 void register_avencoder(AVEncoder *format);
102 AVEncoder *avencoder_find(enum CodecID id);
103 void avencoder_string(char *buf, int buf_size, AVEncodeContext *enc);
104
105 int avencoder_open(AVEncodeContext *avctx, AVEncoder *codec);
106 int avencoder_encode(AVEncodeContext *avctx, UINT8 *buf, int buf_size, void *data);
107 int avencoder_close(AVEncodeContext *avctx);
108
109 extern AVFormat mp2_format;
110 extern AVFormat ac3_format;
111 extern AVFormat h263_format;
112 extern AVFormat mpeg1video_format;
113
114 int strstart(const char *str, const char *val, const char **ptr);
115
116
117 /* grab.c */
118
119 extern const char *v4l_device;
120
121 long long gettime(void);
122 int v4l_init(int rate, int width, int height);
123 int v4l_read_picture(UINT8 *picture[3],
124                      int width, int height,
125                      int picture_number);
126
127 int audio_open(int freq, int channels);