From c6392551423d0c575c8d72fb309c310c8879904b Mon Sep 17 00:00:00 2001 From: Kurt Kartaltepe Date: Mon, 21 Feb 2022 14:41:07 -0800 Subject: [PATCH] linux-v4l2: Fix warnings in mjpeg Previously the switch did not catch all cases issuing a quite large warning. Also there was a const-ness warning for codecs on ffmpeg 5.0 that this addresses. --- plugins/linux-v4l2/v4l2-mjpeg.c | 3 ++- plugins/linux-v4l2/v4l2-mjpeg.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/linux-v4l2/v4l2-mjpeg.c b/plugins/linux-v4l2/v4l2-mjpeg.c index a04293265..f8deea3ab 100644 --- a/plugins/linux-v4l2/v4l2-mjpeg.c +++ b/plugins/linux-v4l2/v4l2-mjpeg.c @@ -75,7 +75,6 @@ void v4l2_destroy_mjpeg(struct v4l2_mjpeg_decoder *decoder) int v4l2_decode_mjpeg(struct obs_source_frame *out, uint8_t *data, size_t length, struct v4l2_mjpeg_decoder *decoder) { - decoder->packet->data = data; decoder->packet->size = length; if (avcodec_send_packet(decoder->context, decoder->packet) < 0) { @@ -106,6 +105,8 @@ int v4l2_decode_mjpeg(struct obs_source_frame *out, uint8_t *data, case AV_PIX_FMT_YUV444P: out->format = VIDEO_FORMAT_I444; break; + default: + break; } return 0; diff --git a/plugins/linux-v4l2/v4l2-mjpeg.h b/plugins/linux-v4l2/v4l2-mjpeg.h index 04ff75c39..aa19ec4d9 100644 --- a/plugins/linux-v4l2/v4l2-mjpeg.h +++ b/plugins/linux-v4l2/v4l2-mjpeg.h @@ -29,7 +29,7 @@ extern "C" { * Data structure for mjpeg decoding */ struct v4l2_mjpeg_decoder { - AVCodec *codec; + const AVCodec *codec; AVCodecContext *context; AVPacket *packet; AVFrame *frame;