[FFmpeg-devel] [PATCH] avformat/utils: add helper functions to retrieve index entries from an AVStream
James Almer
jamrial at gmail.com
Thu Apr 1 17:49:18 EEST 2021
On 4/1/2021 11:29 AM, Nicolas George wrote:
> James Almer (12021-04-01):
>> Pos doesn't seem like it would be useful outside of the internal seeking
>> methods, size seems to be the least useful of them all
>
> pos and size seem very useful to me for an application that wants to
> make quick graphs of (time, bitrate).
>
> As a general rule "foobar does not seem useful for users" is usually a
> lack of imagination from the developer.
Yet the line has to be drawn somewhere. Otherwise public headers would
be chock full of structs and/or fields normally kept in internal headers
because "Someone may find them useful".
Look at adts_parser, av_adts_header_parse() returns only two fields from
AACADTSHeaderInfo. Could the rest be useful for some users? Probably,
people can surely come up with all kinds of scenarios where such fields
could be useful, like you and i did for AVIndexEntry ones, but in this
case a decision ultimately was made that only samples and frames would
be made available.
>
>> So instead of making a new struct, or build a second array internally, we
>> could maybe just return those two fields?
>
> Why do you want to complicate things? Just return the darn pointer and
> trust the users to use it properly to access the fields they need,
> without speculating.
Please refrain from making such accusations. I want to not return a
volatile pointer if i can avoid it, because no matter how many warnings
you add or how much you trust the user, it's an unsafe practice.
But if both you and Anton consider it the less problematic solution,
then fine, lets go with it.
More information about the ffmpeg-devel
mailing list