James Almer (12024-09-25): > It still requires allocating it before using it, but since a normal > filterchain will have buffersrc -> [...] -> buffersink, the same allocated > struct can be used for both.
A filter chain can have buffersinks but no buffersrc, if it uses other sources. Also, a dynamic allocation does the same damage to the code readability and reliability whether it is in a speed-critical part of the code or not. We should be trying to REMOVE instances where a dynamic allocation is necessary, not add to them. This consideration takes precedence over cosmetic considerations like internal consistency or adherence to established practices (aka coding like Java developers who see C for the first time). In this case, that means we should find a solution without dynamic allocation for buffersink and then implement it for buffersrc also rather than using the solution with dynamic allocation on both. And we should do that especially because it is very easy: two solutions came to me in the first few minutes, more could come. - Let callers allocate their structure as they wish, on the stack if necessary, pass sizeof(params) as an extra argument and use memcpy() to fetch/return it. - Have an instance of the struct in the buffersrc/sink and make it available for that use. Regards, -- Nicolas George _______________________________________________ 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".