On Thu, Oct 14, 2021 at 12:10:36AM +0300, Jan Ekström wrote: > Looking at 3f75e5116b900f1428aa13041fc7d6301bf1988a, the field > was supposed to be private, but during merging the field and the > group that had the comment about it got separated. > > Thus, move the actual privately utilized state of this variable > into the private FFIOContext. > --- > libavformat/avio_internal.h | 5 +++++ > libavformat/aviobuf.c | 11 +++++++---- > 2 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h > index eded38759b..28ea38079d 100644 > --- a/libavformat/avio_internal.h > +++ b/libavformat/avio_internal.h > @@ -51,6 +51,11 @@ typedef struct FFIOContext { > */ > int64_t bytes_read; > > + /** > + * Bytes written statistic > + */ > + int64_t bytes_written; > + > /** > * seek statistic > */ > diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c > index 3d87d66091..7afbff0266 100644 > --- a/libavformat/aviobuf.c > +++ b/libavformat/aviobuf.c > @@ -164,8 +164,10 @@ static void writeout(AVIOContext *s, const uint8_t > *data, int len) > if (ret < 0) { > s->error = ret; > } else { > - if (s->pos + len > s->written) > - s->written = s->pos + len; > + if (s->pos + len > ctx->bytes_written) { > + ctx->bytes_written = s->pos + len; > + s->written = ctx->bytes_written; > + } > } > } > if (ctx->current_type == AVIO_DATA_MARKER_SYNC_POINT || > @@ -337,13 +339,14 @@ int64_t avio_skip(AVIOContext *s, int64_t offset) > > int64_t avio_size(AVIOContext *s) > { > + FFIOContext *const ctx = ffiocontext(s); > int64_t size; > > if (!s) > return AVERROR(EINVAL); > > - if (s->written) > - return s->written; > + if (ctx->bytes_written) > + return ctx->bytes_written;
looking at this again, it doesnt look like "written" is what "bytes_written" is if s->written represents the file size as avio_size() returns then thats different from the number of bytes written statistic as soon as any seeking has happened [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".