[FFmpeg-devel] [PATCH] lavc/bsf: add an Opus metadata bitstream filter
Lynne
dev at lynne.ee
Tue May 5 13:29:06 EEST 2020
May 5, 2020, 09:59 by andreas.rheinhardt at gmail.com:
> Lynne:
>
>> The only adjustable field is the gain. Some ripping/transcoding programs
>> have started to use it for replaygain adjustments.
>>
>> Patch attached.
>>
>> >
>> +typedef struct OpusBSFContext {
>> + const AVClass *class;
>> + int64_t gain;
>> +} OpusBSFContext;
>>
> [...]
>
>>
>> +static const AVOption opus_metadata_options[] = {
>> + { "gain", "Gain, actual amplification is pow(10, gain/(20.0*256))", OFFSET(gain),
>> + AV_OPT_TYPE_INT, { .i64 = 0 }, -(INT16_MAX + 1), INT16_MAX, .flags = FLAGS },
>> +
>> + { NULL },
>> +};
>>
>
> You are using an AV_OPT_TYPE_INT parameter, yet the actual type of the
> destination is int64_t. This won't work on big endian systems. Make gain
> an int.
>
Thanks, made it an int, patch attached.
> PS: Do we actually support two's complement architectures were
> -(INT16_MAX + 1) != INT16_MIN? (A two's complement architecture in which
> the representation where the sign bit is set and all other bits is unset
> is trap representation is legal according to the C standard. Does
> someone know whether it would also be legal according to POSIX?)
>
I think we already rely on that pretty heavily in our code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-bsf-add-an-Opus-metadata-bitstream-filter.patch
Type: text/x-patch
Size: 4376 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200505/9ea11123/attachment.bin>
More information about the ffmpeg-devel
mailing list