Commit 34d7f337 authored by James Almer's avatar James Almer

Merge commit '3f75e511'

* commit '3f75e511':
  avio: Keep track of the amount of data written
Merged-by: 's avatarJames Almer <jamrial@gmail.com>
parents c5fd47fa 3f75e511
......@@ -327,6 +327,8 @@ typedef struct AVIOContext {
* This is current internal only, do not use from outside.
*/
int (*short_seek_get)(void *opaque);
int64_t written;
} AVIOContext;
/**
......
......@@ -120,6 +120,7 @@ int ffio_init_context(AVIOContext *s,
s->current_type = AVIO_DATA_MARKER_UNKNOWN;
s->last_time = AV_NOPTS_VALUE;
s->short_seek_get = NULL;
s->written = 0;
return 0;
}
......@@ -154,6 +155,9 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
ret = s->write_packet(s->opaque, (uint8_t *)data, len);
if (ret < 0) {
s->error = ret;
} else {
if (s->pos + len > s->written)
s->written = s->pos + len;
}
}
if (s->current_type == AVIO_DATA_MARKER_SYNC_POINT ||
......@@ -323,6 +327,9 @@ int64_t avio_size(AVIOContext *s)
if (!s)
return AVERROR(EINVAL);
if (s->written)
return s->written;
if (!s->seek)
return AVERROR(ENOSYS);
size = s->seek(s->opaque, 0, AVSEEK_SIZE);
......
......@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 72
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment