* Buffered I/O for ffmpeg system
* Copyright (c) 2000,2001 Fabrice Bellard
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
}
}
-void put_flush_packet(AVIOContext *s)
+void avio_flush(AVIOContext *s)
{
flush_buffer(s);
s->must_flush = 0;
{
return avio_size(s);
}
+int url_setbufsize(AVIOContext *s, int buf_size)
+{
+ return ffio_set_buf_size(s, buf_size);
+}
+int url_fprintf(AVIOContext *s, const char *fmt, ...)
+{
+ va_list ap;
+ char buf[4096];
+ int ret;
+
+ va_start(ap, fmt);
+ ret = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ avio_write(s, buf, strlen(buf));
+ return ret;
+}
+void put_flush_packet(AVIOContext *s)
+{
+ avio_flush(s);
+}
+int av_url_read_fpause(AVIOContext *s, int pause)
+{
+ return ffio_read_pause(s, pause);
+}
+int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
+ int64_t timestamp, int flags)
+{
+ return ffio_read_seek(s, stream_index, timestamp, flags);
+}
#endif
int avio_put_str(AVIOContext *s, const char *str)
/* make buffer smaller in case it ended up large after probing */
if (s->buffer_size > max_buffer_size) {
- url_setbufsize(s, max_buffer_size);
+ ffio_set_buf_size(s, max_buffer_size);
s->checksum_ptr = dst = s->buffer;
len = s->buffer_size;
return val;
}
-uint64_t ff_get_v(AVIOContext *bc){
+uint64_t ffio_read_varlen(AVIOContext *bc){
uint64_t val = 0;
int tmp;
return 0;
}
-int url_setbufsize(AVIOContext *s, int buf_size)
+int ffio_set_buf_size(AVIOContext *s, int buf_size)
{
uint8_t *buffer;
buffer = av_malloc(buf_size);
return url_close(h);
}
+#if FF_API_OLD_AVIO
URLContext *url_fileno(AVIOContext *s)
{
return s->opaque;
}
+#endif
-#if CONFIG_MUXERS
-int url_fprintf(AVIOContext *s, const char *fmt, ...)
+int avio_printf(AVIOContext *s, const char *fmt, ...)
{
va_list ap;
char buf[4096];
avio_write(s, buf, strlen(buf));
return ret;
}
-#endif //CONFIG_MUXERS
#if FF_API_OLD_AVIO
char *url_fgets(AVIOContext *s, char *buf, int buf_size)
}
#endif
-int av_url_read_fpause(AVIOContext *s, int pause)
+int ffio_read_pause(AVIOContext *s, int pause)
{
if (!s->read_pause)
return AVERROR(ENOSYS);
return s->read_pause(s->opaque, pause);
}
-int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
- int64_t timestamp, int flags)
+int64_t ffio_read_seek(AVIOContext *s, int stream_index,
+ int64_t timestamp, int flags)
{
URLContext *h = s->opaque;
int64_t ret;
* back to the server even if CONFIG_MUXERS is false. */
#if CONFIG_MUXERS || CONFIG_NETWORK
/* buffer handling */
+#if FF_API_OLD_AVIO
int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
{
int ret;
int url_close_buf(AVIOContext *s)
{
- put_flush_packet(s);
+ avio_flush(s);
return s->buf_ptr - s->buffer;
}
+#endif
/* output in a dynamic buffer */
padding = FF_INPUT_BUFFER_PADDING_SIZE;
}
- put_flush_packet(s);
+ avio_flush(s);
*pbuffer = d->buffer;
size = d->size;