[FFmpeg-devel] [PATCH v14 4/4] avformat/image2: add Jpeg XL as image2 format

Leo Izen leo.izen at gmail.com
Fri Apr 15 22:38:30 EEST 2022


On 4/15/22 07:34, Andreas Rheinhardt wrote:
> Leo Izen:
>> +static int jpegxl_probe(const AVProbeData *p)
>> +{
>> +    const uint8_t *b = p->buf;
>> +
>> +    /* ISOBMFF-based container */
>> +    /* 0x4a584c20 == "JXL " */
>> +    if (AV_RL64(b) == FF_JPEGXL_CONTAINER_SIGNATURE_LE)
>> +        return AVPROBE_SCORE_EXTENSION + 1;
>> +    /* Raw codestreams all start with 0xff0a */
>> +    if (AV_RL16(b) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE)
>> +        return 0;
>> +    if (ff_jpegxl_verify_codestream_header(p->buf, p->buf_size) >= 0)
> This will give a linking failure if the image_jpegxl_pipe_demuxer is
> disabled.
>
I thought of that, and I tested it, and it doesn't. It produces a 
compiler warning that the static function jpegxl_probe is never called, 
which means the linker probably throws away the function entirely, thus 
eliminating a linking error. Though I admit that's a guess.
> For the record: I'm not really ok with duplicating this code in lavf and
> lavc.
>
This code was removed from avcodec when I moved it over to avformat, for 
now, in order to avoid an avpriv in avcodec's ABI. Essentially we have 
to decide to either duplicate code in the future, or move it to avcodec 
and add an avpriv to the ABI, but that is a decision that can be made 
down the road when Lynne finishes her proper parser. I believe this is a 
better solution now than the other way around since we can later change 
our minds once there will actually be duplicated code, but an avpriv 
cannot be removed once added without waiting the necessary ABI change 
period.

- Leo Izen (thebombzen)


More information about the ffmpeg-devel mailing list