Merge commit '3f75e5116b900f1428aa13041fc7d6301bf1988a'

* commit '3f75e5116b900f1428aa13041fc7d6301bf1988a':
  avio: Keep track of the amount of data written

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-04-13 19:49:20 -03:00
commit 34d7f337c1
3 changed files with 10 additions and 1 deletions

View File

@ -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;
/**

View File

@ -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);

View File

@ -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, \