[FFmpeg-devel] [PATCH] avpacket: RFC for ABI bump additions

Marton Balint cus at passwd.hu
Sat Jan 23 22:42:41 EET 2021



On Sat, 23 Jan 2021, Lynne wrote:

> Jan 23, 2021, 21:04 by cus at passwd.hu:
>
>>
>>
>> On Sat, 23 Jan 2021, Lynne wrote:
>>
>>> This is an RFC about the upcoming additions to the AVPacket structure
>>> (whose size is still part of the ABI, so we need to plan for any changes).
>>>
>>> The current RFC patch adds 3 fields:
>>>     - "void *opaque;" for the user to use as they wish, same as AVFrame.opaque
>>>     - "void *opaque_ref;" for more permanent and propagating user data, same as AVFrame.opaque_ref
>>>
>>
>> These seem legit.
>>
>>>     - "AVRational time_base;" which will be set to indicate the time base of the packet's timestamps
>>>
>>
>> Why? It seems redundant and it will not be clear when to use to use stream/bsf/etc time base and when embedded AVPacket timebase. So I don't think this is a good idea.
>>
>
> I'd like to switch to using this to avoid the dance you have to do with
> avformat init, where you have to give it your packet's time_base in the stream time_base
> then init, which then sets the time_base in the same field you provided your time_base,
> and then you have to rescale the timestamps of packets to that timebase.

That is by design as far as I know, you set the timebase to your 
requested time base, if the format supports that then you are happy, if 
not, then you convert.

> Wouldn't it be simpler to just give avformat packets and let it adjust the
> packet time base internally as it sees fit and store it in a private_ref field?

I would not want avformat to rescale timestamps behind my back, that way I 
control how I lose precision.

Regards,
Marton

>
> It was a struggle figuring out how to init avformat properly since none of this
> was documented when I was implementing it, and it was only thanks to
> comments in mpv's source that I figured it out.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list