[x265] [PATCH 1 of 2] Add support for customizing logging

Derek Buitenhuis derek.buitenhuis at gmail.com
Sun Mar 18 18:04:41 CET 2018


On 3/16/2018 3:28 PM, Andrey Semashev wrote:
> +/* x265_set_log:
> + *       Sets a custom logger function */
> +void x265_set_log(x265_log_t log);

I would like to voice my distaste for this implementation.

This is a global callback, and will introduce problems with e.g. multiple
libraries or dependencies in a program have libx265 as a dependency, or even
with multiple encoders in the same program are used.

Consider program A that has B as a dependency, both of which use libx265:

A - libx265
  - B
      - libx265

Either A or B could set the log callback for x265, and it would take
over for both. This is not ideal, and it is the same design mistake
we at FFmpeg made a long time ago, which has been haunting us for years.

Further, defining user types ending in _t is not allowed in C (which this
header is, and is used from), and x265 does not do this.

- Derek


More information about the x265-devel mailing list