[FFmpeg-devel] [PATCH v2 1/3] avutil/dict: add av_dict_pop

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Oct 20 17:00:45 EEST 2023


Anton Khirnov:
> Quoting Andreas Rheinhardt (2023-07-03 20:02:25)
>> Marvin Scholz:
>>> I honestly can't think of a sensible API design for this,
>>> if you have any idea feel free to share.
>>>
>>
>> The only way I can think of that allows this is for the user to pass a
>> pointer to a (const) AVDictionaryEntry, namely the entry that the user
>> wishes to pop. This is of course cumbersome, because it would be two
>> function calls.
> 
> We could start guaranteeing that entries with the same key are always
> returned in insertion order. Now that I think of it there's some code in
> ffmpeg CLI that relies on that.
> 

IIRC this is not true correctly, because removing an entry changes the
order of the remaining entries (we don't memmove the remaining entries
into the new position; instead we move the last entry to the now vacant
slot).

- Andreas



More information about the ffmpeg-devel mailing list