You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/mjpegenc: Reconstify mjpeg encoder
It has been deconstified in 2c2dfd9149
because the FFCodec is touched in av_codec_init_static because
of its get_supported_config callback. Yet this is easily remedied:
Only call get_supported_config to set pix_fmts if the codec does
not already have it set.
This also fixes a mismatch between the declaration of ff_mjpeg_encoder
in allcodecs.c and the definition in mjpegenc.c. Said mismatch is
actually undefined behaviour.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -937,10 +937,11 @@ static void av_codec_init_static(void)
|
|||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
switch (codec->p.type) {
|
switch (codec->p.type) {
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
codec->get_supported_config(NULL, &codec->p,
|
if (!codec->p.pix_fmts)
|
||||||
AV_CODEC_CONFIG_PIX_FORMAT, 0,
|
codec->get_supported_config(NULL, &codec->p,
|
||||||
(const void **) &codec->p.pix_fmts,
|
AV_CODEC_CONFIG_PIX_FORMAT, 0,
|
||||||
&dummy);
|
(const void **) &codec->p.pix_fmts,
|
||||||
|
&dummy);
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
codec->get_supported_config(NULL, &codec->p,
|
codec->get_supported_config(NULL, &codec->p,
|
||||||
|
@ -675,7 +675,7 @@ static int mjpeg_get_supported_config(const AVCodecContext *avctx,
|
|||||||
return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
|
return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
FFCodec ff_mjpeg_encoder = {
|
const FFCodec ff_mjpeg_encoder = {
|
||||||
.p.name = "mjpeg",
|
.p.name = "mjpeg",
|
||||||
CODEC_LONG_NAME("MJPEG (Motion JPEG)"),
|
CODEC_LONG_NAME("MJPEG (Motion JPEG)"),
|
||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
|
Reference in New Issue
Block a user