On Sun, 17 Apr 2016 13:18:42 +0200 Andreas Weis <der_ghul...@ghulbus-inc.de> wrote:
> Hi everyone! > > I was trying to use a custom log callback and noticed that this pretty > much requires using av_log_format_line(), as the interpretation of the > format string is not trivial. Uh what? It's just snprintf formatting. What av_log_format_line() is adding additional information, which in theory the API user can build on its own. (I'm not going to claim that this is pretty or easy or in any way sane, just that you don't need to call it. I don't either in my own custom log callback.) > Unfortunately this approach offers no way of determining the size of the > output buffer for the log message. Typically in such a situation, one > would do two calls to snprintf - one with the buffer set to NULL which > then gives the required buffer size as a return value and then a second > call to perform the actual copy of the message. > > I noticed that ffmpeg internally simply uses a hardcoded buffer size of > 1024, which might be fine for most cases, but probably not all. > > My question is, could we change the return value of av_log_format_line > (which currently returns void) to returns the number of characters > written to its `line` argument, or the number of characters which would > have been written if that argument is set to NULL? > > Since av_log_format_line calls snprintf internally, that might be as > trivial as just forwarding the return value from that call. This suggestion might make sense. You'll have to add it as av_log_format_line2() or so, because the existing API must remain compatible. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel