[FFmpeg-devel] [PATCH v2 1/2] lavf: Add general API for IO buffer synchronization.

Andrey Semashev andrey.semashev at gmail.com
Thu Dec 6 21:44:34 EET 2018

On 12/6/18 10:34 PM, Nicolas George wrote:
> Andrey Semashev (2018-12-06):
>> Could you provide an example where ENOTSUP (i.e. the error code) would make
>> more sense for a sync operation, as opposed to AVIO_SYNC_NOT_SUPPORTED (i.e.
>> the success code)?
> It is not a matter making more sense, both are semantically equivalent.
> It is a matter of better matching the rest of the API.
>> I have used this API internally in an application for a few years, and I
>> never wanted to distinguish the "not supported" case from "success", let
>> alone specifically handle it as an error.
> If you do not care that the sync was not done, then you did not need to
> sync in the first place. Syncing is about guaranteeing the user that the
> data is safe; if you ignore the information that it was not done, then
> you are not guaranteeing it.

I do need sync - when it is supported by the underlying resource (e.g. a 
file). In that case, I care about it and I check for errors.

I do not care for the sync result if the underlying resource does not 
support the concept of syncing. In that case, I want to see a success 
code and treat the operation as a no-op.

With ENOTSUP, every call to avio_sync & co. I have would have to 
explicitly check for ENOTSUP and ignore it. I just don't see any benefit 
of this.

More information about the ffmpeg-devel mailing list