[FFmpeg-devel] [PATCH 18/18] lavf: document some AVStream fields as private

Michael Niedermayer michael at niedermayer.cc
Sat Oct 10 00:55:00 EEST 2020


On Fri, Oct 09, 2020 at 03:04:30PM +0200, Anton Khirnov wrote:
> Specifically: pts_wrap_bits, first_dts, cur_dts.
> They are supposed to be private and are located in the private section
> of AVStream, but ffmpeg.c currently accesses them regardless. They
> should be moved to AVStreamInternal once that bug is fixed.
> 
> Remove the marker for the private AVStream section, as there are no
> other accessible fields left there. It has proven highly confusing and
> people kept adding supposedly-public fields into the private section.
> New private per-stream fields should be added to AVStreamInternal.
> ---
>  libavformat/avformat.h | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index a01912d654..612791a2eb 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1013,22 +1013,16 @@ typedef struct AVStream {
>       */
>      AVCodecParameters *codecpar;
>  
> -    /*****************************************************************
> -     * All fields below this line are not part of the public API. They
> -     * may not be used outside of libavformat and can be changed and
> -     * removed at will.
> -     * Internal note: be aware that physically removing these fields
> -     * will break ABI. Replace removed fields with dummy fields, and
> -     * add new fields to AVStreamInternal.
> -     *****************************************************************
> -     */
> -
>  #if LIBAVFORMAT_VERSION_MAJOR < 59
>      // kept for ABI compatibility only, do not access in any way
>      void *unused;
>  #endif
>  

> -    int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
> +    /**
> +     * number of bits in pts (used for wrapping control)
> +     * private, do not access from outside libavformat.
> +     */
> +    int pts_wrap_bits;

This is maybe a really bad way to export "pts_wrap_bits" but i think
User applications could quite reasonably need to know at which point pts wrap.
Or whats the max duration for a timebase where pts are still unique or valid.

Based on this a user app might warn the user at the begin of transcoding that
timestamps will wrap and that with non streaming output, wrap might equal fail.

so maybe this should not be declared private without replacement.

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201009/95f491eb/attachment.sig>


More information about the ffmpeg-devel mailing list