summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index cead878f02..e9b4f679dc 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -35,7 +35,7 @@ int init_put_byte(ByteIOContext *s,
s->buffer_size = buffer_size;
s->buf_ptr = buffer;
s->write_flag = write_flag;
- if (!s->write_flag)
+ if (!s->write_flag)
s->buf_end = buffer;
else
s->buf_end = buffer + buffer_size;
@@ -52,7 +52,7 @@ int init_put_byte(ByteIOContext *s,
s->update_checksum= NULL;
return 0;
}
-
+
#ifdef CONFIG_MUXERS
static void flush_buffer(ByteIOContext *s)
@@ -76,7 +76,7 @@ static void flush_buffer(ByteIOContext *s)
void put_byte(ByteIOContext *s, int b)
{
*(s->buf_ptr)++ = b;
- if (s->buf_ptr >= s->buf_end)
+ if (s->buf_ptr >= s->buf_end)
flush_buffer(s);
}
@@ -91,7 +91,7 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
memcpy(s->buf_ptr, buf, len);
s->buf_ptr += len;
- if (s->buf_ptr >= s->buf_end)
+ if (s->buf_ptr >= s->buf_end)
flush_buffer(s);
buf += len;
@@ -112,7 +112,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
if (whence != SEEK_CUR && whence != SEEK_SET)
return -EINVAL;
-
+
#ifdef CONFIG_MUXERS
if (s->write_flag) {
if (whence == SEEK_CUR) {
@@ -122,7 +122,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
offset += offset1;
}
offset1 = offset - s->pos;
- if (!s->must_flush &&
+ if (!s->must_flush &&
offset1 >= 0 && offset1 < (s->buf_end - s->buffer)) {
/* can do the seek inside the buffer */
s->buf_ptr = s->buffer + offset1;
@@ -135,7 +135,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
s->seek(s->opaque, offset, SEEK_SET);
s->pos = offset;
}
- } else
+ } else
#endif //CONFIG_MUXERS
{
if (whence == SEEK_CUR) {
@@ -175,7 +175,7 @@ offset_t url_ftell(ByteIOContext *s)
offset_t url_fsize(ByteIOContext *s)
{
offset_t size;
-
+
if (!s->seek)
return -EPIPE;
size = s->seek(s->opaque, -1, SEEK_END) + 1;
@@ -375,7 +375,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
{
int len;
-
+
if(size<0)
return -1;
@@ -447,7 +447,7 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
if (i < maxlen-1)
buf[i++] = c;
}
-
+
buf[i] = 0; /* Ensure null terminated, but may be truncated */
return buf;
@@ -491,7 +491,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
uint8_t *buffer;
int buffer_size, max_packet_size;
-
+
max_packet_size = url_get_max_packet_size(h);
if (max_packet_size) {
buffer_size = max_packet_size; /* no need to bufferize more than one packet */
@@ -502,7 +502,7 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
if (!buffer)
return -ENOMEM;
- if (init_put_byte(s, buffer, buffer_size,
+ if (init_put_byte(s, buffer, buffer_size,
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
url_read_packet, url_write_packet, url_seek_packet) < 0) {
av_free(buffer);
@@ -525,7 +525,7 @@ int url_setbufsize(ByteIOContext *s, int buf_size)
s->buffer = buffer;
s->buffer_size = buf_size;
s->buf_ptr = buffer;
- if (!s->write_flag)
+ if (!s->write_flag)
s->buf_end = buffer;
else
s->buf_end = buffer + buf_size;
@@ -553,7 +553,7 @@ int url_fopen(ByteIOContext *s, const char *filename, int flags)
int url_fclose(ByteIOContext *s)
{
URLContext *h = s->opaque;
-
+
av_free(s->buffer);
memset(s, 0, sizeof(ByteIOContext));
return url_close(h);
@@ -603,11 +603,11 @@ char *url_fgets(ByteIOContext *s, char *buf, int buf_size)
return buf;
}
-/*
+/*
* Return the maximum packet size associated to packetized buffered file
* handle. If the file is not packetized (stream like http or file on
* disk), then 0 is returned.
- *
+ *
* @param h buffered file handle
* @return maximum packet size in bytes
*/
@@ -620,7 +620,7 @@ int url_fget_max_packet_size(ByteIOContext *s)
/* buffer handling */
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
{
- return init_put_byte(s, buf, buf_size,
+ return init_put_byte(s, buf, buf_size,
(flags & URL_WRONLY || flags & URL_RDWR),
NULL, NULL, NULL, NULL);
}
@@ -645,7 +645,7 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
{
DynBuffer *d = opaque;
int new_size, new_allocated_size;
-
+
/* reallocate buffer if needed */
new_size = d->pos + buf_size;
new_allocated_size = d->allocated_size;
@@ -655,9 +655,9 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
if (!new_allocated_size)
new_allocated_size = new_size;
else
- new_allocated_size += new_allocated_size / 2 + 1;
+ new_allocated_size += new_allocated_size / 2 + 1;
}
-
+
if (new_allocated_size > d->allocated_size) {
d->buffer = av_realloc(d->buffer, new_allocated_size);
if(d->buffer == NULL)
@@ -707,12 +707,12 @@ static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
{
DynBuffer *d;
int io_buffer_size, ret;
-
- if (max_packet_size)
+
+ if (max_packet_size)
io_buffer_size = max_packet_size;
else
io_buffer_size = 1024;
-
+
if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
return -1;
d = av_malloc(sizeof(DynBuffer) + io_buffer_size);
@@ -723,9 +723,9 @@ static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
d->pos = 0;
d->size = 0;
d->allocated_size = 0;
- ret = init_put_byte(s, d->io_buffer, io_buffer_size,
- 1, d, NULL,
- max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
+ ret = init_put_byte(s, d->io_buffer, io_buffer_size,
+ 1, d, NULL,
+ max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
max_packet_size ? NULL : dyn_buf_seek);
if (ret == 0) {
s->max_packet_size = max_packet_size;
@@ -735,7 +735,7 @@ static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
/*
* Open a write only memory stream.
- *
+ *
* @param s new IO context
* @return zero if no error.
*/
@@ -748,9 +748,9 @@ int url_open_dyn_buf(ByteIOContext *s)
* Open a write only packetized memory stream with a maximum packet
* size of 'max_packet_size'. The stream is stored in a memory buffer
* with a big endian 4 byte header giving the packet size in bytes.
- *
+ *
* @param s new IO context
- * @param max_packet_size maximum packet size (must be > 0)
+ * @param max_packet_size maximum packet size (must be > 0)
* @return zero if no error.
*/
int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size)
@@ -760,9 +760,9 @@ int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size)
return url_open_dyn_buf_internal(s, max_packet_size);
}
-/*
+/*
* Return the written size and a pointer to the buffer. The buffer
- * must be freed with av_free().
+ * must be freed with av_free().
* @param s IO context
* @param pointer to a byte buffer
* @return the length of the byte buffer