Revision a8c5ab27 libavformat/avio.h

View differences:

libavformat/avio.h
146 146
int url_ferror(ByteIOContext *s);
147 147

  
148 148
#define URL_EOF (-1)
149
/* NOTE: return URL_EOF (-1) if EOF */
149 150
int url_fgetc(ByteIOContext *s);
151

  
152
/* XXX: currently size is limited */
150 153
#ifdef __GNUC__
151 154
int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
152 155
#else
153 156
int url_fprintf(ByteIOContext *s, const char *fmt, ...);
154 157
#endif
158

  
159
/* note: unlike fgets, the EOL character is not returned and a whole
160
   line is parsed. return NULL if first char read was EOF */
155 161
char *url_fgets(ByteIOContext *s, char *buf, int buf_size);
156 162

  
157 163
void put_flush_packet(ByteIOContext *s);
158 164

  
159 165
int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
160 166
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
167

  
168
/* NOTE: return 0 if EOF, so you cannot use it if EOF handling is
169
   necessary */
161 170
int get_byte(ByteIOContext *s);
162 171
unsigned int get_le24(ByteIOContext *s);
163 172
unsigned int get_le32(ByteIOContext *s);
......
176 185
}
177 186

  
178 187
int url_fdopen(ByteIOContext *s, URLContext *h);
188

  
189
/* XXX: must be called before any I/O */
179 190
int url_setbufsize(ByteIOContext *s, int buf_size);
191

  
192
/* NOTE: when opened as read/write, the buffers are only used for
193
   reading */
180 194
int url_fopen(ByteIOContext *s, const char *filename, int flags);
181 195
int url_fclose(ByteIOContext *s);
182 196
URLContext *url_fileno(ByteIOContext *s);
197

  
198
/*
199
 * Return the maximum packet size associated to packetized buffered file
200
 * handle. If the file is not packetized (stream like http or file on
201
 * disk), then 0 is returned.
202
 *
203
 * @param h buffered file handle
204
 * @return maximum packet size in bytes
205
 */
183 206
int url_fget_max_packet_size(ByteIOContext *s);
184 207

  
185 208
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags);
209

  
210
/* return the written or read size */
186 211
int url_close_buf(ByteIOContext *s);
187 212

  
213
/*
214
 * Open a write only memory stream.
215
 *
216
 * @param s new IO context
217
 * @return zero if no error.
218
 */
188 219
int url_open_dyn_buf(ByteIOContext *s);
220

  
221
/*
222
 * Open a write only packetized memory stream with a maximum packet
223
 * size of 'max_packet_size'.  The stream is stored in a memory buffer
224
 * with a big endian 4 byte header giving the packet size in bytes.
225
 *
226
 * @param s new IO context
227
 * @param max_packet_size maximum packet size (must be > 0)
228
 * @return zero if no error.
229
 */
189 230
int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size);
231

  
232
/*
233
 * Return the written size and a pointer to the buffer. The buffer
234
 *  must be freed with av_free().
235
 * @param s IO context
236
 * @param pointer to a byte buffer
237
 * @return the length of the byte buffer
238
 */
190 239
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer);
191 240

  
192 241
unsigned long get_checksum(ByteIOContext *s);

Also available in: Unified diff