Andreas Rheinhardt (12020-08-15):
> The callers of the ff_merge_*() functions fall into two categories with
> quite different needs:
> 
> One caller is can_merge_formats() which only wants to test for mergeability
> without it merging anything. In order to do so, it duplicates the lists
> it intends to test and resets their owners so that they are not modified
> by ff_merge_*(). It also means that it needs to receive the merged list
> (and not only an int containing whether the lists are mergeable) to
> properly free it.
> 
> The other callers want the lists to be actually merged. But given the
> fact that ff_merge_*() automatically updates the owners of the lists,
> they only want the information whether the merge succeeded or not; they
> don't want a link to the new list.
> 
> Therefore this commit splits these functions in two: ff_merge_*() for
> the latter callers and ff_can_merge_*() for the former.
> ff_merge_*() doesn't need to return a pointer to the combined list at all
> and hence these functions have been modified to return an int, which
> allows to distinguish between incompability and memory allocation failures.
> 
> ff_can_merge_*() meanwhile doesn't modify its arguments at all obviating
> the need for copies. This in turn implies that there is no reason to
> return a pointer to the new list, as nothing needs to be freed. These
> functions therefore return an int as well. This allowed to completely
> remove can_merge_formats() in avfiltergraph.c.
> 
> Notice that no ff_can_merge_channel_layouts() has been created, because
> there is currently no caller for this. It could be added if needed.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>

LGTM, well done.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to